Skip to content

Commit 702acbf

Browse files
axosoft-ramintsergeibbb
authored andcommitted
WIP - adds option to get body on GitHub issues, uses in getMyIssues
1 parent 70c9e2e commit 702acbf

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

src/git/models/issue.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export interface IssueShape extends IssueOrPullRequest {
5252
assignees: IssueMember[];
5353
repository?: IssueRepository;
5454
labels?: IssueLabel[];
55+
body?: string;
5556
}
5657

5758
export interface SearchedIssue {
@@ -232,6 +233,7 @@ export function serializeIssue(value: IssueShape): IssueShape {
232233
})),
233234
commentsCount: value.commentsCount,
234235
thumbsUpCount: value.thumbsUpCount,
236+
body: value.body,
235237
};
236238
return serialized;
237239
}
@@ -256,5 +258,6 @@ export class Issue implements IssueShape {
256258
public readonly labels?: IssueLabel[],
257259
public readonly commentsCount?: number,
258260
public readonly thumbsUpCount?: number,
261+
public readonly body?: string,
259262
) {}
260263
}

src/plus/integrations/providers/github.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ abstract class GitHubIntegrationBase<ID extends SupportedIntegrationIds> extends
201201
{
202202
repos: repos?.map(r => `${r.owner}/${r.name}`),
203203
baseUrl: this.apiBaseUrl,
204+
includeBody: true,
204205
},
205206
cancellation,
206207
);

src/plus/integrations/providers/github/github.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2933,7 +2933,14 @@ export class GitHubApi implements Disposable {
29332933
async searchMyIssues(
29342934
provider: Provider,
29352935
token: string,
2936-
options?: { search?: string; user?: string; repos?: string[]; baseUrl?: string; avatarSize?: number },
2936+
options?: {
2937+
search?: string;
2938+
user?: string;
2939+
repos?: string[];
2940+
baseUrl?: string;
2941+
avatarSize?: number;
2942+
includeBody?: boolean;
2943+
},
29372944
cancellation?: CancellationToken,
29382945
): Promise<SearchedIssue[] | undefined> {
29392946
const scope = getLogScope();
@@ -2950,6 +2957,14 @@ export class GitHubApi implements Disposable {
29502957
};
29512958
}
29522959

2960+
const issueFragement = `${gqIssueFragment}${
2961+
options?.includeBody
2962+
? `
2963+
body
2964+
`
2965+
: ''
2966+
}`;
2967+
29532968
const query = `query searchMyIssues(
29542969
$authored: String!
29552970
$assigned: String!
@@ -2959,21 +2974,21 @@ export class GitHubApi implements Disposable {
29592974
authored: search(first: 100, query: $authored, type: ISSUE) {
29602975
nodes {
29612976
... on Issue {
2962-
${gqIssueFragment}
2977+
${issueFragement}
29632978
}
29642979
}
29652980
}
29662981
assigned: search(first: 100, query: $assigned, type: ISSUE) {
29672982
nodes {
29682983
... on Issue {
2969-
${gqIssueFragment}
2984+
${issueFragement}
29702985
}
29712986
}
29722987
}
29732988
mentioned: search(first: 100, query: $mentioned, type: ISSUE) {
29742989
nodes {
29752990
... on Issue {
2976-
${gqIssueFragment}
2991+
${issueFragement}
29772992
}
29782993
}
29792994
}

src/plus/integrations/providers/github/models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export interface GitHubIssue extends Omit<GitHubIssueOrPullRequest, '__typename'
134134
};
135135
viewerPermission: GitHubViewerPermission;
136136
};
137+
body: string;
137138
}
138139

139140
export type GitHubPullRequestReviewDecision = 'CHANGES_REQUESTED' | 'APPROVED' | 'REVIEW_REQUIRED';
@@ -436,6 +437,7 @@ export function fromGitHubIssue(value: GitHubIssue, provider: Provider): Issue {
436437
})),
437438
value.comments?.totalCount,
438439
value.reactions?.totalCount,
440+
value.body,
439441
);
440442
}
441443

0 commit comments

Comments
 (0)