Skip to content

Commit

Permalink
fix(GitHubV4): read github project items with oauth app
Browse files Browse the repository at this point in the history
  • Loading branch information
h13i32maru committed Aug 17, 2022
1 parent 5660928 commit 3632ab1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Renderer/Library/GitHub/V4/GitHubV4IssueClient.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {GitHubV4Client, PartialError} from './GitHubV4Client';
import {RemoteGitHubV4IssueEntity, RemoteGitHubV4IssueNodesEntity, RemoteGitHubV4Review, RemoteGitHubV4TimelineItemEntity} from '../../Type/RemoteGitHubV4/RemoteGitHubV4IssueNodesEntity';
import dayjs from 'dayjs';
import {Logger} from '../../Infra/Logger';
import {RemoteIssueEntity, RemoteProjectEntity, RemoteProjectFieldEntity, RemoteReviewEntity, RemoteUserEntity} from '../../Type/RemoteGitHubV3/RemoteIssueEntity';
import {RemoteGitHubV4IssueEntity, RemoteGitHubV4IssueNodesEntity, RemoteGitHubV4Review, RemoteGitHubV4TimelineItemEntity} from '../../Type/RemoteGitHubV4/RemoteGitHubV4IssueNodesEntity';
import {ArrayUtil} from '../../Util/ArrayUtil';
import {TimerUtil} from '../../Util/TimerUtil';
import dayjs from 'dayjs';
import {Logger} from '../../Infra/Logger';
import {GitHubV4Client, PartialError} from './GitHubV4Client';

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

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

const foundNodeIds = issues.map(issue => issue.node_id);
const notFoundIssues = requestIssues.filter(issue => !foundNodeIds.includes(issue.node_id));

Expand Down

0 comments on commit 3632ab1

Please sign in to comment.