Skip to content

Commit 22f5838

Browse files
committed
Fixes #2744 GH enterprise access with focus view
1 parent 6492b21 commit 22f5838

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

src/git/remotes/github.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ export class GitHubRemote extends RichRemoteProvider {
341341
}: AuthenticationSession): Promise<SearchedPullRequest[] | undefined> {
342342
return (await this.container.github)?.searchMyPullRequests(this, accessToken, {
343343
repos: [this.path],
344+
baseUrl: this.apiBaseUrl,
344345
});
345346
}
346347

@@ -349,6 +350,7 @@ export class GitHubRemote extends RichRemoteProvider {
349350
}: AuthenticationSession): Promise<SearchedIssue[] | undefined> {
350351
return (await this.container.github)?.searchMyIssues(this, accessToken, {
351352
repos: [this.path],
353+
baseUrl: this.apiBaseUrl,
352354
});
353355
}
354356
}

src/git/remotes/richRemoteProvider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ export abstract class RichRemoteProvider extends RemoteProvider {
136136

137137
if (result == null || result === cancel) return;
138138
if (result === signout) {
139-
void this.container.integrationAuthentication.deleteSession(this.id, this.authProviderDescriptor);
139+
void this.container.integrationAuthentication.deleteSession(
140+
this.authProvider.id,
141+
this.authProviderDescriptor,
142+
);
140143
}
141144
}
142145
}

src/plus/github/github.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,7 +2376,7 @@ export class GitHubApi implements Disposable {
23762376
async searchMyPullRequests(
23772377
provider: RichRemoteProvider,
23782378
token: string,
2379-
options?: { search?: string; user?: string; repos?: string[] },
2379+
options?: { search?: string; user?: string; repos?: string[]; baseUrl?: string },
23802380
): Promise<SearchedPullRequest[]> {
23812381
const scope = getLogScope();
23822382

@@ -2447,14 +2447,15 @@ export class GitHubApi implements Disposable {
24472447

24482448
const baseFilters = 'is:pr is:open archived:false';
24492449
const resp = await this.graphql<SearchResult>(
2450-
undefined,
2450+
provider,
24512451
token,
24522452
query,
24532453
{
24542454
authored: `${search} ${baseFilters} author:@me`.trim(),
24552455
assigned: `${search} ${baseFilters} assignee:@me`.trim(),
24562456
reviewRequested: `${search} ${baseFilters} review-requested:@me`.trim(),
24572457
mentioned: `${search} ${baseFilters} mentions:@me`.trim(),
2458+
baseUrl: options?.baseUrl,
24582459
},
24592460
scope,
24602461
);
@@ -2478,15 +2479,15 @@ export class GitHubApi implements Disposable {
24782479
);
24792480
return results;
24802481
} catch (ex) {
2481-
throw this.handleException(ex, undefined, scope);
2482+
throw this.handleException(ex, provider, scope);
24822483
}
24832484
}
24842485

24852486
@debug<GitHubApi['searchMyIssues']>({ args: { 0: '<token>' } })
24862487
async searchMyIssues(
24872488
provider: RichRemoteProvider,
24882489
token: string,
2489-
options?: { search?: string; user?: string; repos?: string[] },
2490+
options?: { search?: string; user?: string; repos?: string[]; baseUrl?: string },
24902491
): Promise<SearchedIssue[] | undefined> {
24912492
const scope = getLogScope();
24922493
interface SearchResult {
@@ -2540,13 +2541,14 @@ export class GitHubApi implements Disposable {
25402541
const baseFilters = 'type:issue is:open archived:false';
25412542
try {
25422543
const resp = await this.graphql<SearchResult>(
2543-
undefined,
2544+
provider,
25442545
token,
25452546
query,
25462547
{
25472548
authored: `${search} ${baseFilters} author:@me`.trim(),
25482549
assigned: `${search} ${baseFilters} assignee:@me`.trim(),
25492550
mentioned: `${search} ${baseFilters} mentions:@me`.trim(),
2551+
baseUrl: options?.baseUrl,
25502552
},
25512553
scope,
25522554
);
@@ -2570,7 +2572,7 @@ export class GitHubApi implements Disposable {
25702572
);
25712573
return results;
25722574
} catch (ex) {
2573-
throw this.handleException(ex, undefined, scope);
2575+
throw this.handleException(ex, provider, scope);
25742576
}
25752577
}
25762578
}

src/plus/webviews/focus/focusWebview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
316316
repo: repo,
317317
remote: richRemote,
318318
isConnected: await richRemote.provider.isConnected(),
319-
isGitHub: richRemote.provider.name === 'GitHub',
319+
isGitHub: richRemote.provider.id === 'github',
320320
});
321321
}
322322
if (this._repositoryEventsDisposable) {

0 commit comments

Comments
 (0)