diff --git a/src/git/models/issue.ts b/src/git/models/issue.ts index 586235e..2d1fede 100644 --- a/src/git/models/issue.ts +++ b/src/git/models/issue.ts @@ -18,6 +18,25 @@ export interface IssueOrPullRequest { readonly closed: boolean; } +export function serializeIssueOrPullRequest(value: IssueOrPullRequest): IssueOrPullRequest { + const serialized: IssueOrPullRequest = { + type: value.type, + provider: { + id: value.provider.id, + name: value.provider.name, + domain: value.provider.domain, + icon: value.provider.icon, + }, + id: value.id, + title: value.title, + url: value.url, + date: value.date, + closedDate: value.closedDate, + closed: value.closed, + }; + return serialized; +} + export namespace IssueOrPullRequest { export function getMarkdownIcon(issue: IssueOrPullRequest): string { if (issue.type === IssueOrPullRequestType.PullRequest) { diff --git a/src/git/models/pullRequest.ts b/src/git/models/pullRequest.ts index 3105e98..532f3ad 100644 --- a/src/git/models/pullRequest.ts +++ b/src/git/models/pullRequest.ts @@ -24,8 +24,8 @@ export interface PullRequestShape extends IssueOrPullRequest { readonly mergedDate?: Date; } -export function toPullRequestShape(value: PullRequest): PullRequestShape { - const shape: PullRequestShape = { +export function serializePullRequest(value: PullRequest): PullRequestShape { + const serialized: PullRequestShape = { type: value.type, provider: { id: value.provider.id, @@ -47,7 +47,7 @@ export function toPullRequestShape(value: PullRequest): PullRequestShape { state: value.state, mergedDate: value.mergedDate, }; - return shape; + return serialized; } export class PullRequest implements PullRequestShape { diff --git a/src/webviews/commitDetails/commitDetailsWebviewView.ts b/src/webviews/commitDetails/commitDetailsWebviewView.ts index 3e353bd..c066c53 100644 --- a/src/webviews/commitDetails/commitDetailsWebviewView.ts +++ b/src/webviews/commitDetails/commitDetailsWebviewView.ts @@ -9,8 +9,9 @@ import { isCommit } from '../../git/models/commit'; import type { GitFileChange } from '../../git/models/file'; import { GitFile } from '../../git/models/file'; import type { IssueOrPullRequest } from '../../git/models/issue'; +import { serializeIssueOrPullRequest } from '../../git/models/issue'; import type { PullRequest } from '../../git/models/pullRequest'; -import { toPullRequestShape } from '../../git/models/pullRequest'; +import { serializePullRequest } from '../../git/models/pullRequest'; import type { GitRevisionReference } from '../../git/models/reference'; import { Logger } from '../../logger'; import type { ShowCommitInGraphCommandArgs } from '../../plus/webviews/graph/graphWebview'; @@ -320,8 +321,8 @@ export class CommitDetailsWebviewView extends WebviewViewBase