diff --git a/src/git/formatters/commitFormatter.ts b/src/git/formatters/commitFormatter.ts index bba43fb..40824e5 100644 --- a/src/git/formatters/commitFormatter.ts +++ b/src/git/formatters/commitFormatter.ts @@ -302,7 +302,7 @@ export class CommitFormatter extends Formatter { const { pullRequestOrRemote: pr } = this._options; if (pr != null) { if (PullRequest.is(pr)) { - commands += `[$(git-pull-request) PR #${pr.number}](${pr.url} "Open Pull Request \\#${pr.number} on ${ + commands += `[$(git-pull-request) PR #${pr.id}](${pr.url} "Open Pull Request \\#${pr.id} on ${ pr.provider }\n${GlyphChars.Dash.repeat(2)}\n${pr.title}\n${pr.state}, ${pr.formatDateFromNow()}")${separator}`; } else if (pr instanceof Promises.CancellationError) { @@ -456,19 +456,19 @@ export class CommitFormatter extends Formatter { let text; if (PullRequest.is(pr)) { if (this._options.markdown) { - text = `[PR #${pr.number}](${pr.url} "Open Pull Request \\#${pr.number} on ${ + text = `[PR #${pr.id}](${pr.url} "Open Pull Request \\#${pr.id} on ${ pr.provider }\n${GlyphChars.Dash.repeat(2)}\n${pr.title}\n${pr.state}, ${pr.formatDateFromNow()}")`; } else if (this._options.footnotes != null) { const index = this._options.footnotes.size + 1; this._options.footnotes.set( index, - `PR #${pr.number}: ${pr.title} ${GlyphChars.Dot} ${pr.state}, ${pr.formatDateFromNow()}`, + `PR #${pr.id}: ${pr.title} ${GlyphChars.Dot} ${pr.state}, ${pr.formatDateFromNow()}`, ); - text = `PR #${pr.number}${Strings.getSuperscript(index)}`; + text = `PR #${pr.id}${Strings.getSuperscript(index)}`; } else { - text = `PR #${pr.number}`; + text = `PR #${pr.id}`; } } else if (pr instanceof Promises.CancellationError) { text = this._options.markdown diff --git a/src/git/models/pullRequest.ts b/src/git/models/pullRequest.ts index 44a8568..7363013 100644 --- a/src/git/models/pullRequest.ts +++ b/src/git/models/pullRequest.ts @@ -30,7 +30,7 @@ export class PullRequest { readonly avatarUrl: string; readonly url: string; }, - public readonly number: number, + public readonly id: string, public readonly title: string, public readonly url: string, public readonly state: PullRequestState, diff --git a/src/github/github.ts b/src/github/github.ts index d58d958..3ac1ec1 100644 --- a/src/github/github.ts +++ b/src/github/github.ts @@ -1,7 +1,7 @@ 'use strict'; import { graphql } from '@octokit/graphql'; import { Logger } from '../logger'; -import { debug, Functions } from '../system'; +import { debug } from '../system'; import { AuthenticationError, ClientError, IssueOrPullRequest, PullRequest, PullRequestState } from '../git/git'; import { Account } from '../git/models/author'; @@ -340,25 +340,6 @@ export class GitHubApi { avatarSize?: number; }, ): Promise { - if (ref === 'b44296e7c45a9e83530feb976f9f293a78457161') { - await Functions.wait(5000); - return new PullRequest( - provider, - { - name: 'Eric Amodio', - avatarUrl: `https://avatars1.githubusercontent.com/u/641685?s=${options?.avatarSize ?? 32}&v=4`, - url: 'https://github.com/eamodio', - }, - 1, - 'Supercharged', - 'https://github.com/eamodio/vscode-gitlens/pulls/1', - PullRequestState.Merged, - new Date('Sat, 12 Nov 2016 19:41:00 GMT'), - undefined, - new Date('Sat, 12 Nov 2016 20:41:00 GMT'), - ); - } - const cc = Logger.getCorrelationContext(); try { @@ -478,7 +459,7 @@ export namespace GitHubPullRequest { avatarUrl: pr.author.avatarUrl, url: pr.author.url, }, - pr.number, + String(pr.number), pr.title, pr.permalink, fromState(pr.state), diff --git a/src/views/nodes/pullRequestNode.ts b/src/views/nodes/pullRequestNode.ts index e957f10..519d10b 100644 --- a/src/views/nodes/pullRequestNode.ts +++ b/src/views/nodes/pullRequestNode.ts @@ -15,8 +15,8 @@ export class PullRequestNode extends ViewNode< BranchesView | CommitsView | ContributorsView | RemotesView | RepositoriesView | SearchAndCompareView > { static key = ':pullrequest'; - static getId(repoPath: string, number: number, ref: string): string { - return `${RepositoryNode.getId(repoPath)}${this.key}(${number}):${ref}`; + static getId(repoPath: string, id: string, ref: string): string { + return `${RepositoryNode.getId(repoPath)}${this.key}(${id}):${ref}`; } constructor( @@ -33,7 +33,7 @@ export class PullRequestNode extends ViewNode< } get id(): string { - return PullRequestNode.getId(this.branchOrCommit.repoPath, this.pullRequest.number, this.branchOrCommit.ref); + return PullRequestNode.getId(this.branchOrCommit.repoPath, this.pullRequest.id, this.branchOrCommit.ref); } getChildren(): ViewNode[] { @@ -41,20 +41,17 @@ export class PullRequestNode extends ViewNode< } getTreeItem(): TreeItem { - const item = new TreeItem( - `#${this.pullRequest.number}: ${this.pullRequest.title}`, - TreeItemCollapsibleState.None, - ); + const item = new TreeItem(`#${this.pullRequest.id}: ${this.pullRequest.title}`, TreeItemCollapsibleState.None); item.contextValue = ContextValues.PullRequest; item.description = `${this.pullRequest.state}, ${this.pullRequest.formatDateFromNow()}`; item.iconPath = new ThemeIcon('git-pull-request'); item.id = this.id; - item.tooltip = `${this.pullRequest.title}\n#${this.pullRequest.number} by ${this.pullRequest.author.name} was ${ + item.tooltip = `${this.pullRequest.title}\n#${this.pullRequest.id} by ${this.pullRequest.author.name} was ${ this.pullRequest.state === PullRequestState.Open ? 'opened' : this.pullRequest.state.toLowerCase() } ${this.pullRequest.formatDateFromNow()}`; if (this.branchOrCommit instanceof GitCommit) { - item.tooltip = `Commit ${this.branchOrCommit.shortSha} was introduced by PR #${this.pullRequest.number}\n${item.tooltip}`; + item.tooltip = `Commit ${this.branchOrCommit.shortSha} was introduced by PR #${this.pullRequest.id}\n${item.tooltip}`; } // item.tooltip = `Open Pull Request #${this.pullRequest.number} on ${this.pullRequest.provider}`; diff --git a/src/webviews/webviewBase.ts b/src/webviews/webviewBase.ts index 19b3674..007b98c 100644 --- a/src/webviews/webviewBase.ts +++ b/src/webviews/webviewBase.ts @@ -229,7 +229,7 @@ export abstract class WebviewBase implements Disposable { avatarUrl: 'https://avatars1.githubusercontent.com/u/641685?s=32&v=4', url: 'https://github.com/eamodio', }, - 1, + '1', 'Supercharged', 'https://github.com/eamodio/vscode-gitlens/pulls/1', PullRequestState.Merged,