Skip to content

Commit 3632ab1

Browse files
committed
fix(GitHubV4): read github project items with oauth app
1 parent 5660928 commit 3632ab1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Renderer/Library/GitHub/V4/GitHubV4IssueClient.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {GitHubV4Client, PartialError} from './GitHubV4Client';
2-
import {RemoteGitHubV4IssueEntity, RemoteGitHubV4IssueNodesEntity, RemoteGitHubV4Review, RemoteGitHubV4TimelineItemEntity} from '../../Type/RemoteGitHubV4/RemoteGitHubV4IssueNodesEntity';
1+
import dayjs from 'dayjs';
2+
import {Logger} from '../../Infra/Logger';
33
import {RemoteIssueEntity, RemoteProjectEntity, RemoteProjectFieldEntity, RemoteReviewEntity, RemoteUserEntity} from '../../Type/RemoteGitHubV3/RemoteIssueEntity';
4+
import {RemoteGitHubV4IssueEntity, RemoteGitHubV4IssueNodesEntity, RemoteGitHubV4Review, RemoteGitHubV4TimelineItemEntity} from '../../Type/RemoteGitHubV4/RemoteGitHubV4IssueNodesEntity';
45
import {ArrayUtil} from '../../Util/ArrayUtil';
56
import {TimerUtil} from '../../Util/TimerUtil';
6-
import dayjs from 'dayjs';
7-
import {Logger} from '../../Infra/Logger';
7+
import {GitHubV4Client, PartialError} from './GitHubV4Client';
88

99
type PartialIssue = {
1010
node_id: string;
@@ -271,6 +271,13 @@ export class GitHubV4IssueClient extends GitHubV4Client {
271271
// たとえばissueが別のリポジトリに移動していた場合はnodeIdが変わるようだ。
272272
const issues = data.nodes.filter(node => node);
273273

274+
// 現時点(2022-08-17)では、OAuthアプリでorgのissueのgithubプロジェクト情報を取得できず、値にnullが入ってくる。
275+
// そのためここでフィルターしておく。
276+
// 再現方法: jasperをoauthアプリ承認していないorgで、パブリックなgithubプロジェクトに紐付いたパブリックリポジトリのissueからgithubプロジェクト情報を読み取ると再現する。
277+
issues.forEach(issue => {
278+
issue.projectNextItems.nodes = issue.projectNextItems.nodes.filter(item => item != null);
279+
});
280+
274281
const foundNodeIds = issues.map(issue => issue.node_id);
275282
const notFoundIssues = requestIssues.filter(issue => !foundNodeIds.includes(issue.node_id));
276283

0 commit comments

Comments
 (0)