Преглед на файлове

Fixes more serialization issues w/ commit details

main
Eric Amodio преди 2 години
родител
ревизия
674b28f678
променени са 3 файла, в които са добавени 26 реда и са изтрити 6 реда
  1. +19
    -0
      src/git/models/issue.ts
  2. +3
    -3
      src/git/models/pullRequest.ts
  3. +4
    -3
      src/webviews/commitDetails/commitDetailsWebviewView.ts

+ 19
- 0
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) {

+ 3
- 3
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 {

+ 4
- 3
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
// commits: commitChoices,
preferences: current.preferences,
selected: details,
autolinkedIssues: current.autolinkedIssues,
pullRequest: current.pullRequest != null ? toPullRequestShape(current.pullRequest) : undefined,
autolinkedIssues: current.autolinkedIssues?.map(serializeIssueOrPullRequest),
pullRequest: current.pullRequest != null ? serializePullRequest(current.pullRequest) : undefined,
dateFormat: dateFormat,
});
return state;

Зареждане…
Отказ
Запис