From 267dbbb93acff5726eef3c90edb4a06ec9bbde95 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 19 Dec 2018 10:41:22 -0800 Subject: [PATCH 001/120] start on graphQL query for fetching inline comments --- .../issueishDetailContainerQuery.graphql.js | 151 +++++++++++------- lib/containers/issueish-detail-container.js | 8 +- ...eishDetailController_repository.graphql.js | 90 +++++++---- lib/controllers/issueish-detail-controller.js | 6 +- .../prDetailViewRefetchQuery.graphql.js | 123 +++++++++----- .../prDetailView_pullRequest.graphql.js | 27 +++- lib/views/pr-detail-view.js | 13 +- 7 files changed, 286 insertions(+), 132 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 517618ebe4..7b9148daa7 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 1f4afcef5bb1a9ba60f9a80a6c964d13 + * @relayHash b86bf34f5fb29cecb56582b73ffb540b */ /* eslint-disable */ @@ -18,6 +18,8 @@ export type issueishDetailContainerQueryVariables = {| timelineCursor?: ?string, commitCount: number, commitCursor?: ?string, + commentCount: number, + commentCursor?: ?string, |}; export type issueishDetailContainerQueryResponse = {| +repository: ?{| @@ -42,12 +44,12 @@ query issueishDetailContainerQuery( $commitCursor: String ) { repository(owner: $repoOwner, name: $repoName) { - ...issueishDetailController_repository_1mXVvq + ...issueishDetailController_repository_2LgaQ1 id } } -fragment issueishDetailController_repository_1mXVvq on Repository { +fragment issueishDetailController_repository_2LgaQ1 on Repository { ...issueDetailView_repository ...prDetailView_repository name @@ -84,7 +86,7 @@ fragment issueishDetailController_repository_1mXVvq on Repository { sshUrl id } - ...prDetailView_pullRequest_4cAEh0 + ...prDetailView_pullRequest_1Etigl } ... on Node { id @@ -149,13 +151,16 @@ fragment issueDetailView_issue_4cAEh0 on Issue { } } -fragment prDetailView_pullRequest_4cAEh0 on PullRequest { +fragment prDetailView_pullRequest_1Etigl on PullRequest { __typename ... on Node { id } isCrossRepository changedFiles + comments { + totalCount + } ...prCommitsView_pullRequest_38TpXw countedCommits: commits { totalCount @@ -556,6 +561,18 @@ var v0 = [ "name": "commitCursor", "type": "String", "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCount", + "type": "Int!", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCursor", + "type": "String", + "defaultValue": null } ], v1 = [ @@ -1043,7 +1060,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_1mXVvq\n id\n }\n}\n\nfragment issueishDetailController_repository_1mXVvq on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_4cAEh0\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_4cAEh0 on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_2LgaQ1\n id\n }\n}\n\nfragment issueishDetailController_repository_2LgaQ1 on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1065,6 +1082,18 @@ return { "kind": "FragmentSpread", "name": "issueishDetailController_repository", "args": [ + { + "kind": "Variable", + "name": "commentCount", + "variableName": "commentCount", + "type": null + }, + { + "kind": "Variable", + "name": "commentCursor", + "variableName": "commentCursor", + "type": null + }, { "kind": "Variable", "name": "commitCount", @@ -1208,55 +1237,6 @@ return { "kind": "InlineFragment", "type": "PullRequest", "selections": [ - { - "kind": "LinkedField", - "alias": "countedCommits", - "name": "commits", - "storageKey": null, - "args": null, - "concreteType": "PullRequestCommitConnection", - "plural": false, - "selections": v29 - }, - v9, - { - "kind": "ScalarField", - "alias": null, - "name": "headRefName", - "args": null, - "storageKey": null - }, - { - "kind": "LinkedField", - "alias": null, - "name": "headRepository", - "storageKey": null, - "args": null, - "concreteType": "Repository", - "plural": false, - "selections": [ - v3, - v7, - v14, - { - "kind": "ScalarField", - "alias": null, - "name": "sshUrl", - "args": null, - "storageKey": null - }, - v2 - ] - }, - v20, - { - "kind": "ScalarField", - "alias": null, - "name": "changedFiles", - "args": null, - "storageKey": null - }, - v14, { "kind": "LinkedField", "alias": null, @@ -1358,7 +1338,66 @@ return { "key": "prCommitsView_commits", "filters": null }, + v9, + { + "kind": "ScalarField", + "alias": null, + "name": "headRefName", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "headRepository", + "storageKey": null, + "args": null, + "concreteType": "Repository", + "plural": false, + "selections": [ + v3, + v7, + v14, + { + "kind": "ScalarField", + "alias": null, + "name": "sshUrl", + "args": null, + "storageKey": null + }, + v2 + ] + }, + v20, + { + "kind": "ScalarField", + "alias": null, + "name": "changedFiles", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": null, + "args": null, + "concreteType": "IssueCommentConnection", + "plural": false, + "selections": v29 + }, + v14, v10, + { + "kind": "LinkedField", + "alias": "countedCommits", + "name": "commits", + "storageKey": null, + "args": null, + "concreteType": "PullRequestCommitConnection", + "plural": false, + "selections": v29 + }, { "kind": "LinkedField", "alias": "recentCommits", @@ -1672,5 +1711,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'a7a95576735d58263820790226b82e2f'; +(node/*: any*/).hash = 'b749679230ad5e75455f1923ba78b425'; module.exports = node; diff --git a/lib/containers/issueish-detail-container.js b/lib/containers/issueish-detail-container.js index c428b9fe47..2f8a2e40f1 100644 --- a/lib/containers/issueish-detail-container.js +++ b/lib/containers/issueish-detail-container.js @@ -121,7 +121,9 @@ export default class IssueishDetailContainer extends React.Component { $timelineCount: Int! $timelineCursor: String $commitCount: Int! - $commitCursor: String + $commitCursor: String, + $commentCount: Int!, + $commentCursor: String, ) { repository(owner: $repoOwner, name: $repoName) { ...issueishDetailController_repository @arguments( @@ -130,6 +132,8 @@ export default class IssueishDetailContainer extends React.Component { timelineCursor: $timelineCursor, commitCount: $commitCount, commitCursor: $commitCursor, + commentCount: $commentCount, + commentCursor: $commentCursor, ) } } @@ -142,6 +146,8 @@ export default class IssueishDetailContainer extends React.Component { timelineCursor: null, commitCount: 100, commitCursor: null, + commentCount: 100, + commentCursor: null, }; return ( diff --git a/lib/controllers/__generated__/issueishDetailController_repository.graphql.js b/lib/controllers/__generated__/issueishDetailController_repository.graphql.js index e36d6c2e87..5f17d1be10 100644 --- a/lib/controllers/__generated__/issueishDetailController_repository.graphql.js +++ b/lib/controllers/__generated__/issueishDetailController_repository.graphql.js @@ -109,32 +109,30 @@ v5 = { "args": null, "storageKey": null }, -v6 = [ - { - "kind": "Variable", - "name": "commitCount", - "variableName": "commitCount", - "type": null - }, - { - "kind": "Variable", - "name": "commitCursor", - "variableName": "commitCursor", - "type": null - }, - { - "kind": "Variable", - "name": "timelineCount", - "variableName": "timelineCount", - "type": null - }, - { - "kind": "Variable", - "name": "timelineCursor", - "variableName": "timelineCursor", - "type": null - } -]; +v6 = { + "kind": "Variable", + "name": "commitCount", + "variableName": "commitCount", + "type": null +}, +v7 = { + "kind": "Variable", + "name": "commitCursor", + "variableName": "commitCursor", + "type": null +}, +v8 = { + "kind": "Variable", + "name": "timelineCount", + "variableName": "timelineCount", + "type": null +}, +v9 = { + "kind": "Variable", + "name": "timelineCursor", + "variableName": "timelineCursor", + "type": null +}; return { "kind": "Fragment", "name": "issueishDetailController_repository", @@ -170,6 +168,18 @@ return { "name": "commitCursor", "type": "String", "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCount", + "type": "Int!", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCursor", + "type": "String", + "defaultValue": null } ], "selections": [ @@ -204,7 +214,12 @@ return { { "kind": "FragmentSpread", "name": "issueDetailView_issue", - "args": v6 + "args": [ + v6, + v7, + v8, + v9 + ] } ] } @@ -263,7 +278,24 @@ return { { "kind": "FragmentSpread", "name": "prDetailView_pullRequest", - "args": v6 + "args": [ + { + "kind": "Variable", + "name": "commentCount", + "variableName": "commentCount", + "type": null + }, + { + "kind": "Variable", + "name": "commentCursor", + "variableName": "commentCursor", + "type": null + }, + v6, + v7, + v8, + v9 + ] } ] } @@ -273,5 +305,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '616ab785cf6824cb91ed3002553abb70'; +(node/*: any*/).hash = '0a288c1ab2398af40de27baf5db2aacb'; module.exports = node; diff --git a/lib/controllers/issueish-detail-controller.js b/lib/controllers/issueish-detail-controller.js index f1991ab5e3..ae8bc47bda 100644 --- a/lib/controllers/issueish-detail-controller.js +++ b/lib/controllers/issueish-detail-controller.js @@ -287,7 +287,7 @@ export class BareIssueishDetailController extends React.Component { addEvent('open-commit-in-pane', {package: 'github', from: this.constructor.name}); } } - +// todo: we probably don't need to commit count and cursor in the issue fragment export default createFragmentContainer(BareIssueishDetailController, { repository: graphql` fragment issueishDetailController_repository on Repository @@ -297,6 +297,8 @@ export default createFragmentContainer(BareIssueishDetailController, { timelineCursor: {type: "String"}, commitCount: {type: "Int!"}, commitCursor: {type: "String"}, + commentCount: {type: "Int!"}, + commentCursor: {type: "String"}, ) { ...issueDetailView_repository ...prDetailView_repository @@ -336,6 +338,8 @@ export default createFragmentContainer(BareIssueishDetailController, { timelineCursor: $timelineCursor, commitCount: $commitCount, commitCursor: $commitCursor, + commentCount: $commentCount, + commentCursor: $commentCursor, ) } } diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index cd360364a9..eb62f5be7c 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash ca7d9bf45e372c3f19fe741b4132b7bd + * @relayHash 690cc435f3a8f5738ba609aa81c359b4 */ /* eslint-disable */ @@ -18,6 +18,8 @@ export type prDetailViewRefetchQueryVariables = {| timelineCursor?: ?string, commitCount: number, commitCursor?: ?string, + commentCount: number, + commentCursor?: ?string, |}; export type prDetailViewRefetchQueryResponse = {| +repository: ?{| @@ -50,7 +52,7 @@ query prDetailViewRefetchQuery( } pullRequest: node(id: $issueishId) { __typename - ...prDetailView_pullRequest_4cAEh0 + ...prDetailView_pullRequest_1Etigl id } } @@ -65,13 +67,16 @@ fragment prDetailView_repository_3D8CP9 on Repository { } } -fragment prDetailView_pullRequest_4cAEh0 on PullRequest { +fragment prDetailView_pullRequest_1Etigl on PullRequest { __typename ... on Node { id } isCrossRepository changedFiles + comments { + totalCount + } ...prCommitsView_pullRequest_38TpXw countedCommits: commits { totalCount @@ -444,6 +449,18 @@ var v0 = [ "name": "commitCursor", "type": "String", "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCount", + "type": "Int!", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCursor", + "type": "String", + "defaultValue": null } ], v1 = [ @@ -531,14 +548,23 @@ v12 = { "args": null, "storageKey": null }, -v13 = { +v13 = [ + { + "kind": "ScalarField", + "alias": null, + "name": "totalCount", + "args": null, + "storageKey": null + } +], +v14 = { "kind": "ScalarField", "alias": null, "name": "url", "args": null, "storageKey": null }, -v14 = [ +v15 = [ { "kind": "Variable", "name": "after", @@ -552,7 +578,7 @@ v14 = [ "type": "Int" } ], -v15 = { +v16 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -577,36 +603,27 @@ v15 = { } ] }, -v16 = { +v17 = { "kind": "ScalarField", "alias": null, "name": "cursor", "args": null, "storageKey": null }, -v17 = { +v18 = { "kind": "ScalarField", "alias": null, "name": "avatarUrl", "args": null, "storageKey": null }, -v18 = { +v19 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v19 = [ - { - "kind": "ScalarField", - "alias": null, - "name": "totalCount", - "args": null, - "storageKey": null - } -], v20 = { "kind": "ScalarField", "alias": null, @@ -629,7 +646,7 @@ v22 = { "storageKey": null }, v23 = [ - v13 + v14 ], v24 = [ { @@ -648,7 +665,7 @@ v24 = [ v25 = [ v5, v8, - v17, + v18, v6 ], v26 = [ @@ -680,7 +697,7 @@ v28 = { }, v29 = [ v5, - v17, + v18, v8, v6 ], @@ -712,7 +729,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_4cAEh0\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_4cAEh0 on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_1Etigl\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -753,6 +770,18 @@ return { "kind": "FragmentSpread", "name": "prDetailView_pullRequest", "args": [ + { + "kind": "Variable", + "name": "commentCount", + "variableName": "commentCount", + "type": null + }, + { + "kind": "Variable", + "name": "commentCursor", + "variableName": "commentCursor", + "type": null + }, { "kind": "Variable", "name": "commitCount", @@ -824,17 +853,27 @@ return { "args": null, "storageKey": null }, - v13, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": null, + "args": null, + "concreteType": "IssueCommentConnection", + "plural": false, + "selections": v13 + }, + v14, { "kind": "LinkedField", "alias": null, "name": "commits", "storageKey": null, - "args": v14, + "args": v15, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ - v15, + v16, { "kind": "LinkedField", "alias": null, @@ -844,7 +883,7 @@ return { "concreteType": "PullRequestCommitEdge", "plural": true, "selections": [ - v16, + v17, { "kind": "LinkedField", "alias": null, @@ -873,7 +912,7 @@ return { "concreteType": "GitActor", "plural": false, "selections": [ - v17, + v18, v7, { "kind": "ScalarField", @@ -905,8 +944,8 @@ return { "args": null, "storageKey": null }, - v18, - v13 + v19, + v14 ] }, v6, @@ -921,7 +960,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v14, + "args": v15, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -934,7 +973,7 @@ return { "args": null, "concreteType": "PullRequestCommitConnection", "plural": false, - "selections": v19 + "selections": v13 }, { "kind": "LinkedField", @@ -1064,7 +1103,7 @@ return { "selections": [ v5, v8, - v17, + v18, v6, { "kind": "InlineFragment", @@ -1110,7 +1149,7 @@ return { "concreteType": "PullRequestTimelineConnection", "plural": false, "selections": [ - v15, + v16, { "kind": "LinkedField", "alias": null, @@ -1120,7 +1159,7 @@ return { "concreteType": "PullRequestTimelineItemEdge", "plural": true, "selections": [ - v16, + v17, { "kind": "LinkedField", "alias": null, @@ -1192,7 +1231,7 @@ return { "selections": [ v11, v21, - v13, + v14, { "kind": "ScalarField", "alias": "prState", @@ -1208,7 +1247,7 @@ return { "selections": [ v11, v21, - v13, + v14, { "kind": "ScalarField", "alias": "issueState", @@ -1357,7 +1396,7 @@ return { }, v22, v28, - v13 + v14 ] }, { @@ -1375,7 +1414,7 @@ return { "selections": [ v7, v31, - v17 + v18 ] }, { @@ -1388,7 +1427,7 @@ return { "plural": false, "selections": [ v7, - v17, + v18, v31 ] }, @@ -1399,7 +1438,7 @@ return { "args": null, "storageKey": null }, - v18, + v19, { "kind": "ScalarField", "alias": null, @@ -1462,7 +1501,7 @@ return { "args": null, "concreteType": "ReactingUserConnection", "plural": false, - "selections": v19 + "selections": v13 } ] } @@ -1475,5 +1514,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '04dad90234c09010553beb02cf90cbb1'; +(node/*: any*/).hash = 'f928e12221da7ed9e70170512e98cbb2'; module.exports = node; diff --git a/lib/views/__generated__/prDetailView_pullRequest.graphql.js b/lib/views/__generated__/prDetailView_pullRequest.graphql.js index ae06b6754a..b510f50297 100644 --- a/lib/views/__generated__/prDetailView_pullRequest.graphql.js +++ b/lib/views/__generated__/prDetailView_pullRequest.graphql.js @@ -19,6 +19,9 @@ export type prDetailView_pullRequest = {| +id?: string, +isCrossRepository: boolean, +changedFiles: number, + +comments: {| + +totalCount: number + |}, +countedCommits: {| +totalCount: number |}, @@ -96,6 +99,18 @@ return { "name": "commitCursor", "type": "String", "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCount", + "type": "Int!", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCursor", + "type": "String", + "defaultValue": null } ], "selections": [ @@ -127,6 +142,16 @@ return { "args": null, "storageKey": null }, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": null, + "args": null, + "concreteType": "IssueCommentConnection", + "plural": false, + "selections": v0 + }, { "kind": "FragmentSpread", "name": "prCommitsView_pullRequest", @@ -288,5 +313,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '2b7cc9778a3440738f809f76fcd3fd25'; +(node/*: any*/).hash = 'a1d134e400b0baa7d6a558165f406bb2'; module.exports = node; diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index 2c9b63ce32..22d9f6e8a8 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -373,6 +373,8 @@ export default createRefetchContainer(BarePullRequestDetailView, { timelineCursor: {type: "String"}, commitCount: {type: "Int!"}, commitCursor: {type: "String"}, + commentCount: {type: "Int!"}, + commentCursor: {type: "String"} ) { __typename @@ -383,6 +385,9 @@ export default createRefetchContainer(BarePullRequestDetailView, { ... on PullRequest { isCrossRepository changedFiles + comments { + totalCount + } ...prCommitsView_pullRequest @arguments(commitCount: $commitCount, commitCursor: $commitCursor) countedCommits: commits { totalCount @@ -415,7 +420,9 @@ export default createRefetchContainer(BarePullRequestDetailView, { $timelineCount: Int!, $timelineCursor: String, $commitCount: Int!, - $commitCursor: String + $commitCursor: String, + $commentCount: Int!, + $commentCursor: String ) { repository:node(id: $repoId) { ...prDetailView_repository @arguments( @@ -429,7 +436,9 @@ export default createRefetchContainer(BarePullRequestDetailView, { timelineCount: $timelineCount, timelineCursor: $timelineCursor, commitCount: $commitCount, - commitCursor: $commitCursor + commitCursor: $commitCursor, + commentCount: $commentCount, + commentCursor: $commentCursor ) } } From 2e215699175ed1301ec3fc4fbd2a735571ebe4ca Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 19 Dec 2018 11:51:21 -0800 Subject: [PATCH 002/120] add query to fetch reviews in the PullRequestDetailView Co-Authored-By: Vanessa Yuen --- .../issueishDetailContainerQuery.graphql.js | 457 ++++++++++++--- .../prDetailViewRefetchQuery.graphql.js | 541 +++++++++++++----- .../prDetailView_pullRequest.graphql.js | 386 +++++++++++-- lib/views/pr-detail-view.js | 57 ++ 4 files changed, 1163 insertions(+), 278 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 7b9148daa7..235deacd1c 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash b86bf34f5fb29cecb56582b73ffb540b + * @relayHash ac44654a5df27b896a882aa457ebf399 */ /* eslint-disable */ @@ -161,6 +161,82 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { comments { totalCount } + reviews(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + body + commitId: commit { + oid + id + } + state + submittedAt + login: author { + __typename + login + ... on Node { + id + } + } + author { + __typename + avatarUrl + ... on Node { + id + } + } + comments(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + pullRequestId: pullRequest { + number + id + } + databaseId + login: author { + __typename + login + ... on Node { + id + } + } + author { + __typename + avatarUrl + ... on Node { + id + } + } + body + path + commitSha: commit { + oid + id + } + diffHunk + position + originalPosition + originalCommitId: originalCommit { + oid + id + } + replyTo { + id + } + createdAt + url + } + } + } + } ...prCommitsView_pullRequest_38TpXw countedCommits: commits { totalCount @@ -725,6 +801,20 @@ v17 = [ } ], v18 = { + "kind": "ScalarField", + "alias": null, + "name": "endCursor", + "args": null, + "storageKey": null +}, +v19 = { + "kind": "ScalarField", + "alias": null, + "name": "hasNextPage", + "args": null, + "storageKey": null +}, +v20 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -733,43 +823,31 @@ v18 = { "concreteType": "PageInfo", "plural": false, "selections": [ - { - "kind": "ScalarField", - "alias": null, - "name": "endCursor", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "hasNextPage", - "args": null, - "storageKey": null - } + v18, + v19 ] }, -v19 = { +v21 = { "kind": "ScalarField", "alias": null, "name": "cursor", "args": null, "storageKey": null }, -v20 = { +v22 = { "kind": "ScalarField", "alias": null, "name": "isCrossRepository", "args": null, "storageKey": null }, -v21 = [ +v23 = [ v4, v5, v13, v2 ], -v22 = { +v24 = { "kind": "InlineFragment", "type": "CrossReferencedEvent", "selections": [ @@ -780,7 +858,7 @@ v22 = { "args": null, "storageKey": null }, - v20, + v22, { "kind": "LinkedField", "alias": null, @@ -789,7 +867,7 @@ v22 = { "args": null, "concreteType": null, "plural": false, - "selections": v21 + "selections": v23 }, { "kind": "LinkedField", @@ -859,20 +937,20 @@ v22 = { } ] }, -v23 = [ +v25 = [ v4, v13, v5, v2 ], -v24 = { +v26 = { "kind": "ScalarField", "alias": null, "name": "createdAt", "args": null, "storageKey": null }, -v25 = { +v27 = { "kind": "InlineFragment", "type": "IssueComment", "selections": [ @@ -884,14 +962,14 @@ v25 = { "args": null, "concreteType": null, "plural": false, - "selections": v23 + "selections": v25 }, v12, - v24, + v26, v14 ] }, -v26 = { +v28 = { "kind": "LinkedField", "alias": null, "name": "user", @@ -904,14 +982,14 @@ v26 = { v2 ] }, -v27 = { +v29 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v28 = { +v30 = { "kind": "InlineFragment", "type": "Commit", "selections": [ @@ -925,7 +1003,7 @@ v28 = { "plural": false, "selections": [ v3, - v26, + v28, v13 ] }, @@ -940,7 +1018,7 @@ v28 = { "selections": [ v3, v13, - v26 + v28 ] }, { @@ -950,7 +1028,7 @@ v28 = { "args": null, "storageKey": null }, - v27, + v29, { "kind": "ScalarField", "alias": null, @@ -974,7 +1052,7 @@ v28 = { } ] }, -v29 = [ +v31 = [ { "kind": "ScalarField", "alias": null, @@ -983,7 +1061,7 @@ v29 = [ "storageKey": null } ], -v30 = { +v32 = { "kind": "LinkedField", "alias": null, "name": "reactionGroups", @@ -1007,11 +1085,11 @@ v30 = { "args": null, "concreteType": "ReactingUserConnection", "plural": false, - "selections": v29 + "selections": v31 } ] }, -v31 = [ +v33 = [ { "kind": "Variable", "name": "after", @@ -1025,7 +1103,35 @@ v31 = [ "type": "Int" } ], -v32 = [ +v34 = [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } +], +v35 = { + "kind": "LinkedField", + "alias": null, + "name": "pageInfo", + "storageKey": null, + "args": null, + "concreteType": "PageInfo", + "plural": false, + "selections": [ + v19, + v18 + ] +}, +v36 = { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null +}, +v37 = [ { "kind": "ScalarField", "alias": null, @@ -1035,7 +1141,45 @@ v32 = [ }, v2 ], -v33 = { +v38 = { + "kind": "LinkedField", + "alias": "login", + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": v6 +}, +v39 = { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v4, + v13, + v2 + ] +}, +v40 = { + "kind": "ScalarField", + "alias": null, + "name": "path", + "args": null, + "storageKey": null +}, +v41 = { + "kind": "ScalarField", + "alias": null, + "name": "position", + "args": null, + "storageKey": null +}, +v42 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -1043,9 +1187,9 @@ v33 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v32 + "selections": v37 }, -v34 = { +v43 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -1053,14 +1197,14 @@ v34 = { "args": null, "concreteType": null, "plural": false, - "selections": v23 + "selections": v25 }; return { "kind": "Request", "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_2LgaQ1\n id\n }\n}\n\nfragment issueishDetailController_repository_2LgaQ1 on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_2LgaQ1\n id\n }\n}\n\nfragment issueishDetailController_repository_2LgaQ1 on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n body\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1177,7 +1321,7 @@ return { "concreteType": "IssueTimelineConnection", "plural": false, "selections": [ - v18, + v20, { "kind": "LinkedField", "alias": null, @@ -1187,7 +1331,7 @@ return { "concreteType": "IssueTimelineItemEdge", "plural": true, "selections": [ - v19, + v21, { "kind": "LinkedField", "alias": null, @@ -1199,9 +1343,9 @@ return { "selections": [ v4, v2, - v22, - v25, - v28 + v24, + v27, + v30 ] } ] @@ -1217,7 +1361,7 @@ return { "key": "IssueTimelineController_timeline", "filters": null }, - v30 + v32 ] } ] @@ -1242,11 +1386,11 @@ return { "alias": null, "name": "commits", "storageKey": null, - "args": v31, + "args": v33, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ - v18, + v20, { "kind": "LinkedField", "alias": null, @@ -1256,7 +1400,7 @@ return { "concreteType": "PullRequestCommitEdge", "plural": true, "selections": [ - v19, + v21, { "kind": "LinkedField", "alias": null, @@ -1317,7 +1461,7 @@ return { "args": null, "storageKey": null }, - v27, + v29, v14 ] }, @@ -1333,7 +1477,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v31, + "args": v33, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -1368,7 +1512,7 @@ return { v2 ] }, - v20, + v22, { "kind": "ScalarField", "alias": null, @@ -1384,7 +1528,149 @@ return { "args": null, "concreteType": "IssueCommentConnection", "plural": false, - "selections": v29 + "selections": v31 + }, + { + "kind": "LinkedField", + "alias": null, + "name": "reviews", + "storageKey": "reviews(first:100)", + "args": v34, + "concreteType": "PullRequestReviewConnection", + "plural": false, + "selections": [ + v35, + { + "kind": "LinkedField", + "alias": null, + "name": "nodes", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReview", + "plural": true, + "selections": [ + v2, + v36, + { + "kind": "LinkedField", + "alias": "commitId", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v37 + }, + v11, + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, + v38, + v39, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": "comments(first:100)", + "args": v34, + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + v35, + { + "kind": "LinkedField", + "alias": null, + "name": "nodes", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": true, + "selections": [ + { + "kind": "LinkedField", + "alias": "commitSha", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v37 + }, + v2, + { + "kind": "ScalarField", + "alias": null, + "name": "databaseId", + "args": null, + "storageKey": null + }, + v38, + v39, + v36, + v40, + { + "kind": "LinkedField", + "alias": "pullRequestId", + "name": "pullRequest", + "storageKey": null, + "args": null, + "concreteType": "PullRequest", + "plural": false, + "selections": [ + v10, + v2 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "diffHunk", + "args": null, + "storageKey": null + }, + v41, + { + "kind": "ScalarField", + "alias": null, + "name": "originalPosition", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "originalCommitId", + "name": "originalCommit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v37 + }, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v2 + ] + }, + v26, + v14 + ] + } + ] + } + ] + } + ] }, v14, v10, @@ -1396,7 +1682,7 @@ return { "args": null, "concreteType": "PullRequestCommitConnection", "plural": false, - "selections": v29 + "selections": v31 }, { "kind": "LinkedField", @@ -1540,7 +1826,7 @@ return { "concreteType": "PullRequestTimelineConnection", "plural": false, "selections": [ - v18, + v20, { "kind": "LinkedField", "alias": null, @@ -1550,7 +1836,7 @@ return { "concreteType": "PullRequestTimelineItemEdge", "plural": true, "selections": [ - v19, + v21, { "kind": "LinkedField", "alias": null, @@ -1562,25 +1848,18 @@ return { "selections": [ v4, v2, - v22, + v24, { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v33, + v42, { "kind": "LinkedField", "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": [ - { - "kind": "Literal", - "name": "first", - "value": 100, - "type": "Int" - } - ], + "args": v34, "concreteType": "CommitCommentConnection", "plural": false, "selections": [ @@ -1611,25 +1890,13 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v21 + "selections": v23 }, - v33, + v42, v12, - v24, - { - "kind": "ScalarField", - "alias": null, - "name": "path", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "position", - "args": null, - "storageKey": null - } + v26, + v40, + v41 ] } ] @@ -1642,7 +1909,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v34, + v43, { "kind": "LinkedField", "alias": null, @@ -1651,7 +1918,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v32 + "selections": v37 }, { "kind": "LinkedField", @@ -1661,17 +1928,17 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v32 + "selections": v37 }, - v24 + v26 ] }, { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ - v34, - v33, + v43, + v42, { "kind": "ScalarField", "alias": null, @@ -1679,11 +1946,11 @@ return { "args": null, "storageKey": null }, - v24 + v26 ] }, - v25, - v28 + v27, + v30 ] } ] @@ -1699,7 +1966,7 @@ return { "key": "prTimelineContainer_timeline", "filters": null }, - v30 + v32 ] } ] diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index eb62f5be7c..ac451dad1e 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 690cc435f3a8f5738ba609aa81c359b4 + * @relayHash 3a8852bc38dab1b82916974271e7eec4 */ /* eslint-disable */ @@ -77,6 +77,82 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { comments { totalCount } + reviews(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + body + commitId: commit { + oid + id + } + state + submittedAt + login: author { + __typename + login + ... on Node { + id + } + } + author { + __typename + avatarUrl + ... on Node { + id + } + } + comments(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + pullRequestId: pullRequest { + number + id + } + databaseId + login: author { + __typename + login + ... on Node { + id + } + } + author { + __typename + avatarUrl + ... on Node { + id + } + } + body + path + commitSha: commit { + oid + id + } + diffHunk + position + originalPosition + originalCommitId: originalCommit { + oid + id + } + replyTo { + id + } + createdAt + url + } + } + } + } ...prCommitsView_pullRequest_38TpXw countedCommits: commits { totalCount @@ -537,7 +613,7 @@ v10 = { v11 = { "kind": "ScalarField", "alias": null, - "name": "number", + "name": "state", "args": null, "storageKey": null }, @@ -557,14 +633,125 @@ v13 = [ "storageKey": null } ], -v14 = { +v14 = [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } +], +v15 = { + "kind": "ScalarField", + "alias": null, + "name": "hasNextPage", + "args": null, + "storageKey": null +}, +v16 = { + "kind": "ScalarField", + "alias": null, + "name": "endCursor", + "args": null, + "storageKey": null +}, +v17 = { + "kind": "LinkedField", + "alias": null, + "name": "pageInfo", + "storageKey": null, + "args": null, + "concreteType": "PageInfo", + "plural": false, + "selections": [ + v15, + v16 + ] +}, +v18 = { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null +}, +v19 = [ + { + "kind": "ScalarField", + "alias": null, + "name": "oid", + "args": null, + "storageKey": null + }, + v6 +], +v20 = { + "kind": "LinkedField", + "alias": "login", + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": v9 +}, +v21 = { + "kind": "ScalarField", + "alias": null, + "name": "avatarUrl", + "args": null, + "storageKey": null +}, +v22 = { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v5, + v21, + v6 + ] +}, +v23 = { + "kind": "ScalarField", + "alias": null, + "name": "path", + "args": null, + "storageKey": null +}, +v24 = { + "kind": "ScalarField", + "alias": null, + "name": "number", + "args": null, + "storageKey": null +}, +v25 = { + "kind": "ScalarField", + "alias": null, + "name": "position", + "args": null, + "storageKey": null +}, +v26 = { + "kind": "ScalarField", + "alias": null, + "name": "createdAt", + "args": null, + "storageKey": null +}, +v27 = { "kind": "ScalarField", "alias": null, "name": "url", "args": null, "storageKey": null }, -v15 = [ +v28 = [ { "kind": "Variable", "name": "after", @@ -578,7 +765,7 @@ v15 = [ "type": "Int" } ], -v16 = { +v29 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -587,68 +774,42 @@ v16 = { "concreteType": "PageInfo", "plural": false, "selections": [ - { - "kind": "ScalarField", - "alias": null, - "name": "endCursor", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "hasNextPage", - "args": null, - "storageKey": null - } + v16, + v15 ] }, -v17 = { +v30 = { "kind": "ScalarField", "alias": null, "name": "cursor", "args": null, "storageKey": null }, -v18 = { - "kind": "ScalarField", - "alias": null, - "name": "avatarUrl", - "args": null, - "storageKey": null -}, -v19 = { +v31 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v20 = { - "kind": "ScalarField", - "alias": null, - "name": "state", - "args": null, - "storageKey": null -}, -v21 = { +v32 = { "kind": "ScalarField", "alias": null, "name": "title", "args": null, "storageKey": null }, -v22 = { +v33 = { "kind": "ScalarField", "alias": null, "name": "bodyHTML", "args": null, "storageKey": null }, -v23 = [ - v14 +v34 = [ + v27 ], -v24 = [ +v35 = [ { "kind": "Variable", "name": "after", @@ -662,23 +823,13 @@ v24 = [ "type": "Int" } ], -v25 = [ +v36 = [ v5, v8, - v18, + v21, v6 ], -v26 = [ - { - "kind": "ScalarField", - "alias": null, - "name": "oid", - "args": null, - "storageKey": null - }, - v6 -], -v27 = { +v37 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -686,22 +837,15 @@ v27 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v26 + "selections": v19 }, -v28 = { - "kind": "ScalarField", - "alias": null, - "name": "createdAt", - "args": null, - "storageKey": null -}, -v29 = [ +v38 = [ v5, - v18, + v21, v8, v6 ], -v30 = { +v39 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -709,9 +853,9 @@ v30 = { "args": null, "concreteType": null, "plural": false, - "selections": v29 + "selections": v38 }, -v31 = { +v40 = { "kind": "LinkedField", "alias": null, "name": "user", @@ -729,7 +873,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_1Etigl\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_1Etigl\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n body\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -863,17 +1007,159 @@ return { "plural": false, "selections": v13 }, - v14, + { + "kind": "LinkedField", + "alias": null, + "name": "reviews", + "storageKey": "reviews(first:100)", + "args": v14, + "concreteType": "PullRequestReviewConnection", + "plural": false, + "selections": [ + v17, + { + "kind": "LinkedField", + "alias": null, + "name": "nodes", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReview", + "plural": true, + "selections": [ + v6, + v18, + { + "kind": "LinkedField", + "alias": "commitId", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v19 + }, + v11, + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, + v20, + v22, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": "comments(first:100)", + "args": v14, + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + v17, + { + "kind": "LinkedField", + "alias": null, + "name": "nodes", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": true, + "selections": [ + { + "kind": "LinkedField", + "alias": "commitSha", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v19 + }, + v6, + { + "kind": "ScalarField", + "alias": null, + "name": "databaseId", + "args": null, + "storageKey": null + }, + v20, + v22, + v18, + v23, + { + "kind": "LinkedField", + "alias": "pullRequestId", + "name": "pullRequest", + "storageKey": null, + "args": null, + "concreteType": "PullRequest", + "plural": false, + "selections": [ + v24, + v6 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "diffHunk", + "args": null, + "storageKey": null + }, + v25, + { + "kind": "ScalarField", + "alias": null, + "name": "originalPosition", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "originalCommitId", + "name": "originalCommit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v19 + }, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v6 + ] + }, + v26, + v27 + ] + } + ] + } + ] + } + ] + }, + v27, { "kind": "LinkedField", "alias": null, "name": "commits", "storageKey": null, - "args": v15, + "args": v28, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ - v16, + v29, { "kind": "LinkedField", "alias": null, @@ -883,7 +1169,7 @@ return { "concreteType": "PullRequestCommitEdge", "plural": true, "selections": [ - v17, + v30, { "kind": "LinkedField", "alias": null, @@ -912,7 +1198,7 @@ return { "concreteType": "GitActor", "plural": false, "selections": [ - v18, + v21, v7, { "kind": "ScalarField", @@ -944,8 +1230,8 @@ return { "args": null, "storageKey": null }, - v19, - v14 + v31, + v27 ] }, v6, @@ -960,7 +1246,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v15, + "args": v28, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -1027,7 +1313,7 @@ return { "concreteType": "Status", "plural": false, "selections": [ - v20, + v11, { "kind": "LinkedField", "alias": null, @@ -1038,7 +1324,7 @@ return { "plural": true, "selections": [ v6, - v20, + v11, { "kind": "ScalarField", "alias": null, @@ -1075,9 +1361,9 @@ return { } ] }, - v20, - v21, - v22, + v24, + v32, + v33, { "kind": "ScalarField", "alias": null, @@ -1103,17 +1389,17 @@ return { "selections": [ v5, v8, - v18, + v21, v6, { "kind": "InlineFragment", "type": "Bot", - "selections": v23 + "selections": v34 }, { "kind": "InlineFragment", "type": "User", - "selections": v23 + "selections": v34 } ] }, @@ -1145,11 +1431,11 @@ return { "alias": null, "name": "timeline", "storageKey": null, - "args": v24, + "args": v35, "concreteType": "PullRequestTimelineConnection", "plural": false, "selections": [ - v16, + v29, { "kind": "LinkedField", "alias": null, @@ -1159,7 +1445,7 @@ return { "concreteType": "PullRequestTimelineItemEdge", "plural": true, "selections": [ - v17, + v30, { "kind": "LinkedField", "alias": null, @@ -1191,7 +1477,7 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v25 + "selections": v36 }, { "kind": "LinkedField", @@ -1229,9 +1515,9 @@ return { "kind": "InlineFragment", "type": "PullRequest", "selections": [ - v11, - v21, - v14, + v24, + v32, + v27, { "kind": "ScalarField", "alias": "prState", @@ -1245,9 +1531,9 @@ return { "kind": "InlineFragment", "type": "Issue", "selections": [ - v11, - v21, - v14, + v24, + v32, + v27, { "kind": "ScalarField", "alias": "issueState", @@ -1265,20 +1551,13 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v27, + v37, { "kind": "LinkedField", "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": [ - { - "kind": "Literal", - "name": "first", - "value": 100, - "type": "Int" - } - ], + "args": v14, "concreteType": "CommitCommentConnection", "plural": false, "selections": [ @@ -1309,25 +1588,13 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v25 + "selections": v36 }, - v27, - v22, - v28, - { - "kind": "ScalarField", - "alias": null, - "name": "path", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "position", - "args": null, - "storageKey": null - } + v37, + v33, + v26, + v23, + v25 ] } ] @@ -1340,7 +1607,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v30, + v39, { "kind": "LinkedField", "alias": null, @@ -1349,7 +1616,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v26 + "selections": v19 }, { "kind": "LinkedField", @@ -1359,17 +1626,17 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v26 + "selections": v19 }, - v28 + v26 ] }, { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ - v30, - v27, + v39, + v37, { "kind": "ScalarField", "alias": null, @@ -1377,7 +1644,7 @@ return { "args": null, "storageKey": null }, - v28 + v26 ] }, { @@ -1392,11 +1659,11 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v29 + "selections": v38 }, - v22, - v28, - v14 + v33, + v26, + v27 ] }, { @@ -1413,8 +1680,8 @@ return { "plural": false, "selections": [ v7, - v31, - v18 + v40, + v21 ] }, { @@ -1427,8 +1694,8 @@ return { "plural": false, "selections": [ v7, - v18, - v31 + v21, + v40 ] }, { @@ -1438,7 +1705,7 @@ return { "args": null, "storageKey": null }, - v19, + v31, { "kind": "ScalarField", "alias": null, @@ -1472,7 +1739,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "timeline", - "args": v24, + "args": v35, "handle": "connection", "key": "prTimelineContainer_timeline", "filters": null diff --git a/lib/views/__generated__/prDetailView_pullRequest.graphql.js b/lib/views/__generated__/prDetailView_pullRequest.graphql.js index b510f50297..28adeb4059 100644 --- a/lib/views/__generated__/prDetailView_pullRequest.graphql.js +++ b/lib/views/__generated__/prDetailView_pullRequest.graphql.js @@ -11,6 +11,7 @@ import type { ConcreteFragment } from 'relay-runtime'; type prCommitsView_pullRequest$ref = any; type prStatusesView_pullRequest$ref = any; type prTimelineController_pullRequest$ref = any; +export type PullRequestReviewState = "APPROVED" | "CHANGES_REQUESTED" | "COMMENTED" | "DISMISSED" | "PENDING" | "%future added value"; export type PullRequestState = "CLOSED" | "MERGED" | "OPEN" | "%future added value"; export type ReactionContent = "CONFUSED" | "HEART" | "HOORAY" | "LAUGH" | "THUMBS_DOWN" | "THUMBS_UP" | "%future added value"; import type { FragmentReference } from "relay-runtime"; @@ -22,6 +23,62 @@ export type prDetailView_pullRequest = {| +comments: {| +totalCount: number |}, + +reviews: ?{| + +pageInfo: {| + +hasNextPage: boolean, + +endCursor: ?string, + |}, + +nodes: ?$ReadOnlyArray, + |}, + |}>, + |}, +countedCommits: {| +totalCount: number |}, @@ -51,7 +108,14 @@ export type prDetailView_pullRequest = {| const node/*: ConcreteFragment*/ = (function(){ -var v0 = [ +var v0 = { + "kind": "ScalarField", + "alias": null, + "name": "state", + "args": null, + "storageKey": null +}, +v1 = [ { "kind": "ScalarField", "alias": null, @@ -60,15 +124,116 @@ var v0 = [ "storageKey": null } ], -v1 = { +v2 = [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } +], +v3 = { + "kind": "LinkedField", + "alias": null, + "name": "pageInfo", + "storageKey": null, + "args": null, + "concreteType": "PageInfo", + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "hasNextPage", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "endCursor", + "args": null, + "storageKey": null + } + ] +}, +v4 = { + "kind": "ScalarField", + "alias": null, + "name": "id", + "args": null, + "storageKey": null +}, +v5 = { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null +}, +v6 = [ + { + "kind": "ScalarField", + "alias": null, + "name": "oid", + "args": null, + "storageKey": null + } +], +v7 = { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null +}, +v8 = { + "kind": "LinkedField", + "alias": "login", + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v7 + ] +}, +v9 = { + "kind": "ScalarField", + "alias": null, + "name": "avatarUrl", + "args": null, + "storageKey": null +}, +v10 = { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v9 + ] +}, +v11 = { + "kind": "ScalarField", + "alias": null, + "name": "number", + "args": null, + "storageKey": null +}, +v12 = { "kind": "ScalarField", "alias": null, "name": "url", "args": null, "storageKey": null }, -v2 = [ - v1 +v13 = [ + v12 ]; return { "kind": "Fragment", @@ -114,13 +279,7 @@ return { } ], "selections": [ - { - "kind": "ScalarField", - "alias": null, - "name": "number", - "args": null, - "storageKey": null - }, + v0, { "kind": "ScalarField", "alias": null, @@ -150,7 +309,166 @@ return { "args": null, "concreteType": "IssueCommentConnection", "plural": false, - "selections": v0 + "selections": v1 + }, + { + "kind": "LinkedField", + "alias": null, + "name": "reviews", + "storageKey": "reviews(first:100)", + "args": v2, + "concreteType": "PullRequestReviewConnection", + "plural": false, + "selections": [ + v3, + { + "kind": "LinkedField", + "alias": null, + "name": "nodes", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReview", + "plural": true, + "selections": [ + v4, + v5, + { + "kind": "LinkedField", + "alias": "commitId", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v6 + }, + v0, + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, + v8, + v10, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": "comments(first:100)", + "args": v2, + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + v3, + { + "kind": "LinkedField", + "alias": null, + "name": "nodes", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": true, + "selections": [ + { + "kind": "LinkedField", + "alias": "commitSha", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v6 + }, + v4, + { + "kind": "ScalarField", + "alias": null, + "name": "databaseId", + "args": null, + "storageKey": null + }, + v8, + v10, + v5, + { + "kind": "ScalarField", + "alias": null, + "name": "path", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "pullRequestId", + "name": "pullRequest", + "storageKey": null, + "args": null, + "concreteType": "PullRequest", + "plural": false, + "selections": [ + v11 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "diffHunk", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "position", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "originalPosition", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "originalCommitId", + "name": "originalCommit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v6 + }, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v4 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "createdAt", + "args": null, + "storageKey": null + }, + v12 + ] + } + ] + } + ] + } + ] }, { "kind": "FragmentSpread", @@ -178,27 +496,15 @@ return { "args": null, "concreteType": "PullRequestCommitConnection", "plural": false, - "selections": v0 + "selections": v1 }, { "kind": "FragmentSpread", "name": "prStatusesView_pullRequest", "args": null }, - { - "kind": "ScalarField", - "alias": null, - "name": "state", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "id", - "args": null, - "storageKey": null - }, + v4, + v11, { "kind": "ScalarField", "alias": null, @@ -236,29 +542,17 @@ return { "concreteType": null, "plural": false, "selections": [ - { - "kind": "ScalarField", - "alias": null, - "name": "login", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "avatarUrl", - "args": null, - "storageKey": null - }, + v7, + v9, { "kind": "InlineFragment", "type": "Bot", - "selections": v2 + "selections": v13 }, { "kind": "InlineFragment", "type": "User", - "selections": v2 + "selections": v13 } ] }, @@ -280,7 +574,7 @@ return { } ] }, - v1, + v12, { "kind": "LinkedField", "alias": null, @@ -305,7 +599,7 @@ return { "args": null, "concreteType": "ReactingUserConnection", "plural": false, - "selections": v0 + "selections": v1 } ] } @@ -313,5 +607,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'a1d134e400b0baa7d6a558165f406bb2'; +(node/*: any*/).hash = '6b79c21bb0d8e16f2d4c094d0fd055c8'; module.exports = node; diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index 22d9f6e8a8..63762085c3 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -218,6 +218,7 @@ export class BarePullRequestDetailView extends React.Component { render() { const repo = this.props.repository; const pullRequest = this.props.pullRequest; + console.log(pullRequest); return (
@@ -388,6 +389,62 @@ export default createRefetchContainer(BarePullRequestDetailView, { comments { totalCount } + reviews(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + body + commitId: commit { + oid + } + state + submittedAt + login: author { + login + } + author { + avatarUrl + } + comments(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + pullRequestId: pullRequest { + number + } + databaseId + login: author { + login + } + author { + avatarUrl + } + body + path + commitSha: commit { + oid + } + diffHunk + position + originalPosition + originalCommitId: originalCommit { + oid + } + replyTo { + id + } + createdAt + url + } + } + } + } ...prCommitsView_pullRequest @arguments(commitCount: $commitCount, commitCursor: $commitCursor) countedCommits: commits { totalCount From a5ea73a6513524c8fa9d659f992259479ec635c3 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 19 Dec 2018 12:51:01 -0800 Subject: [PATCH 003/120] render some comments, woo Co-Authored-By: Vanessa Yuen --- lib/views/multi-file-patch-view.js | 94 ++++++++++++++++++------------ lib/views/pr-detail-view.js | 2 +- 2 files changed, 57 insertions(+), 39 deletions(-) diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index b8d46976f8..96e57447e4 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -179,12 +179,28 @@ export default class MultiFilePatchView extends React.Component { {this.renderCommands()}
+ {this.renderComments()} {this.props.multiFilePatch.anyPresent() ? this.renderNonEmptyPatch() : this.renderEmptyPatch()}
); } + renderComments() { + if (this.props.reviews) { + return this.props.reviews.nodes.map(review => { + return review.comments.nodes.map(comment => { + return ( +
+ + {comment.body} +
+ ); + }); + }); + } + } + renderCommands() { if (this.props.itemType === CommitDetailItem || this.props.itemType === IssueishDetailItem) { return ( @@ -235,49 +251,50 @@ export default class MultiFilePatchView extends React.Component { renderNonEmptyPatch() { return ( - - - - - {this.props.config.get('github.showDiffIconGutter') && ( + + + + + {this.props.config.get('github.showDiffIconGutter') && ( + )} {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} @@ -305,6 +322,7 @@ export default class MultiFilePatchView extends React.Component { )} + ); } diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index 63762085c3..80d3979fc1 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -209,6 +209,7 @@ export class BarePullRequestDetailView extends React.Component { destroy={this.props.destroy} shouldRefetch={this.state.refreshing} + reviews={this.props.pullRequest.reviews} /> @@ -218,7 +219,6 @@ export class BarePullRequestDetailView extends React.Component { render() { const repo = this.props.repository; const pullRequest = this.props.pullRequest; - console.log(pullRequest); return (
From 346b2dce071f4a4d4a4f5f100806a022cfee69de Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 19 Dec 2018 12:55:13 -0800 Subject: [PATCH 004/120] maybe my avatar does not need to be the giantest. Co-Authored-By: Vanessa Yuen --- lib/views/multi-file-patch-view.js | 2 +- styles/file-patch-view.less | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 96e57447e4..6e975eafd5 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -192,7 +192,7 @@ export default class MultiFilePatchView extends React.Component { return review.comments.nodes.map(comment => { return (
- + {comment.body}
); diff --git a/styles/file-patch-view.less b/styles/file-patch-view.less index 62ba2b660b..208628f173 100644 --- a/styles/file-patch-view.less +++ b/styles/file-patch-view.less @@ -142,6 +142,11 @@ } } + &-commentAuthorAvatar { + height: 16px; + width: 16px; + } + &-metaDetails { padding: @component-padding; } From 8b8f11206aa74b1222c7696c0db877f0a50b97a0 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 19 Dec 2018 13:21:04 -0800 Subject: [PATCH 005/120] :fire: unnecessary fragment --- lib/views/multi-file-patch-view.js | 132 ++++++++++++++--------------- 1 file changed, 65 insertions(+), 67 deletions(-) diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 6e975eafd5..60225d84a1 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -251,78 +251,76 @@ export default class MultiFilePatchView extends React.Component { renderNonEmptyPatch() { return ( - - - + + + + + {this.props.config.get('github.showDiffIconGutter') && ( - - {this.props.config.get('github.showDiffIconGutter') && ( - - )} - - {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} - - {this.renderLineDecorations( - Array.from(this.props.selectedRows, row => Range.fromObject([[row, 0], [row, Infinity]])), - 'github-FilePatchView-line--selected', - {gutter: true, icon: true, line: true}, - )} - - {this.renderDecorationsOnLayer( - this.props.multiFilePatch.getAdditionLayer(), - 'github-FilePatchView-line--added', - {icon: true, line: true}, - )} - {this.renderDecorationsOnLayer( - this.props.multiFilePatch.getDeletionLayer(), - 'github-FilePatchView-line--deleted', - {icon: true, line: true}, - )} - {this.renderDecorationsOnLayer( - this.props.multiFilePatch.getNoNewlineLayer(), - 'github-FilePatchView-line--nonewline', - {icon: true, line: true}, - )} - - - + )} + + {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} + + {this.renderLineDecorations( + Array.from(this.props.selectedRows, row => Range.fromObject([[row, 0], [row, Infinity]])), + 'github-FilePatchView-line--selected', + {gutter: true, icon: true, line: true}, + )} + + {this.renderDecorationsOnLayer( + this.props.multiFilePatch.getAdditionLayer(), + 'github-FilePatchView-line--added', + {icon: true, line: true}, + )} + {this.renderDecorationsOnLayer( + this.props.multiFilePatch.getDeletionLayer(), + 'github-FilePatchView-line--deleted', + {icon: true, line: true}, + )} + {this.renderDecorationsOnLayer( + this.props.multiFilePatch.getNoNewlineLayer(), + 'github-FilePatchView-line--nonewline', + {icon: true, line: true}, + )} + + ); } From 442033dc0875a208516861161c7094ac884a04fe Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 19 Dec 2018 14:10:26 -0800 Subject: [PATCH 006/120] fix borked indentation --- lib/views/multi-file-patch-view.js | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 60225d84a1..a558509609 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -294,33 +294,33 @@ export default class MultiFilePatchView extends React.Component { onMouseDown={this.didMouseDownOnLineNumber} onMouseMove={this.didMouseMoveOnLineNumber} /> - )} - - {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} - - {this.renderLineDecorations( - Array.from(this.props.selectedRows, row => Range.fromObject([[row, 0], [row, Infinity]])), - 'github-FilePatchView-line--selected', - {gutter: true, icon: true, line: true}, - )} - - {this.renderDecorationsOnLayer( - this.props.multiFilePatch.getAdditionLayer(), - 'github-FilePatchView-line--added', - {icon: true, line: true}, - )} - {this.renderDecorationsOnLayer( - this.props.multiFilePatch.getDeletionLayer(), - 'github-FilePatchView-line--deleted', - {icon: true, line: true}, - )} - {this.renderDecorationsOnLayer( - this.props.multiFilePatch.getNoNewlineLayer(), - 'github-FilePatchView-line--nonewline', - {icon: true, line: true}, - )} - - + )} + + {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} + + {this.renderLineDecorations( + Array.from(this.props.selectedRows, row => Range.fromObject([[row, 0], [row, Infinity]])), + 'github-FilePatchView-line--selected', + {gutter: true, icon: true, line: true}, + )} + + {this.renderDecorationsOnLayer( + this.props.multiFilePatch.getAdditionLayer(), + 'github-FilePatchView-line--added', + {icon: true, line: true}, + )} + {this.renderDecorationsOnLayer( + this.props.multiFilePatch.getDeletionLayer(), + 'github-FilePatchView-line--deleted', + {icon: true, line: true}, + )} + {this.renderDecorationsOnLayer( + this.props.multiFilePatch.getNoNewlineLayer(), + 'github-FilePatchView-line--nonewline', + {icon: true, line: true}, + )} + + ); } From 1b1a7fc1466f89330aa4e4c108b5fa0d58fceac4 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Thu, 20 Dec 2018 18:37:05 +0100 Subject: [PATCH 007/120] get the comments to render as a decoration block --- lib/views/multi-file-patch-view.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index a558509609..74d02795de 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -179,7 +179,6 @@ export default class MultiFilePatchView extends React.Component { {this.renderCommands()}
- {this.renderComments()} {this.props.multiFilePatch.anyPresent() ? this.renderNonEmptyPatch() : this.renderEmptyPatch()}
@@ -190,12 +189,21 @@ export default class MultiFilePatchView extends React.Component { if (this.props.reviews) { return this.props.reviews.nodes.map(review => { return review.comments.nodes.map(comment => { - return ( -
- - {comment.body} -
- ); + if (comment.position !== null) { + console.log(comment); + const range = new Range([comment.position, 0], [comment.position, 0]) + return ( + + +
+ + {comment.body} +
+
+
+ ); + } + return null; }); }); } @@ -296,6 +304,7 @@ export default class MultiFilePatchView extends React.Component { /> )} + {this.renderComments()} {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} {this.renderLineDecorations( From d0adf4392cdc70724e6089a54c083a14c6eb50e4 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Thu, 20 Dec 2018 20:18:59 +0100 Subject: [PATCH 008/120] make comments show up at the (somewhat) correct location Co-Authored-By: Tilde Ann Thurium --- lib/models/patch/multi-file-patch.js | 4 ++++ lib/views/multi-file-patch-view.js | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/models/patch/multi-file-patch.js b/lib/models/patch/multi-file-patch.js index c329d66ff4..7336ca1381 100644 --- a/lib/models/patch/multi-file-patch.js +++ b/lib/models/patch/multi-file-patch.js @@ -71,6 +71,10 @@ export default class MultiFilePatch { return this.filePatches; } + getFilePatchByPath(path) { + return this.filePatches.find(filePatch => filePatch.getPath() === path); + } + getPathSet() { return this.getFilePatches().reduce((pathSet, filePatch) => { for (const file of [filePatch.getOldFile(), filePatch.getNewFile()]) { diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 985627c04c..ba7fe37b6d 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -1,7 +1,7 @@ import React, {Fragment} from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; -import {Range} from 'atom'; +import {Point, Range} from 'atom'; import {CompositeDisposable} from 'event-kit'; import {autobind} from '../helpers'; @@ -186,12 +186,17 @@ export default class MultiFilePatchView extends React.Component { } renderComments() { + // 1. need to figure out which file patch the comment belongs to + // 2. how many hunks since beginning of file till comment + // 3. filePatch.beginRange + number of hunks + comment.position + if (this.props.reviews) { return this.props.reviews.nodes.map(review => { return review.comments.nodes.map(comment => { if (comment.position !== null) { - console.log(comment); - const range = new Range([comment.position, 0], [comment.position, 0]) + const filePatch = this.props.multiFilePatch.getFilePatchByPath(comment.path); + const commentStartPoint = filePatch.getStartRange().start.translate(new Point(comment.position, 0)); + const range = new Range(commentStartPoint, commentStartPoint); return ( From 5f4f5137bb97e70952b66f0e0742b5a0cea8bf71 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Thu, 20 Dec 2018 20:58:40 +0100 Subject: [PATCH 009/120] put in comment position also Co-Authored-By: Tilde Ann Thurium --- lib/views/multi-file-patch-view.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index ba7fe37b6d..0b7282dda1 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -203,6 +203,7 @@ export default class MultiFilePatchView extends React.Component {
{comment.body} + {comment.position}
From b341c5dd9c1cca132a260a28fd5bce55abc541ac Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 20 Dec 2018 17:24:21 -0800 Subject: [PATCH 010/120] make `PullRequestCommentsView` into its own component. --- lib/views/multi-file-patch-view.js | 35 +++------------------------ lib/views/pr-comments-view.js | 38 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 32 deletions(-) create mode 100644 lib/views/pr-comments-view.js diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 0b7282dda1..2eaa0b89e8 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -1,7 +1,7 @@ import React, {Fragment} from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; -import {Point, Range} from 'atom'; +import {Range} from 'atom'; import {CompositeDisposable} from 'event-kit'; import {autobind} from '../helpers'; @@ -15,6 +15,7 @@ import Commands, {Command} from '../atom/commands'; import FilePatchHeaderView from './file-patch-header-view'; import FilePatchMetaView from './file-patch-meta-view'; import HunkHeaderView from './hunk-header-view'; +import PullRequestCommentsView from './pr-comments-view'; import RefHolder from '../models/ref-holder'; import ChangedFileItem from '../items/changed-file-item'; import CommitDetailItem from '../items/commit-detail-item'; @@ -185,36 +186,6 @@ export default class MultiFilePatchView extends React.Component { ); } - renderComments() { - // 1. need to figure out which file patch the comment belongs to - // 2. how many hunks since beginning of file till comment - // 3. filePatch.beginRange + number of hunks + comment.position - - if (this.props.reviews) { - return this.props.reviews.nodes.map(review => { - return review.comments.nodes.map(comment => { - if (comment.position !== null) { - const filePatch = this.props.multiFilePatch.getFilePatchByPath(comment.path); - const commentStartPoint = filePatch.getStartRange().start.translate(new Point(comment.position, 0)); - const range = new Range(commentStartPoint, commentStartPoint); - return ( - - -
- - {comment.body} - {comment.position} -
-
-
- ); - } - return null; - }); - }); - } - } - renderCommands() { if (this.props.itemType === CommitDetailItem || this.props.itemType === IssueishDetailItem) { return ( @@ -310,7 +281,7 @@ export default class MultiFilePatchView extends React.Component { /> )} - {this.renderComments()} + {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} {this.renderLineDecorations( diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js new file mode 100644 index 0000000000..aab51871f8 --- /dev/null +++ b/lib/views/pr-comments-view.js @@ -0,0 +1,38 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {Point, Range} from 'atom'; + +import Marker from '../atom/marker'; +import MarkerLayer from '../atom/marker-layer'; +import Decoration from '../atom/decoration'; + +import Timeago from './timeago'; + +export default class PullRequestCommentsView extends React.Component { + + render() { + + if (this.props.reviews) { + return this.props.reviews.nodes.map(review => { + return review.comments.nodes.map(comment => { + if (comment.position !== null) { + const filePatch = this.props.multiFilePatch.getFilePatchByPath(comment.path); + const commentStartPoint = filePatch.getStartRange().start.translate(new Point(comment.position, 0)); + const range = new Range(commentStartPoint, commentStartPoint); + return ( + + +
+ + {comment.body} +
+
+
+ ); + } + return null; + }); + }); + } + } +} From 847829c4f5aacc372c7e479ce7c7de9b30fee9b4 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 20 Dec 2018 17:44:04 -0800 Subject: [PATCH 011/120] render comment timestamp --- .../issueishDetailContainerQuery.graphql.js | 147 +++++++-------- .../prDetailViewRefetchQuery.graphql.js | 169 +++++++++--------- .../prDetailView_pullRequest.graphql.js | 62 ++++--- lib/views/pr-comments-view.js | 8 +- lib/views/pr-detail-view.js | 1 + 5 files changed, 203 insertions(+), 184 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 235deacd1c..1a24ef5d10 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash ac44654a5df27b896a882aa457ebf399 + * @relayHash 46254fc27ddba523ae7fba989c5e320a */ /* eslint-disable */ @@ -211,6 +211,7 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { author { __typename avatarUrl + login ... on Node { id } @@ -944,32 +945,33 @@ v25 = [ v2 ], v26 = { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": v25 +}, +v27 = { "kind": "ScalarField", "alias": null, "name": "createdAt", "args": null, "storageKey": null }, -v27 = { +v28 = { "kind": "InlineFragment", "type": "IssueComment", "selections": [ - { - "kind": "LinkedField", - "alias": null, - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": v25 - }, - v12, v26, + v12, + v27, v14 ] }, -v28 = { +v29 = { "kind": "LinkedField", "alias": null, "name": "user", @@ -982,14 +984,14 @@ v28 = { v2 ] }, -v29 = { +v30 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v30 = { +v31 = { "kind": "InlineFragment", "type": "Commit", "selections": [ @@ -1003,7 +1005,7 @@ v30 = { "plural": false, "selections": [ v3, - v28, + v29, v13 ] }, @@ -1018,7 +1020,7 @@ v30 = { "selections": [ v3, v13, - v28 + v29 ] }, { @@ -1028,7 +1030,7 @@ v30 = { "args": null, "storageKey": null }, - v29, + v30, { "kind": "ScalarField", "alias": null, @@ -1052,7 +1054,7 @@ v30 = { } ] }, -v31 = [ +v32 = [ { "kind": "ScalarField", "alias": null, @@ -1061,7 +1063,7 @@ v31 = [ "storageKey": null } ], -v32 = { +v33 = { "kind": "LinkedField", "alias": null, "name": "reactionGroups", @@ -1085,11 +1087,11 @@ v32 = { "args": null, "concreteType": "ReactingUserConnection", "plural": false, - "selections": v31 + "selections": v32 } ] }, -v33 = [ +v34 = [ { "kind": "Variable", "name": "after", @@ -1103,7 +1105,7 @@ v33 = [ "type": "Int" } ], -v34 = [ +v35 = [ { "kind": "Literal", "name": "first", @@ -1111,7 +1113,7 @@ v34 = [ "type": "Int" } ], -v35 = { +v36 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -1124,14 +1126,14 @@ v35 = { v18 ] }, -v36 = { +v37 = { "kind": "ScalarField", "alias": null, "name": "body", "args": null, "storageKey": null }, -v37 = [ +v38 = [ { "kind": "ScalarField", "alias": null, @@ -1141,7 +1143,7 @@ v37 = [ }, v2 ], -v38 = { +v39 = { "kind": "LinkedField", "alias": "login", "name": "author", @@ -1151,20 +1153,6 @@ v38 = { "plural": false, "selections": v6 }, -v39 = { - "kind": "LinkedField", - "alias": null, - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": [ - v4, - v13, - v2 - ] -}, v40 = { "kind": "ScalarField", "alias": null, @@ -1187,7 +1175,7 @@ v42 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, v43 = { "kind": "LinkedField", @@ -1204,7 +1192,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_2LgaQ1\n id\n }\n}\n\nfragment issueishDetailController_repository_2LgaQ1 on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n body\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_2LgaQ1\n id\n }\n}\n\nfragment issueishDetailController_repository_2LgaQ1 on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1344,8 +1332,8 @@ return { v4, v2, v24, - v27, - v30 + v28, + v31 ] } ] @@ -1361,7 +1349,7 @@ return { "key": "IssueTimelineController_timeline", "filters": null }, - v32 + v33 ] } ] @@ -1386,7 +1374,7 @@ return { "alias": null, "name": "commits", "storageKey": null, - "args": v33, + "args": v34, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ @@ -1461,7 +1449,7 @@ return { "args": null, "storageKey": null }, - v29, + v30, v14 ] }, @@ -1477,7 +1465,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v33, + "args": v34, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -1528,18 +1516,18 @@ return { "args": null, "concreteType": "IssueCommentConnection", "plural": false, - "selections": v31 + "selections": v32 }, { "kind": "LinkedField", "alias": null, "name": "reviews", "storageKey": "reviews(first:100)", - "args": v34, + "args": v35, "concreteType": "PullRequestReviewConnection", "plural": false, "selections": [ - v35, + v36, { "kind": "LinkedField", "alias": null, @@ -1550,7 +1538,7 @@ return { "plural": true, "selections": [ v2, - v36, + v37, { "kind": "LinkedField", "alias": "commitId", @@ -1559,7 +1547,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, v11, { @@ -1569,18 +1557,31 @@ return { "args": null, "storageKey": null }, - v38, v39, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v4, + v13, + v2 + ] + }, { "kind": "LinkedField", "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v34, + "args": v35, "concreteType": "PullRequestReviewCommentConnection", "plural": false, "selections": [ - v35, + v36, { "kind": "LinkedField", "alias": null, @@ -1598,7 +1599,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, v2, { @@ -1608,9 +1609,9 @@ return { "args": null, "storageKey": null }, - v38, v39, - v36, + v26, + v37, v40, { "kind": "LinkedField", @@ -1648,7 +1649,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, { "kind": "LinkedField", @@ -1662,7 +1663,7 @@ return { v2 ] }, - v26, + v27, v14 ] } @@ -1682,7 +1683,7 @@ return { "args": null, "concreteType": "PullRequestCommitConnection", "plural": false, - "selections": v31 + "selections": v32 }, { "kind": "LinkedField", @@ -1859,7 +1860,7 @@ return { "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v34, + "args": v35, "concreteType": "CommitCommentConnection", "plural": false, "selections": [ @@ -1894,7 +1895,7 @@ return { }, v42, v12, - v26, + v27, v40, v41 ] @@ -1918,7 +1919,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, { "kind": "LinkedField", @@ -1928,9 +1929,9 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, - v26 + v27 ] }, { @@ -1946,11 +1947,11 @@ return { "args": null, "storageKey": null }, - v26 + v27 ] }, - v27, - v30 + v28, + v31 ] } ] @@ -1966,7 +1967,7 @@ return { "key": "prTimelineContainer_timeline", "filters": null }, - v32 + v33 ] } ] diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index ac451dad1e..da5b973fc9 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 3a8852bc38dab1b82916974271e7eec4 + * @relayHash 7c4ab71fc777de210cae63ab5e4481cc */ /* eslint-disable */ @@ -127,6 +127,7 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { author { __typename avatarUrl + login ... on Node { id } @@ -702,7 +703,13 @@ v21 = { "args": null, "storageKey": null }, -v22 = { +v22 = [ + v5, + v21, + v8, + v6 +], +v23 = { "kind": "LinkedField", "alias": null, "name": "author", @@ -710,48 +717,44 @@ v22 = { "args": null, "concreteType": null, "plural": false, - "selections": [ - v5, - v21, - v6 - ] + "selections": v22 }, -v23 = { +v24 = { "kind": "ScalarField", "alias": null, "name": "path", "args": null, "storageKey": null }, -v24 = { +v25 = { "kind": "ScalarField", "alias": null, "name": "number", "args": null, "storageKey": null }, -v25 = { +v26 = { "kind": "ScalarField", "alias": null, "name": "position", "args": null, "storageKey": null }, -v26 = { +v27 = { "kind": "ScalarField", "alias": null, "name": "createdAt", "args": null, "storageKey": null }, -v27 = { +v28 = { "kind": "ScalarField", "alias": null, "name": "url", "args": null, "storageKey": null }, -v28 = [ +v29 = [ { "kind": "Variable", "name": "after", @@ -765,7 +768,7 @@ v28 = [ "type": "Int" } ], -v29 = { +v30 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -778,38 +781,38 @@ v29 = { v15 ] }, -v30 = { +v31 = { "kind": "ScalarField", "alias": null, "name": "cursor", "args": null, "storageKey": null }, -v31 = { +v32 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v32 = { +v33 = { "kind": "ScalarField", "alias": null, "name": "title", "args": null, "storageKey": null }, -v33 = { +v34 = { "kind": "ScalarField", "alias": null, "name": "bodyHTML", "args": null, "storageKey": null }, -v34 = [ - v27 -], v35 = [ + v28 +], +v36 = [ { "kind": "Variable", "name": "after", @@ -823,13 +826,13 @@ v35 = [ "type": "Int" } ], -v36 = [ +v37 = [ v5, v8, v21, v6 ], -v37 = { +v38 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -839,12 +842,6 @@ v37 = { "plural": false, "selections": v19 }, -v38 = [ - v5, - v21, - v8, - v6 -], v39 = { "kind": "LinkedField", "alias": null, @@ -853,7 +850,7 @@ v39 = { "args": null, "concreteType": null, "plural": false, - "selections": v38 + "selections": v22 }, v40 = { "kind": "LinkedField", @@ -873,7 +870,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_1Etigl\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n body\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_1Etigl\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1047,7 +1044,20 @@ return { "storageKey": null }, v20, - v22, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v5, + v21, + v6 + ] + }, { "kind": "LinkedField", "alias": null, @@ -1086,9 +1096,9 @@ return { "storageKey": null }, v20, - v22, - v18, v23, + v18, + v24, { "kind": "LinkedField", "alias": "pullRequestId", @@ -1098,7 +1108,7 @@ return { "concreteType": "PullRequest", "plural": false, "selections": [ - v24, + v25, v6 ] }, @@ -1109,7 +1119,7 @@ return { "args": null, "storageKey": null }, - v25, + v26, { "kind": "ScalarField", "alias": null, @@ -1139,8 +1149,8 @@ return { v6 ] }, - v26, - v27 + v27, + v28 ] } ] @@ -1149,17 +1159,17 @@ return { } ] }, - v27, + v28, { "kind": "LinkedField", "alias": null, "name": "commits", "storageKey": null, - "args": v28, + "args": v29, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ - v29, + v30, { "kind": "LinkedField", "alias": null, @@ -1169,7 +1179,7 @@ return { "concreteType": "PullRequestCommitEdge", "plural": true, "selections": [ - v30, + v31, { "kind": "LinkedField", "alias": null, @@ -1230,8 +1240,8 @@ return { "args": null, "storageKey": null }, - v31, - v27 + v32, + v28 ] }, v6, @@ -1246,7 +1256,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v28, + "args": v29, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -1361,9 +1371,9 @@ return { } ] }, - v24, - v32, + v25, v33, + v34, { "kind": "ScalarField", "alias": null, @@ -1394,12 +1404,12 @@ return { { "kind": "InlineFragment", "type": "Bot", - "selections": v34 + "selections": v35 }, { "kind": "InlineFragment", "type": "User", - "selections": v34 + "selections": v35 } ] }, @@ -1431,11 +1441,11 @@ return { "alias": null, "name": "timeline", "storageKey": null, - "args": v35, + "args": v36, "concreteType": "PullRequestTimelineConnection", "plural": false, "selections": [ - v29, + v30, { "kind": "LinkedField", "alias": null, @@ -1445,7 +1455,7 @@ return { "concreteType": "PullRequestTimelineItemEdge", "plural": true, "selections": [ - v30, + v31, { "kind": "LinkedField", "alias": null, @@ -1477,7 +1487,7 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v36 + "selections": v37 }, { "kind": "LinkedField", @@ -1515,9 +1525,9 @@ return { "kind": "InlineFragment", "type": "PullRequest", "selections": [ - v24, - v32, - v27, + v25, + v33, + v28, { "kind": "ScalarField", "alias": "prState", @@ -1531,9 +1541,9 @@ return { "kind": "InlineFragment", "type": "Issue", "selections": [ - v24, - v32, - v27, + v25, + v33, + v28, { "kind": "ScalarField", "alias": "issueState", @@ -1551,7 +1561,7 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v37, + v38, { "kind": "LinkedField", "alias": null, @@ -1588,13 +1598,13 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v36 + "selections": v37 }, - v37, - v33, - v26, - v23, - v25 + v38, + v34, + v27, + v24, + v26 ] } ] @@ -1628,7 +1638,7 @@ return { "plural": false, "selections": v19 }, - v26 + v27 ] }, { @@ -1636,7 +1646,7 @@ return { "type": "MergedEvent", "selections": [ v39, - v37, + v38, { "kind": "ScalarField", "alias": null, @@ -1644,26 +1654,17 @@ return { "args": null, "storageKey": null }, - v26 + v27 ] }, { "kind": "InlineFragment", "type": "IssueComment", "selections": [ - { - "kind": "LinkedField", - "alias": null, - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": v38 - }, - v33, - v26, - v27 + v23, + v34, + v27, + v28 ] }, { @@ -1705,7 +1706,7 @@ return { "args": null, "storageKey": null }, - v31, + v32, { "kind": "ScalarField", "alias": null, @@ -1739,7 +1740,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "timeline", - "args": v35, + "args": v36, "handle": "connection", "key": "prTimelineContainer_timeline", "filters": null diff --git a/lib/views/__generated__/prDetailView_pullRequest.graphql.js b/lib/views/__generated__/prDetailView_pullRequest.graphql.js index 28adeb4059..3d3b3a848f 100644 --- a/lib/views/__generated__/prDetailView_pullRequest.graphql.js +++ b/lib/views/__generated__/prDetailView_pullRequest.graphql.js @@ -57,7 +57,8 @@ export type prDetailView_pullRequest = {| +login: string |}, +author: ?{| - +avatarUrl: any + +avatarUrl: any, + +login: string, |}, +body: string, +path: string, @@ -207,33 +208,21 @@ v9 = { "storageKey": null }, v10 = { - "kind": "LinkedField", - "alias": null, - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": [ - v9 - ] -}, -v11 = { "kind": "ScalarField", "alias": null, "name": "number", "args": null, "storageKey": null }, -v12 = { +v11 = { "kind": "ScalarField", "alias": null, "name": "url", "args": null, "storageKey": null }, -v13 = [ - v12 +v12 = [ + v11 ]; return { "kind": "Fragment", @@ -351,7 +340,18 @@ return { "storageKey": null }, v8, - v10, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v9 + ] + }, { "kind": "LinkedField", "alias": null, @@ -390,7 +390,19 @@ return { "storageKey": null }, v8, - v10, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v9, + v7 + ] + }, v5, { "kind": "ScalarField", @@ -408,7 +420,7 @@ return { "concreteType": "PullRequest", "plural": false, "selections": [ - v11 + v10 ] }, { @@ -461,7 +473,7 @@ return { "args": null, "storageKey": null }, - v12 + v11 ] } ] @@ -504,7 +516,7 @@ return { "args": null }, v4, - v11, + v10, { "kind": "ScalarField", "alias": null, @@ -547,12 +559,12 @@ return { { "kind": "InlineFragment", "type": "Bot", - "selections": v13 + "selections": v12 }, { "kind": "InlineFragment", "type": "User", - "selections": v13 + "selections": v12 } ] }, @@ -574,7 +586,7 @@ return { } ] }, - v12, + v11, { "kind": "LinkedField", "alias": null, @@ -607,5 +619,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '6b79c21bb0d8e16f2d4c094d0fd055c8'; +(node/*: any*/).hash = '9feb173b93416270e2ac66924239d1b1'; module.exports = node; diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index aab51871f8..6d9108a544 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -11,7 +11,6 @@ import Timeago from './timeago'; export default class PullRequestCommentsView extends React.Component { render() { - if (this.props.reviews) { return this.props.reviews.nodes.map(review => { return review.comments.nodes.map(comment => { @@ -19,11 +18,16 @@ export default class PullRequestCommentsView extends React.Component { const filePatch = this.props.multiFilePatch.getFilePatchByPath(comment.path); const commentStartPoint = filePatch.getStartRange().start.translate(new Point(comment.position, 0)); const range = new Range(commentStartPoint, commentStartPoint); + const author = comment.author; return (
- +
+ + {author ? author.login : 'someone'} commented + {' '} +
{comment.body}
diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index 80d3979fc1..1314a1029f 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -424,6 +424,7 @@ export default createRefetchContainer(BarePullRequestDetailView, { } author { avatarUrl + login } body path From 1a2ac47f0fea6f75abc6fc097694b09623071be7 Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 21 Dec 2018 20:31:01 +0900 Subject: [PATCH 012/120] Style PrComment --- lib/views/pr-comments-view.js | 20 +++++++++++-------- styles/file-patch-view.less | 5 ----- styles/pr-comment.less | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 styles/pr-comment.less diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index 6d9108a544..d5f87c6108 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -21,14 +21,18 @@ export default class PullRequestCommentsView extends React.Component { const author = comment.author; return ( - -
-
- - {author ? author.login : 'someone'} commented - {' '} -
- {comment.body} + +
+
+ + {author ? author.login : 'someone'} commented{' '} + + + +
+
+ {comment.body} +
diff --git a/styles/file-patch-view.less b/styles/file-patch-view.less index 208628f173..62ba2b660b 100644 --- a/styles/file-patch-view.less +++ b/styles/file-patch-view.less @@ -142,11 +142,6 @@ } } - &-commentAuthorAvatar { - height: 16px; - width: 16px; - } - &-metaDetails { padding: @component-padding; } diff --git a/styles/pr-comment.less b/styles/pr-comment.less new file mode 100644 index 0000000000..7cb0e62654 --- /dev/null +++ b/styles/pr-comment.less @@ -0,0 +1,36 @@ +@import 'variables'; + +@avatar-size: 16px; + +.github-PrComment { + font-family: @font-family; + font-size: @font-size; + + &-wrapper { + max-width: 60em; + padding-right: @component-padding*2; + padding-bottom: @component-padding; + } + + &-header { + padding: @component-padding 0 @component-padding/2 0; + color: @text-color-subtle; + } + + &-avatar { + margin-right: 4px; + height: @avatar-size; + width: @avatar-size; + border-radius: @component-border-radius; + } + + &-timeAgo { + color: inherit; + } + + &-body { + margin-left: @avatar-size + 4px; // avatar + margin + font-size: 1.15em; + } + +} From b7e443d21248b79d97f009f461de2c0e14c8f9f1 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Fri, 21 Dec 2018 13:24:51 +0100 Subject: [PATCH 013/120] comment as its own class --- lib/views/pr-comments-view.js | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index d5f87c6108..04a99e78b6 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -18,22 +18,10 @@ export default class PullRequestCommentsView extends React.Component { const filePatch = this.props.multiFilePatch.getFilePatchByPath(comment.path); const commentStartPoint = filePatch.getStartRange().start.translate(new Point(comment.position, 0)); const range = new Range(commentStartPoint, commentStartPoint); - const author = comment.author; return ( -
-
- - {author ? author.login : 'someone'} commented{' '} - - - -
-
- {comment.body} -
-
+
); @@ -44,3 +32,24 @@ export default class PullRequestCommentsView extends React.Component { } } } + +class PullRequestCommentView extends React.Component { + + render() { + const author = this.props.comment.author; + return ( +
+
+ {author.login} + {author ? author.login : 'someone'} commented{' '} + + + +
+
+ {this.props.comment.body} {this.props.comment.position} +
+
+ ) + } +} From 33f16d2bc2a945562286a238fed15f0d3a8b239c Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 21 Dec 2018 08:53:59 -0500 Subject: [PATCH 014/120] Return `null` from render() when there are no comments --- lib/views/pr-comments-view.js | 45 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index 04a99e78b6..ba3775fead 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -3,44 +3,43 @@ import PropTypes from 'prop-types'; import {Point, Range} from 'atom'; import Marker from '../atom/marker'; -import MarkerLayer from '../atom/marker-layer'; import Decoration from '../atom/decoration'; import Timeago from './timeago'; export default class PullRequestCommentsView extends React.Component { - render() { - if (this.props.reviews) { - return this.props.reviews.nodes.map(review => { - return review.comments.nodes.map(comment => { - if (comment.position !== null) { - const filePatch = this.props.multiFilePatch.getFilePatchByPath(comment.path); - const commentStartPoint = filePatch.getStartRange().start.translate(new Point(comment.position, 0)); - const range = new Range(commentStartPoint, commentStartPoint); - return ( - - - - - - ); - } - return null; - }); - }); + if (!this.props.reviews) { + return null; } + + return this.props.reviews.nodes.map(review => { + return review.comments.nodes.map(comment => { + if (comment.position !== null) { + const filePatch = this.props.multiFilePatch.getFilePatchByPath(comment.path); + const commentStartPoint = filePatch.getStartRange().start.translate(new Point(comment.position, 0)); + const range = new Range(commentStartPoint, commentStartPoint); + return ( + + + + + + ); + } + return null; + }); + }); } } class PullRequestCommentView extends React.Component { - render() { const author = this.props.comment.author; return ( - ) + ); } } From 4efcb0584b043b307cfe57a3c0d649e2c6e3775c Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Fri, 21 Dec 2018 15:26:42 +0100 Subject: [PATCH 015/120] get bodyHTML for comment also --- .../issueishDetailContainerQuery.graphql.js | 6 +- .../prDetailViewRefetchQuery.graphql.js | 100 +++++++++--------- .../prDetailView_pullRequest.graphql.js | 37 ++++--- lib/views/pr-detail-view.js | 1 + 4 files changed, 76 insertions(+), 68 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 1a24ef5d10..55b80a18d2 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 46254fc27ddba523ae7fba989c5e320a + * @relayHash 063056b23fdd8f4f06939894757d5382 */ /* eslint-disable */ @@ -217,6 +217,7 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { } } body + bodyHTML path commitSha: commit { oid @@ -1192,7 +1193,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_2LgaQ1\n id\n }\n}\n\nfragment issueishDetailController_repository_2LgaQ1 on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_2LgaQ1\n id\n }\n}\n\nfragment issueishDetailController_repository_2LgaQ1 on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1612,6 +1613,7 @@ return { v39, v26, v37, + v12, v40, { "kind": "LinkedField", diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index da5b973fc9..34aff4255d 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 7c4ab71fc777de210cae63ab5e4481cc + * @relayHash 83a0f29490df40e31d9f5aee5cdbae2f */ /* eslint-disable */ @@ -133,6 +133,7 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { } } body + bodyHTML path commitSha: commit { oid @@ -722,39 +723,46 @@ v23 = { v24 = { "kind": "ScalarField", "alias": null, - "name": "path", + "name": "bodyHTML", "args": null, "storageKey": null }, v25 = { "kind": "ScalarField", "alias": null, - "name": "number", + "name": "path", "args": null, "storageKey": null }, v26 = { "kind": "ScalarField", "alias": null, - "name": "position", + "name": "number", "args": null, "storageKey": null }, v27 = { "kind": "ScalarField", "alias": null, - "name": "createdAt", + "name": "position", "args": null, "storageKey": null }, v28 = { + "kind": "ScalarField", + "alias": null, + "name": "createdAt", + "args": null, + "storageKey": null +}, +v29 = { "kind": "ScalarField", "alias": null, "name": "url", "args": null, "storageKey": null }, -v29 = [ +v30 = [ { "kind": "Variable", "name": "after", @@ -768,7 +776,7 @@ v29 = [ "type": "Int" } ], -v30 = { +v31 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -781,36 +789,29 @@ v30 = { v15 ] }, -v31 = { +v32 = { "kind": "ScalarField", "alias": null, "name": "cursor", "args": null, "storageKey": null }, -v32 = { +v33 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v33 = { - "kind": "ScalarField", - "alias": null, - "name": "title", - "args": null, - "storageKey": null -}, v34 = { "kind": "ScalarField", "alias": null, - "name": "bodyHTML", + "name": "title", "args": null, "storageKey": null }, v35 = [ - v28 + v29 ], v36 = [ { @@ -870,7 +871,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_1Etigl\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_1Etigl\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1099,6 +1100,7 @@ return { v23, v18, v24, + v25, { "kind": "LinkedField", "alias": "pullRequestId", @@ -1108,7 +1110,7 @@ return { "concreteType": "PullRequest", "plural": false, "selections": [ - v25, + v26, v6 ] }, @@ -1119,7 +1121,7 @@ return { "args": null, "storageKey": null }, - v26, + v27, { "kind": "ScalarField", "alias": null, @@ -1149,8 +1151,8 @@ return { v6 ] }, - v27, - v28 + v28, + v29 ] } ] @@ -1159,17 +1161,17 @@ return { } ] }, - v28, + v29, { "kind": "LinkedField", "alias": null, "name": "commits", "storageKey": null, - "args": v29, + "args": v30, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ - v30, + v31, { "kind": "LinkedField", "alias": null, @@ -1179,7 +1181,7 @@ return { "concreteType": "PullRequestCommitEdge", "plural": true, "selections": [ - v31, + v32, { "kind": "LinkedField", "alias": null, @@ -1240,8 +1242,8 @@ return { "args": null, "storageKey": null }, - v32, - v28 + v33, + v29 ] }, v6, @@ -1256,7 +1258,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v29, + "args": v30, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -1371,9 +1373,9 @@ return { } ] }, - v25, - v33, + v26, v34, + v24, { "kind": "ScalarField", "alias": null, @@ -1445,7 +1447,7 @@ return { "concreteType": "PullRequestTimelineConnection", "plural": false, "selections": [ - v30, + v31, { "kind": "LinkedField", "alias": null, @@ -1455,7 +1457,7 @@ return { "concreteType": "PullRequestTimelineItemEdge", "plural": true, "selections": [ - v31, + v32, { "kind": "LinkedField", "alias": null, @@ -1525,9 +1527,9 @@ return { "kind": "InlineFragment", "type": "PullRequest", "selections": [ - v25, - v33, - v28, + v26, + v34, + v29, { "kind": "ScalarField", "alias": "prState", @@ -1541,9 +1543,9 @@ return { "kind": "InlineFragment", "type": "Issue", "selections": [ - v25, - v33, - v28, + v26, + v34, + v29, { "kind": "ScalarField", "alias": "issueState", @@ -1601,10 +1603,10 @@ return { "selections": v37 }, v38, - v34, - v27, v24, - v26 + v28, + v25, + v27 ] } ] @@ -1638,7 +1640,7 @@ return { "plural": false, "selections": v19 }, - v27 + v28 ] }, { @@ -1654,7 +1656,7 @@ return { "args": null, "storageKey": null }, - v27 + v28 ] }, { @@ -1662,9 +1664,9 @@ return { "type": "IssueComment", "selections": [ v23, - v34, - v27, - v28 + v24, + v28, + v29 ] }, { @@ -1706,7 +1708,7 @@ return { "args": null, "storageKey": null }, - v32, + v33, { "kind": "ScalarField", "alias": null, diff --git a/lib/views/__generated__/prDetailView_pullRequest.graphql.js b/lib/views/__generated__/prDetailView_pullRequest.graphql.js index 3d3b3a848f..e98a5c4a5f 100644 --- a/lib/views/__generated__/prDetailView_pullRequest.graphql.js +++ b/lib/views/__generated__/prDetailView_pullRequest.graphql.js @@ -61,6 +61,7 @@ export type prDetailView_pullRequest = {| +login: string, |}, +body: string, + +bodyHTML: any, +path: string, +commitSha: {| +oid: any @@ -210,19 +211,26 @@ v9 = { v10 = { "kind": "ScalarField", "alias": null, - "name": "number", + "name": "bodyHTML", "args": null, "storageKey": null }, v11 = { + "kind": "ScalarField", + "alias": null, + "name": "number", + "args": null, + "storageKey": null +}, +v12 = { "kind": "ScalarField", "alias": null, "name": "url", "args": null, "storageKey": null }, -v12 = [ - v11 +v13 = [ + v12 ]; return { "kind": "Fragment", @@ -404,6 +412,7 @@ return { ] }, v5, + v10, { "kind": "ScalarField", "alias": null, @@ -420,7 +429,7 @@ return { "concreteType": "PullRequest", "plural": false, "selections": [ - v10 + v11 ] }, { @@ -473,7 +482,7 @@ return { "args": null, "storageKey": null }, - v11 + v12 ] } ] @@ -516,7 +525,7 @@ return { "args": null }, v4, - v10, + v11, { "kind": "ScalarField", "alias": null, @@ -524,13 +533,7 @@ return { "args": null, "storageKey": null }, - { - "kind": "ScalarField", - "alias": null, - "name": "bodyHTML", - "args": null, - "storageKey": null - }, + v10, { "kind": "ScalarField", "alias": null, @@ -559,12 +562,12 @@ return { { "kind": "InlineFragment", "type": "Bot", - "selections": v12 + "selections": v13 }, { "kind": "InlineFragment", "type": "User", - "selections": v12 + "selections": v13 } ] }, @@ -586,7 +589,7 @@ return { } ] }, - v11, + v12, { "kind": "LinkedField", "alias": null, @@ -619,5 +622,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '9feb173b93416270e2ac66924239d1b1'; +(node/*: any*/).hash = 'ab20ccdc3ccc10843176a48cd07d03ae'; module.exports = node; diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index 1314a1029f..f57a26ffc9 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -427,6 +427,7 @@ export default createRefetchContainer(BarePullRequestDetailView, { login } body + bodyHTML path commitSha: commit { oid From 6093aa4ef4a0f8f5f22de1332073c05f16a645d3 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Fri, 21 Dec 2018 15:32:30 +0100 Subject: [PATCH 016/120] use github markdown component to show the comments --- lib/views/pr-comments-view.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index ba3775fead..e0f21a094b 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -4,9 +4,10 @@ import {Point, Range} from 'atom'; import Marker from '../atom/marker'; import Decoration from '../atom/decoration'; - +import GithubDotcomMarkdown from './github-dotcom-markdown'; import Timeago from './timeago'; + export default class PullRequestCommentsView extends React.Component { render() { if (!this.props.reviews) { @@ -46,7 +47,7 @@ class PullRequestCommentView extends React.Component {
- {this.props.comment.body} {this.props.comment.position} +
); From 7f4661437c4a8d630ae0110dfb65f02739548544 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Fri, 21 Dec 2018 15:32:52 +0100 Subject: [PATCH 017/120] drill switchToIssueish prop --- lib/views/multi-file-patch-view.js | 2 +- lib/views/pr-detail-view.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 2eaa0b89e8..7768d9d5e1 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -281,7 +281,7 @@ export default class MultiFilePatchView extends React.Component { /> )} - + {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} {this.renderLineDecorations( diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index f57a26ffc9..44560797bf 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -210,6 +210,7 @@ export class BarePullRequestDetailView extends React.Component { shouldRefetch={this.state.refreshing} reviews={this.props.pullRequest.reviews} + switchToIssueish={this.props.switchToIssueish} /> From 6c3a335d8bf86150d1789a625aaa83e775e129ee Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Fri, 21 Dec 2018 15:39:40 +0100 Subject: [PATCH 018/120] pass switchToIssueish through properly --- lib/controllers/multi-file-patch-controller.js | 1 + lib/views/pr-comments-view.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/controllers/multi-file-patch-controller.js b/lib/controllers/multi-file-patch-controller.js index cdba88def6..0214aa2db9 100644 --- a/lib/controllers/multi-file-patch-controller.js +++ b/lib/controllers/multi-file-patch-controller.js @@ -83,6 +83,7 @@ export default class MultiFilePatchController extends React.Component { discardRows={this.discardRows} selectNextHunk={this.selectNextHunk} selectPreviousHunk={this.selectPreviousHunk} + switchToIssueish={this.props.switchToIssueish} /> ); } diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index e0f21a094b..64750796b1 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -23,7 +23,7 @@ export default class PullRequestCommentsView extends React.Component { return ( - + ); From 43e679d01c38e6eec9e46c285806db78b09be214 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 21 Dec 2018 10:15:51 -0500 Subject: [PATCH 019/120] Start a (failing) test for comment positioning --- test/builder/pr.js | 130 ++++++++++++++++++++++++++++ test/views/pr-comments-view.test.js | 33 +++++++ 2 files changed, 163 insertions(+) create mode 100644 test/builder/pr.js create mode 100644 test/views/pr-comments-view.test.js diff --git a/test/builder/pr.js b/test/builder/pr.js new file mode 100644 index 0000000000..24758ece0b --- /dev/null +++ b/test/builder/pr.js @@ -0,0 +1,130 @@ +class CommentBuilder { + constructor() { + this._id = 0; + this._path = 'first.txt'; + this._position = 0; + this._authorLogin = 'someone'; + this._authorAvatarUrl = 'https://avatars3.githubusercontent.com/u/17565?s=32&v=4'; + this._url = 'https://github.com/atom/github/pull/1829/files#r242224689'; + this._createdAt = 0; + this._body = 'Lorem ipsum dolor sit amet, te urbanitas appellantur est.'; + } + + id(i) { + this._id = i; + return this; + } + + path(p) { + this._path = p; + return this; + } + + position(pos) { + this._position = pos; + return this; + } + + authorLogin(login) { + this._authorLogin = login; + return this; + } + + authorAvatarUrl(url) { + this._authorAvatarUrl = url; + return this; + } + + url(u) { + this._url = u; + return this; + } + + createdAt(ts) { + this._createdAt = ts; + return this; + } + + body(text) { + this._body = text; + return this; + } + + build() { + return { + id: this._id, + author: { + login: this._authorLogin, + avatarUrl: this._authorAvatarUrl, + }, + body: this._body, + path: this._path, + position: this._position, + createdAt: this._createdAt, + url: this._url, + }; + } +} + +class ReviewBuilder { + constructor() { + this.nextCommentID = 0; + this._id = 0; + this._comments = []; + } + + id(i) { + this._id = i; + return this; + } + + addComment(block = () => {}) { + const builder = new CommentBuilder(); + builder.id(this.nextCommentID); + this.nextCommentID++; + + block(builder); + this._comments.push(builder.build()); + + return this; + } + + build() { + return { + id: this._id, + comments: {nodes: this._comments}, + }; + } +} + +class PullRequestBuilder { + constructor() { + this.nextCommentID = 0; + this.nextReviewID = 0; + this._reviews = []; + } + + addReview(block = () => {}) { + const builder = new ReviewBuilder(); + builder.id(this.nextReviewID); + this.nextReviewID++; + + block(builder); + this._reviews.push(builder.build()); + return this; + } + + build() { + return { + reviews: {nodes: this._reviews}, + }; + } +} + +export function reviewBuilder() { + return new ReviewBuilder(); +} + +export function pullRequestBuilder() { + return new PullRequestBuilder(); +} diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js new file mode 100644 index 0000000000..36ab79dc61 --- /dev/null +++ b/test/views/pr-comments-view.test.js @@ -0,0 +1,33 @@ +import React from 'react'; +import {shallow} from 'enzyme'; + +import {multiFilePatchBuilder} from '../builder/patch'; +import {pullRequestBuilder} from '../builder/pr'; +import PrCommentsView from '../../lib/views/pr-comments-view'; + +describe('PrCommentsView', function() { + it('adjusts the position for comments after hunk headers', function() { + const {multiFilePatch} = multiFilePatchBuilder() + .addFilePatch(fp => { + fp.setOldFile(f => f.path('file.txt')); + fp.addHunk(h => h.oldRow(5).unchanged('1').added('2', '3', '4').unchanged('5')); + fp.addHunk(h => h.oldRow(20).unchanged('7').deleted('8', '9', '10').unchanged('11')); + fp.addHunk(h => h.oldRow(30).unchanged('13').added('14', '15').deleted('16').unchanged('17')); + }) + .build(); + + const pr = pullRequestBuilder() + .addReview(r => { + r.addComment(c => c.id(0).path('file.txt').position(2).body('one')); + r.addComment(c => c.id(1).path('file.txt').position(9).body('two')); + r.addComment(c => c.id(2).path('file.txt').position(15).body('three')); + }) + .build(); + + const wrapper = shallow(); + + assert.deepEqual(wrapper.find('Marker').at(0).prop('bufferRange').serialize(), [[1, 0], [1, 0]]); + assert.deepEqual(wrapper.find('Marker').at(1).prop('bufferRange').serialize(), [[7, 0], [7, 0]]); + assert.deepEqual(wrapper.find('Marker').at(2).prop('bufferRange').serialize(), [[12, 0], [12, 0]]); + }); +}); From 2ca9fa63d4c1dea775b12eca990c3cd1459d9ec0 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Fri, 21 Dec 2018 16:34:37 +0100 Subject: [PATCH 020/120] font is a bit large --- styles/pr-comment.less | 1 - 1 file changed, 1 deletion(-) diff --git a/styles/pr-comment.less b/styles/pr-comment.less index 7cb0e62654..427dd1a0b3 100644 --- a/styles/pr-comment.less +++ b/styles/pr-comment.less @@ -30,7 +30,6 @@ &-body { margin-left: @avatar-size + 4px; // avatar + margin - font-size: 1.15em; } } From ea4b7518a94597145df5b58156f061e27a8e63ed Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 21 Dec 2018 13:36:40 -0500 Subject: [PATCH 021/120] Don't re-invent the binary... tree... wheel? --- package-lock.json | 7 ++++++- package.json | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 712f5bcef8..b3a9b8401f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1623,6 +1623,11 @@ "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==", "dev": true }, + "bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha1-SfiW1uhYpKSZ34XDj7OZua/4QPg=" + }, "bl": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", @@ -5132,7 +5137,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { diff --git a/package.json b/package.json index 6ab320fd1c..29c0508186 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "babel-plugin-transform-es2015-modules-commonjs": "6.26.2", "babel-plugin-transform-object-rest-spread": "6.26.0", "babel-preset-react": "6.24.1", + "bintrees": "1.0.2", "bytes": "^3.0.0", "classnames": "2.2.6", "compare-sets": "1.0.1", From 3b89168b4c666702e6383943a545319a9503d326 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 21 Dec 2018 13:37:06 -0500 Subject: [PATCH 022/120] Compute buffer rows for diff positions, given as filename + diff row --- lib/models/patch/multi-file-patch.js | 31 ++++++-- test/models/patch/multi-file-patch.test.js | 82 ++++++++++++++++++++++ 2 files changed, 108 insertions(+), 5 deletions(-) diff --git a/lib/models/patch/multi-file-patch.js b/lib/models/patch/multi-file-patch.js index 7336ca1381..132573214d 100644 --- a/lib/models/patch/multi-file-patch.js +++ b/lib/models/patch/multi-file-patch.js @@ -1,4 +1,5 @@ import {TextBuffer, Range} from 'atom'; +import {RBTree} from 'bintrees'; export default class MultiFilePatch { constructor({buffer, layers, filePatches}) { @@ -16,10 +17,27 @@ export default class MultiFilePatch { this.filePatchesByMarker = new Map(); this.hunksByMarker = new Map(); + // Store a map of {diffRow, offset} for each FilePatch where offset is the number of Hunk headers within the current + // FilePatch that occur before this row in the original diff output. + this.diffRowOffsetIndices = new Map(); + for (const filePatch of this.filePatches) { this.filePatchesByMarker.set(filePatch.getMarker(), filePatch); - for (const hunk of filePatch.getHunks()) { + + let diffRow = 1; + const index = new RBTree((a, b) => a.diffRow - b.diffRow); + this.diffRowOffsetIndices.set(filePatch.getPath(), {startBufferRow: filePatch.getStartRange().start.row, index}); + + for (let hunkIndex = 0; hunkIndex < filePatch.getHunks().length; hunkIndex++) { + const hunk = filePatch.getHunks()[hunkIndex]; this.hunksByMarker.set(hunk.getMarker(), hunk); + + // Advance past the hunk body + diffRow += hunk.bufferRowCount(); + index.insert({diffRow, offset: hunkIndex + 1}); + + // Advance past the next hunk header + diffRow++; } } } @@ -71,10 +89,6 @@ export default class MultiFilePatch { return this.filePatches; } - getFilePatchByPath(path) { - return this.filePatches.find(filePatch => filePatch.getPath() === path); - } - getPathSet() { return this.getFilePatches().reduce((pathSet, filePatch) => { for (const file of [filePatch.getOldFile(), filePatch.getNewFile()]) { @@ -325,6 +339,13 @@ export default class MultiFilePatch { return false; } + getBufferRowForDiffPosition(fileName, diffRow) { + // TODO verify that this works on Windows + const {startBufferRow, index} = this.diffRowOffsetIndices.get(fileName); + const {offset} = index.lowerBound({diffRow}).data(); + return startBufferRow + diffRow - offset; + } + /* * Construct an apply-able patch String. */ diff --git a/test/models/patch/multi-file-patch.test.js b/test/models/patch/multi-file-patch.test.js index 123812b2c2..767b17e233 100644 --- a/test/models/patch/multi-file-patch.test.js +++ b/test/models/patch/multi-file-patch.test.js @@ -275,25 +275,31 @@ describe('MultiFilePatch', function() { it('adopts a buffer from a previous patch', function() { const {multiFilePatch: lastMultiPatch, buffer: lastBuffer, layers: lastLayers} = multiFilePatchBuilder() .addFilePatch(fp => { + fp.setOldFile(f => f.path('A0.txt')); fp.addHunk(h => h.unchanged('a0').added('a1').deleted('a2').unchanged('a3')); }) .addFilePatch(fp => { + fp.setOldFile(f => f.path('A1.txt')); fp.addHunk(h => h.unchanged('a4').deleted('a5').unchanged('a6')); fp.addHunk(h => h.unchanged('a7').added('a8').unchanged('a9')); }) .addFilePatch(fp => { + fp.setOldFile(f => f.path('A2.txt')); fp.addHunk(h => h.oldRow(99).deleted('7').noNewline()); }) .build(); const {multiFilePatch: nextMultiPatch, buffer: nextBuffer, layers: nextLayers} = multiFilePatchBuilder() .addFilePatch(fp => { + fp.setOldFile(f => f.path('B0.txt')); fp.addHunk(h => h.unchanged('b0', 'b1').added('b2').unchanged('b3', 'b4')); }) .addFilePatch(fp => { + fp.setOldFile(f => f.path('B1.txt')); fp.addHunk(h => h.unchanged('b5', 'b6').added('b7')); }) .addFilePatch(fp => { + fp.setOldFile(f => f.path('B2.txt')); fp.addHunk(h => h.unchanged('b8', 'b9').deleted('b10').unchanged('b11')); fp.addHunk(h => h.oldRow(99).deleted('b12').noNewline()); }) @@ -352,6 +358,9 @@ describe('MultiFilePatch', function() { assertMarkedLayerRanges(lastLayers.noNewline, [ [[13, 0], [13, 26]], ]); + + assert.strictEqual(nextMultiPatch.getBufferRowForDiffPosition('B0.txt', 1), 0); + assert.strictEqual(nextMultiPatch.getBufferRowForDiffPosition('B2.txt', 5), 12); }); describe('derived patch generation', function() { @@ -694,4 +703,77 @@ describe('MultiFilePatch', function() { assert.isTrue(multiFilePatch.spansMultipleFiles([6, 10])); }); }); + + describe('diff position translation', function() { + it('offsets rows in the first hunk by the first hunk header', function() { + const {multiFilePatch} = multiFilePatchBuilder() + .addFilePatch(fp => { + fp.setOldFile(f => f.path('file.txt')); + fp.addHunk(h => { + h.unchanged('1 (0)').added('2 (1)', '3 (2)').deleted('4 (3)', '5 (4)', '6 (5)').unchanged('7 (6)'); + }); + }) + .build(); + + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('file.txt', 1), 0); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('file.txt', 7), 6); + }); + + it('offsets rows by the number of hunks before the diff row', function() { + const {multiFilePatch} = multiFilePatchBuilder() + .addFilePatch(fp => { + fp.setOldFile(f => f.path('file.txt')); + fp.addHunk(h => h.unchanged('0 (1)').added('1 (2)', '2 (3)').deleted('3 (4)').unchanged('4 (5)')); + fp.addHunk(h => h.unchanged('5 (7)').added('6 (8)', '7 (9)', '8 (10)').unchanged('9 (11)')); + fp.addHunk(h => h.unchanged('10 (13)').deleted('11 (14)').unchanged('12 (15)')); + }) + .build(); + + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('file.txt', 7), 5); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('file.txt', 11), 9); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('file.txt', 13), 10); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('file.txt', 15), 12); + }); + + it('resets the offset at the start of each file patch', function() { + const {multiFilePatch} = multiFilePatchBuilder() + .addFilePatch(fp => { + fp.setOldFile(f => f.path('0.txt')); + fp.addHunk(h => h.unchanged('0 (1)').added('1 (2)', '2 (3)').unchanged('3 (4)')); // Offset +1 + fp.addHunk(h => h.unchanged('4 (6)').deleted('5 (7)', '6 (8)', '7 (9)').unchanged('8 (10)')); // Offset +2 + fp.addHunk(h => h.unchanged('9 (12)').deleted('10 (13)').unchanged('11 (14)')); // Offset +3 + }) + .addFilePatch(fp => { + fp.setOldFile(f => f.path('1.txt')); + fp.addHunk(h => h.unchanged('12 (1)').added('13 (2)').unchanged('14 (3)')); // Offset +1 + fp.addHunk(h => h.unchanged('15 (5)').deleted('16 (6)', '17 (7)', '18 (8)').unchanged('19 (9)')); // Offset +2 + }) + .addFilePatch(fp => { + fp.setOldFile(f => f.path('2.txt')); + fp.addHunk(h => h.unchanged('20 (1)').added('21 (2)', '22 (3)', '23 (4)', '24 (5)').unchanged('25 (6)')); // Offset +1 + fp.addHunk(h => h.unchanged('26 (8)').deleted('27 (9)', '28 (10)').unchanged('29 (11)')); // Offset +2 + fp.addHunk(h => h.unchanged('30 (13)').added('31 (14)').unchanged('32 (15)')); // Offset +3 + }) + .build(); + + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('0.txt', 1), 0); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('0.txt', 4), 3); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('0.txt', 6), 4); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('0.txt', 10), 8); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('0.txt', 12), 9); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('0.txt', 14), 11); + + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('1.txt', 1), 12); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('1.txt', 3), 14); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('1.txt', 5), 15); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('1.txt', 9), 19); + + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('2.txt', 1), 20); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('2.txt', 6), 25); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('2.txt', 8), 26); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('2.txt', 11), 29); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('2.txt', 13), 30); + assert.strictEqual(multiFilePatch.getBufferRowForDiffPosition('2.txt', 15), 32); + }); + }); }); From ffbf81a887cb56430c6cb74c1d4da4ca5b3a2730 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 21 Dec 2018 13:50:53 -0500 Subject: [PATCH 023/120] Use `getBufferRowForDiffPosition` to position review comments --- lib/views/pr-comments-view.js | 29 ++++++++++++++++------------- test/views/pr-comments-view.test.js | 25 ++++++++++++++++--------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index 64750796b1..715376c371 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -2,12 +2,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import {Point, Range} from 'atom'; +import {toNativePathSep} from '../helpers'; import Marker from '../atom/marker'; import Decoration from '../atom/decoration'; import GithubDotcomMarkdown from './github-dotcom-markdown'; import Timeago from './timeago'; - export default class PullRequestCommentsView extends React.Component { render() { if (!this.props.reviews) { @@ -16,19 +16,22 @@ export default class PullRequestCommentsView extends React.Component { return this.props.reviews.nodes.map(review => { return review.comments.nodes.map(comment => { - if (comment.position !== null) { - const filePatch = this.props.multiFilePatch.getFilePatchByPath(comment.path); - const commentStartPoint = filePatch.getStartRange().start.translate(new Point(comment.position, 0)); - const range = new Range(commentStartPoint, commentStartPoint); - return ( - - - - - - ); + if (!comment.position) { + return null; } - return null; + + const nativePath = toNativePathSep(comment.path); + const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, comment.position); + const point = new Point(row, 0); + const range = new Range(point, point); + + return ( + + + + + + ); }); }); } diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index 36ab79dc61..13089158f3 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -9,25 +9,32 @@ describe('PrCommentsView', function() { it('adjusts the position for comments after hunk headers', function() { const {multiFilePatch} = multiFilePatchBuilder() .addFilePatch(fp => { - fp.setOldFile(f => f.path('file.txt')); - fp.addHunk(h => h.oldRow(5).unchanged('1').added('2', '3', '4').unchanged('5')); - fp.addHunk(h => h.oldRow(20).unchanged('7').deleted('8', '9', '10').unchanged('11')); - fp.addHunk(h => h.oldRow(30).unchanged('13').added('14', '15').deleted('16').unchanged('17')); + fp.setOldFile(f => f.path('file0.txt')); + fp.addHunk(h => h.oldRow(5).unchanged('0 (1)').added('1 (2)', '2 (3)', '3 (4)').unchanged('4 (5)')); + fp.addHunk(h => h.oldRow(20).unchanged('5 (7)').deleted('6 (8)', '7 (9)', '8 (10)').unchanged('9 (11)')); + fp.addHunk(h => { + h.oldRow(30).unchanged('10 (13)').added('11 (14)', '12 (15)').deleted('13 (16)').unchanged('14 (17)'); + }); + }) + .addFilePatch(fp => { + fp.setOldFile(f => f.path('file1.txt')); + fp.addHunk(h => h.oldRow(5).unchanged('15 (1)').added('16 (2)').unchanged('17 (3)')); + fp.addHunk(h => h.oldRow(20).unchanged('18 (5)').deleted('19 (6)', '20 (7)', '21 (8)').unchanged('22 (9)')); }) .build(); const pr = pullRequestBuilder() .addReview(r => { - r.addComment(c => c.id(0).path('file.txt').position(2).body('one')); - r.addComment(c => c.id(1).path('file.txt').position(9).body('two')); - r.addComment(c => c.id(2).path('file.txt').position(15).body('three')); + r.addComment(c => c.id(0).path('file0.txt').position(2).body('one')); + r.addComment(c => c.id(1).path('file0.txt').position(15).body('three')); + r.addComment(c => c.id(1).path('file1.txt').position(7).body('three')); }) .build(); const wrapper = shallow(); assert.deepEqual(wrapper.find('Marker').at(0).prop('bufferRange').serialize(), [[1, 0], [1, 0]]); - assert.deepEqual(wrapper.find('Marker').at(1).prop('bufferRange').serialize(), [[7, 0], [7, 0]]); - assert.deepEqual(wrapper.find('Marker').at(2).prop('bufferRange').serialize(), [[12, 0], [12, 0]]); + assert.deepEqual(wrapper.find('Marker').at(1).prop('bufferRange').serialize(), [[12, 0], [12, 0]]); + assert.deepEqual(wrapper.find('Marker').at(2).prop('bufferRange').serialize(), [[20, 0], [20, 0]]); }); }); From 8984cbcf71c4352f0b0de56b2023e7ba01cc33b1 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 21 Dec 2018 13:56:29 -0500 Subject: [PATCH 024/120] Position the decoration after its marker, not before --- lib/views/pr-comments-view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index 715376c371..34cd615bfd 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -27,7 +27,7 @@ export default class PullRequestCommentsView extends React.Component { return ( - + From a00dbab2c2260a2b7ead93d623fc5cc3a0927603 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 27 Dec 2018 10:47:10 -0800 Subject: [PATCH 025/120] fix `IssueishDetailContainer` tests Co-Authored-By: Katrina Uychaco --- test/containers/issueish-detail-container.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/containers/issueish-detail-container.test.js b/test/containers/issueish-detail-container.test.js index 10728075c7..934f24df9f 100644 --- a/test/containers/issueish-detail-container.test.js +++ b/test/containers/issueish-detail-container.test.js @@ -30,6 +30,8 @@ describe('IssueishDetailContainer', function() { timelineCursor: null, commitCount: 100, commitCursor: null, + commentCount: 100, + commentCursor: null, }, }, { repository: { From 3f6123bfa32b2ff44994f12a9cebe1556e13982b Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 27 Dec 2018 10:59:19 -0800 Subject: [PATCH 026/120] fix console prop type warnings Co-Authored-By: Katrina Uychaco --- test/fixtures/props/issueish-pane-props.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/fixtures/props/issueish-pane-props.js b/test/fixtures/props/issueish-pane-props.js index 0224a05577..cabc7e4140 100644 --- a/test/fixtures/props/issueish-pane-props.js +++ b/test/fixtures/props/issueish-pane-props.js @@ -27,6 +27,15 @@ export function issueishDetailContainerProps(overrides = {}) { switchToIssueish: () => {}, onTitleChange: () => {}, + workspace: {}, + commands: {}, + keymaps: {}, + tooltips: {}, + config: {}, + destroy: () => {}, + + itemType: IssueishDetailItem, + ...overrides, }; } From baf6e6d04d437602454eb7a876eb23db51ef19a1 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 27 Dec 2018 11:05:23 -0800 Subject: [PATCH 027/120] fix integration tests for checking out a pr --- test/integration/checkout-pr.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/integration/checkout-pr.test.js b/test/integration/checkout-pr.test.js index 6a0c6aa407..2fcfcdcec7 100644 --- a/test/integration/checkout-pr.test.js +++ b/test/integration/checkout-pr.test.js @@ -8,7 +8,7 @@ import {createRepositoryResult} from '../fixtures/factories/repository-result'; import IDGenerator from '../fixtures/factories/id-generator'; import {createPullRequestsResult, createPullRequestDetailResult} from '../fixtures/factories/pull-request-result'; -describe('integration: check out a pull request', function() { +describe.only('integration: check out a pull request', function() { let context, wrapper, atomEnv, workspaceElement, git, idGen, repositoryID; beforeEach(async function() { @@ -140,6 +140,8 @@ describe('integration: check out a pull request', function() { timelineCursor: null, commitCount: 100, commitCursor: null, + commentCount: 100, + commentCursor: null, }, }, result); } From 8e95936f2add649f385a0df87322c9eebb40e612 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 27 Dec 2018 11:07:11 -0800 Subject: [PATCH 028/120] never did get that git hook to work for stupid .only calls --- test/integration/checkout-pr.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/checkout-pr.test.js b/test/integration/checkout-pr.test.js index 2fcfcdcec7..a15a1adced 100644 --- a/test/integration/checkout-pr.test.js +++ b/test/integration/checkout-pr.test.js @@ -8,7 +8,7 @@ import {createRepositoryResult} from '../fixtures/factories/repository-result'; import IDGenerator from '../fixtures/factories/id-generator'; import {createPullRequestsResult, createPullRequestDetailResult} from '../fixtures/factories/pull-request-result'; -describe.only('integration: check out a pull request', function() { +describe('integration: check out a pull request', function() { let context, wrapper, atomEnv, workspaceElement, git, idGen, repositoryID; beforeEach(async function() { From 8055ee33d996db40c073bcca569a100ca757abc8 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 27 Dec 2018 11:46:57 -0800 Subject: [PATCH 029/120] add test for comment with position: null --- test/views/pr-comments-view.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index 13089158f3..ca71a0d31c 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -37,4 +37,29 @@ describe('PrCommentsView', function() { assert.deepEqual(wrapper.find('Marker').at(1).prop('bufferRange').serialize(), [[12, 0], [12, 0]]); assert.deepEqual(wrapper.find('Marker').at(2).prop('bufferRange').serialize(), [[20, 0], [20, 0]]); }); + it('does not render comment if position is null', function() { + const {multiFilePatch} = multiFilePatchBuilder() + .addFilePatch(fp => { + fp.setOldFile(f => f.path('file0.txt')); + fp.addHunk(h => h.oldRow(5).unchanged('0 (1)').added('1 (2)', '2 (3)', '3 (4)').unchanged('4 (5)')); + fp.addHunk(h => h.oldRow(20).unchanged('5 (7)').deleted('6 (8)', '7 (9)', '8 (10)').unchanged('9 (11)')); + fp.addHunk(h => { + h.oldRow(30).unchanged('10 (13)').added('11 (14)', '12 (15)').deleted('13 (16)').unchanged('14 (17)'); + }); + }) + .build(); + + const pr = pullRequestBuilder() + .addReview(r => { + r.addComment(c => c.id(0).path('file0.txt').position(2).body('one')); + r.addComment(c => c.id(1).path('file0.txt').position(null).body('three')); + }) + .build(); + + const wrapper = shallow(); + + const comments = wrapper.find('PullRequestCommentView'); + assert.lengthOf(comments, 1); + assert.strictEqual(comments.at(0).prop('comment').body, 'one'); + }); }); From 12301c43d7765631428f362178126279b3b95743 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 27 Dec 2018 11:51:20 -0800 Subject: [PATCH 030/120] let's call it `PullRequestCommentView` just to be consistent --- test/views/pr-comments-view.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index ca71a0d31c..5617c02120 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -3,9 +3,9 @@ import {shallow} from 'enzyme'; import {multiFilePatchBuilder} from '../builder/patch'; import {pullRequestBuilder} from '../builder/pr'; -import PrCommentsView from '../../lib/views/pr-comments-view'; +import PullRequestCommentsView from '../../lib/views/pr-comments-view'; -describe('PrCommentsView', function() { +describe('PullRequestCommentsView', function() { it('adjusts the position for comments after hunk headers', function() { const {multiFilePatch} = multiFilePatchBuilder() .addFilePatch(fp => { @@ -31,7 +31,7 @@ describe('PrCommentsView', function() { }) .build(); - const wrapper = shallow(); + const wrapper = shallow(); assert.deepEqual(wrapper.find('Marker').at(0).prop('bufferRange').serialize(), [[1, 0], [1, 0]]); assert.deepEqual(wrapper.find('Marker').at(1).prop('bufferRange').serialize(), [[12, 0], [12, 0]]); @@ -56,7 +56,7 @@ describe('PrCommentsView', function() { }) .build(); - const wrapper = shallow(); + const wrapper = shallow(); const comments = wrapper.find('PullRequestCommentView'); assert.lengthOf(comments, 1); From 7dd8376dbfe9a3324a27826d497f2be4f4dce6ba Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 11:03:18 -0800 Subject: [PATCH 031/120] WIP sort comments in correct order. Red herring. seems like they're coming back sorted, but rendering in the wrong order # 50-character subject line # # 72-character wrapped longer description. This should answer: # # * Why was this change necessary? # * How does it address the problem? # * Are there any side effects? # # Include a link to the ticket, if any. # # Don't forget the following emoji: # # * :art: `:art:` when improving the format/structure of the code # * :racehorse: `:racehorse:` when improving performance # * :non-potable_water: `:non-potable_water:` when plugging memory leaks # * :memo: `:memo:` when writing docs # * :penguin: `:penguin:` when fixing something on Linux # * :apple: `:apple:` when fixing something on Mac OS # * :checkered_flag: `:checkered_flag:` when fixing something on Windows # * :bug: `:bug:` when fixing a bug # * :fire: `:fire:` when removing code or files # * :green_heart: `:green_heart:` when fixing the CI build # * :white_check_mark: `:white_check_mark:` when adding tests # * :lock: `:lock:` when dealing with security # * :arrow_up: `:arrow_up:` when upgrading dependencies # * :arrow_down: `:arrow_down:` when downgrading dependencies # * :shirt: `:shirt:` when removing linter warnings --- lib/views/pr-comments-view.js | 48 ++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index 34cd615bfd..e91417339b 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -14,14 +14,31 @@ export default class PullRequestCommentsView extends React.Component { return null; } - return this.props.reviews.nodes.map(review => { - return review.comments.nodes.map(comment => { + const commentsByPosition = new Map(); + this.props.reviews.nodes.forEach(review => { + review.comments.nodes.forEach(comment => { + const nativePath = toNativePathSep(comment.path); + const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, comment.position); + const commentsAtRow = commentsByPosition.get(row); + if (commentsAtRow) { + commentsAtRow.add(comment); + } else { + commentsByPosition.set(row, new Set([comment])); + } + }); + }); + + return [...commentsByPosition].map(([row, comments]) => { + const getUnixTime = epoch => new Date(epoch).getTime() / 1000; + console.log([...comments]); + const sortedComments = [...comments].sort((a, b) => getUnixTime(a.createdAt) - getUnixTime(b.createdAt)); + + console.log(sortedComments); + return sortedComments.map(comment => { if (!comment.position) { return null; } - const nativePath = toNativePathSep(comment.path); - const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, comment.position); const point = new Point(row, 0); const range = new Range(point, point); @@ -34,6 +51,29 @@ export default class PullRequestCommentsView extends React.Component { ); }); }); + + // debugger; + // + // return this.props.reviews.nodes.map(review => { + // return review.comments.nodes.map(comment => { + // if (!comment.position) { + // return null; + // } + // + // const nativePath = toNativePathSep(comment.path); + // const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, comment.position); + // const point = new Point(row, 0); + // const range = new Range(point, point); + // + // return ( + // + // + // + // + // + // ); + // }); + // }); } } From 7b7d6cdac4da27c1ada6878dc67f14d405011b7c Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 13:46:59 -0800 Subject: [PATCH 032/120] Separate out comments by thread, and render them in correct order # 50-character subject line # # 72-character wrapped longer description. This should answer: # # * Why was this change necessary? # * How does it address the problem? # * Are there any side effects? # # Include a link to the ticket, if any. # # Don't forget the following emoji: # # * :art: `:art:` when improving the format/structure of the code # * :racehorse: `:racehorse:` when improving performance # * :non-potable_water: `:non-potable_water:` when plugging memory leaks # * :memo: `:memo:` when writing docs # * :penguin: `:penguin:` when fixing something on Linux # * :apple: `:apple:` when fixing something on Mac OS # * :checkered_flag: `:checkered_flag:` when fixing something on Windows # * :bug: `:bug:` when fixing a bug # * :fire: `:fire:` when removing code or files # * :green_heart: `:green_heart:` when fixing the CI build # * :white_check_mark: `:white_check_mark:` when adding tests # * :lock: `:lock:` when dealing with security # * :arrow_up: `:arrow_up:` when upgrading dependencies # * :arrow_down: `:arrow_down:` when downgrading dependencies # * :shirt: `:shirt:` when removing linter warnings --- lib/views/pr-comments-view.js | 77 ++++++++++++----------------------- 1 file changed, 27 insertions(+), 50 deletions(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index e91417339b..1bb8b479c7 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -14,66 +14,43 @@ export default class PullRequestCommentsView extends React.Component { return null; } - const commentsByPosition = new Map(); + const commentsByRootCommentId = new Map(); + this.props.reviews.nodes.forEach(review => { review.comments.nodes.forEach(comment => { - const nativePath = toNativePathSep(comment.path); - const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, comment.position); - const commentsAtRow = commentsByPosition.get(row); - if (commentsAtRow) { - commentsAtRow.add(comment); + if (!comment.replyTo) { + commentsByRootCommentId.set(comment.id, [comment]); } else { - commentsByPosition.set(row, new Set([comment])); + commentsByRootCommentId.get(comment.replyTo.id).push(comment); } }); }); - return [...commentsByPosition].map(([row, comments]) => { - const getUnixTime = epoch => new Date(epoch).getTime() / 1000; - console.log([...comments]); - const sortedComments = [...comments].sort((a, b) => getUnixTime(a.createdAt) - getUnixTime(b.createdAt)); - - console.log(sortedComments); - return sortedComments.map(comment => { - if (!comment.position) { - return null; - } - const point = new Point(row, 0); - const range = new Range(point, point); + return [...commentsByRootCommentId].reverse().map(([rootCommentId, comments]) => { + const rootComment = comments[0]; + if (!rootComment.position) { + return null; + } - return ( - - - - - - ); - }); + const nativePath = toNativePathSep(rootComment.path); + const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, rootComment.position); + const point = new Point(row, 0); + const range = new Range(point, point); + return ( + + + {comments.map(comment => + , + )} + + + ); }); - - // debugger; - // - // return this.props.reviews.nodes.map(review => { - // return review.comments.nodes.map(comment => { - // if (!comment.position) { - // return null; - // } - // - // const nativePath = toNativePathSep(comment.path); - // const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, comment.position); - // const point = new Point(row, 0); - // const range = new Range(point, point); - // - // return ( - // - // - // - // - // - // ); - // }); - // }); } } From 97f22e628a952c440bebd80694779ae507a1d39a Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 27 Dec 2018 14:01:48 -0800 Subject: [PATCH 033/120] add tests for `PullRequestCommentView` --- lib/views/pr-comments-view.js | 7 ++-- test/views/pr-comments-view.test.js | 56 ++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index 1bb8b479c7..a1beeb9d72 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -54,14 +54,15 @@ export default class PullRequestCommentsView extends React.Component { } } -class PullRequestCommentView extends React.Component { +export class PullRequestCommentView extends React.Component { render() { const author = this.props.comment.author; + const login = author ? author.login : 'someone'; return (
- {author.login} - {author ? author.login : 'someone'} commented{' '} + {login} + {login} commented{' '} diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index 5617c02120..ccb7b78673 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -3,7 +3,7 @@ import {shallow} from 'enzyme'; import {multiFilePatchBuilder} from '../builder/patch'; import {pullRequestBuilder} from '../builder/pr'; -import PullRequestCommentsView from '../../lib/views/pr-comments-view'; +import PullRequestCommentsView, {PullRequestCommentView} from '../../lib/views/pr-comments-view'; describe('PullRequestCommentsView', function() { it('adjusts the position for comments after hunk headers', function() { @@ -63,3 +63,57 @@ describe('PullRequestCommentsView', function() { assert.strictEqual(comments.at(0).prop('comment').body, 'one'); }); }); + +describe('PullRequestCommentView', function() { + const avatarUrl = 'https://avatars3.githubusercontent.com/u/3781742?s=40&v=4'; + const login = 'annthurium'; + const commentUrl = 'https://github.com/kuychaco/test-repo/pull/4#discussion_r244214873'; + const createdAt = '2018-12-27T17:51:17Z'; + const bodyHTML = '
yo yo
'; + const switchToIssueish = () => {}; + + function buildApp(overrideProps = {}, opts = {}) { + const props = { + comment: { + bodyHTML, + url: commentUrl, + createdAt, + author: { + avatarUrl, + login, + }, + ...overrideProps, + }, + switchToIssueish, + ...opts, + }; + + return ( + + ); + } + it('renders the PullRequestCommentReview information', function() { + const wrapper = shallow(buildApp()); + const avatar = wrapper.find('.github-PrComment-avatar'); + + assert.strictEqual(avatar.getElement('src').props.src, avatarUrl); + assert.strictEqual(avatar.getElement('alt').props.alt, login); + + assert.isTrue(wrapper.text().includes(`${login} commented`)); + + const a = wrapper.find('.github-PrComment-timeAgo'); + assert.strictEqual(a.getElement('href').props.href, commentUrl); + + const timeAgo = wrapper.find('Timeago'); + assert.strictEqual(timeAgo.prop('time'), createdAt); + + const githubDotcomMarkdown = wrapper.find('GithubDotcomMarkdown'); + assert.strictEqual(githubDotcomMarkdown.prop('html'), bodyHTML); + assert.strictEqual(githubDotcomMarkdown.prop('switchToIssueish'), switchToIssueish); + }); + + it('contains the text `someone commented` for null authors', function() { + const wrapper = shallow(buildApp({author: null})); + assert.isTrue(wrapper.text().includes('someone commented')); + }); +}); From ed7d0a5c5b42435ea51de16ff680551effe22dfb Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 15:36:24 -0800 Subject: [PATCH 034/120] WIP create PrReviewsContainer to lay foundation for pagination Move query from PrDetailView to this container Co-Authored-By: Tilde Ann Thurium --- .../issueishDetailContainerQuery.graphql.js | 467 +++++++------- .../prReviewsContainerQuery.graphql.js | 503 +++++++++++++++ .../prReviewsContainer_pullRequest.graphql.js | 354 +++++++++++ lib/containers/issueish-detail-container.js | 6 + lib/containers/pr-reviews-container.js | 92 +++ .../prDetailViewRefetchQuery.graphql.js | 587 +++++++++--------- .../prDetailView_pullRequest.graphql.js | 447 +++---------- lib/views/multi-file-patch-view.js | 4 +- lib/views/pr-comments-view.js | 2 +- lib/views/pr-detail-view.js | 78 +-- 10 files changed, 1548 insertions(+), 992 deletions(-) create mode 100644 lib/containers/__generated__/prReviewsContainerQuery.graphql.js create mode 100644 lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js create mode 100644 lib/containers/pr-reviews-container.js diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 55b80a18d2..ea0f609242 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 063056b23fdd8f4f06939894757d5382 + * @relayHash 615fe759e1fcacb3ed5561310f21f8ed */ /* eslint-disable */ @@ -20,6 +20,8 @@ export type issueishDetailContainerQueryVariables = {| commitCursor?: ?string, commentCount: number, commentCursor?: ?string, + reviewCount?: ?number, + reviewCursor?: ?string, |}; export type issueishDetailContainerQueryResponse = {| +repository: ?{| @@ -44,12 +46,12 @@ query issueishDetailContainerQuery( $commitCursor: String ) { repository(owner: $repoOwner, name: $repoName) { - ...issueishDetailController_repository_2LgaQ1 + ...issueishDetailController_repository_y3nHF id } } -fragment issueishDetailController_repository_2LgaQ1 on Repository { +fragment issueishDetailController_repository_y3nHF on Repository { ...issueDetailView_repository ...prDetailView_repository name @@ -158,87 +160,7 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { } isCrossRepository changedFiles - comments { - totalCount - } - reviews(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - body - commitId: commit { - oid - id - } - state - submittedAt - login: author { - __typename - login - ... on Node { - id - } - } - author { - __typename - avatarUrl - ... on Node { - id - } - } - comments(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - pullRequestId: pullRequest { - number - id - } - databaseId - login: author { - __typename - login - ... on Node { - id - } - } - author { - __typename - avatarUrl - login - ... on Node { - id - } - } - body - bodyHTML - path - commitSha: commit { - oid - id - } - diffHunk - position - originalPosition - originalCommitId: originalCommit { - oid - id - } - replyTo { - id - } - createdAt - url - } - } - } - } + ...prReviewsContainer_pullRequest_3CUNoW ...prCommitsView_pullRequest_38TpXw countedCommits: commits { totalCount @@ -278,6 +200,69 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { } } +fragment prReviewsContainer_pullRequest_3CUNoW on PullRequest { + url + reviews { + pageInfo { + hasNextPage + endCursor + } + edges { + cursor + node { + id + body + commitId: commit { + oid + id + } + state + submittedAt + login: author { + __typename + login + ... on Node { + id + } + } + author { + __typename + avatarUrl + ... on Node { + id + } + } + comments(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + author { + __typename + avatarUrl + login + ... on Node { + id + } + } + bodyHTML + path + position + replyTo { + id + } + createdAt + url + } + } + __typename + } + } + } +} + fragment prCommitsView_pullRequest_38TpXw on PullRequest { url commits(first: $commitCount, after: $commitCursor) { @@ -651,6 +636,18 @@ var v0 = [ "name": "commentCursor", "type": "String", "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCount", + "type": "Int", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCursor", + "type": "String", + "defaultValue": null } ], v1 = [ @@ -1106,15 +1103,7 @@ v34 = [ "type": "Int" } ], -v35 = [ - { - "kind": "Literal", - "name": "first", - "value": 100, - "type": "Int" - } -], -v36 = { +v35 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -1127,14 +1116,7 @@ v36 = { v18 ] }, -v37 = { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null -}, -v38 = [ +v36 = [ { "kind": "ScalarField", "alias": null, @@ -1144,31 +1126,29 @@ v38 = [ }, v2 ], -v39 = { - "kind": "LinkedField", - "alias": "login", - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": v6 -}, -v40 = { +v37 = [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } +], +v38 = { "kind": "ScalarField", "alias": null, "name": "path", "args": null, "storageKey": null }, -v41 = { +v39 = { "kind": "ScalarField", "alias": null, "name": "position", "args": null, "storageKey": null }, -v42 = { +v40 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -1176,9 +1156,9 @@ v42 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v38 + "selections": v36 }, -v43 = { +v41 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -1193,7 +1173,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_2LgaQ1\n id\n }\n}\n\nfragment issueishDetailController_repository_2LgaQ1 on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_3CUNoW\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_3CUNoW on PullRequest {\n url\n reviews {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1245,6 +1225,18 @@ return { "variableName": "issueishNumber", "type": null }, + { + "kind": "Variable", + "name": "reviewCount", + "variableName": "reviewCount", + "type": null + }, + { + "kind": "Variable", + "name": "reviewCursor", + "variableName": "reviewCursor", + "type": null + }, { "kind": "Variable", "name": "timelineCount", @@ -1509,173 +1501,144 @@ return { "args": null, "storageKey": null }, + v14, { "kind": "LinkedField", "alias": null, - "name": "comments", + "name": "reviews", "storageKey": null, "args": null, - "concreteType": "IssueCommentConnection", - "plural": false, - "selections": v32 - }, - { - "kind": "LinkedField", - "alias": null, - "name": "reviews", - "storageKey": "reviews(first:100)", - "args": v35, "concreteType": "PullRequestReviewConnection", "plural": false, "selections": [ - v36, + v35, { "kind": "LinkedField", "alias": null, - "name": "nodes", + "name": "edges", "storageKey": null, "args": null, - "concreteType": "PullRequestReview", + "concreteType": "PullRequestReviewEdge", "plural": true, "selections": [ - v2, - v37, - { - "kind": "LinkedField", - "alias": "commitId", - "name": "commit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v38 - }, - v11, - { - "kind": "ScalarField", - "alias": null, - "name": "submittedAt", - "args": null, - "storageKey": null - }, - v39, + v21, { "kind": "LinkedField", "alias": null, - "name": "author", + "name": "node", "storageKey": null, "args": null, - "concreteType": null, + "concreteType": "PullRequestReview", "plural": false, "selections": [ - v4, - v13, - v2 - ] - }, - { - "kind": "LinkedField", - "alias": null, - "name": "comments", - "storageKey": "comments(first:100)", - "args": v35, - "concreteType": "PullRequestReviewCommentConnection", - "plural": false, - "selections": [ - v36, + v2, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "commitId", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v36 + }, + v11, + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "login", + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": v6 + }, { "kind": "LinkedField", "alias": null, - "name": "nodes", + "name": "author", "storageKey": null, "args": null, - "concreteType": "PullRequestReviewComment", - "plural": true, + "concreteType": null, + "plural": false, "selections": [ - { - "kind": "LinkedField", - "alias": "commitSha", - "name": "commit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v38 - }, - v2, - { - "kind": "ScalarField", - "alias": null, - "name": "databaseId", - "args": null, - "storageKey": null - }, - v39, - v26, - v37, - v12, - v40, - { - "kind": "LinkedField", - "alias": "pullRequestId", - "name": "pullRequest", - "storageKey": null, - "args": null, - "concreteType": "PullRequest", - "plural": false, - "selections": [ - v10, - v2 - ] - }, - { - "kind": "ScalarField", - "alias": null, - "name": "diffHunk", - "args": null, - "storageKey": null - }, - v41, - { - "kind": "ScalarField", - "alias": null, - "name": "originalPosition", - "args": null, - "storageKey": null - }, - { - "kind": "LinkedField", - "alias": "originalCommitId", - "name": "originalCommit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v38 - }, + v4, + v13, + v2 + ] + }, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": "comments(first:100)", + "args": v37, + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + v35, { "kind": "LinkedField", "alias": null, - "name": "replyTo", + "name": "nodes", "storageKey": null, "args": null, "concreteType": "PullRequestReviewComment", - "plural": false, + "plural": true, "selections": [ - v2 + v2, + v26, + v12, + v38, + v39, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v2 + ] + }, + v27, + v14 ] - }, - v27, - v14 + } ] - } + }, + v4 ] } ] } ] }, - v14, + { + "kind": "LinkedHandle", + "alias": null, + "name": "reviews", + "args": null, + "handle": "connection", + "key": "prReviewsContainer_reviews", + "filters": null + }, v10, { "kind": "LinkedField", @@ -1856,13 +1819,13 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v42, + v40, { "kind": "LinkedField", "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v35, + "args": v37, "concreteType": "CommitCommentConnection", "plural": false, "selections": [ @@ -1895,11 +1858,11 @@ return { "plural": false, "selections": v23 }, - v42, + v40, v12, v27, - v40, - v41 + v38, + v39 ] } ] @@ -1912,7 +1875,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v43, + v41, { "kind": "LinkedField", "alias": null, @@ -1921,7 +1884,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v38 + "selections": v36 }, { "kind": "LinkedField", @@ -1931,7 +1894,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v38 + "selections": v36 }, v27 ] @@ -1940,8 +1903,8 @@ return { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ - v43, - v42, + v41, + v40, { "kind": "ScalarField", "alias": null, @@ -1981,5 +1944,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'b749679230ad5e75455f1923ba78b425'; +(node/*: any*/).hash = 'e4903c4025a67651b3086652adb8aa06'; module.exports = node; diff --git a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js new file mode 100644 index 0000000000..8f1deb1224 --- /dev/null +++ b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js @@ -0,0 +1,503 @@ +/** + * @flow + * @relayHash dc9158ed713eb5e8c4c725dd4bfc9e00 + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteRequest } from 'relay-runtime'; +type prReviewsContainer_pullRequest$ref = any; +export type prReviewsContainerQueryVariables = {| + reviewCount?: ?number, + reviewCursor?: ?string, + url: any, +|}; +export type prReviewsContainerQueryResponse = {| + +resource: ?{| + +$fragmentRefs: prReviewsContainer_pullRequest$ref + |} +|}; +export type prReviewsContainerQuery = {| + variables: prReviewsContainerQueryVariables, + response: prReviewsContainerQueryResponse, +|}; +*/ + + +/* +query prReviewsContainerQuery( + $reviewCount: Int + $reviewCursor: String + $url: URI! +) { + resource(url: $url) { + __typename + ... on PullRequest { + ...prReviewsContainer_pullRequest_2zzc96 + } + ... on Node { + id + } + } +} + +fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { + url + reviews(first: $reviewCount, after: $reviewCursor) { + pageInfo { + hasNextPage + endCursor + } + edges { + cursor + node { + id + body + commitId: commit { + oid + id + } + state + submittedAt + login: author { + __typename + login + ... on Node { + id + } + } + author { + __typename + avatarUrl + ... on Node { + id + } + } + comments(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + author { + __typename + avatarUrl + login + ... on Node { + id + } + } + bodyHTML + path + position + replyTo { + id + } + createdAt + url + } + } + __typename + } + } + } +} +*/ + +const node/*: ConcreteRequest*/ = (function(){ +var v0 = [ + { + "kind": "LocalArgument", + "name": "reviewCount", + "type": "Int", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCursor", + "type": "String", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "url", + "type": "URI!", + "defaultValue": null + } +], +v1 = [ + { + "kind": "Variable", + "name": "url", + "variableName": "url", + "type": "URI!" + } +], +v2 = { + "kind": "ScalarField", + "alias": null, + "name": "__typename", + "args": null, + "storageKey": null +}, +v3 = { + "kind": "ScalarField", + "alias": null, + "name": "id", + "args": null, + "storageKey": null +}, +v4 = { + "kind": "ScalarField", + "alias": null, + "name": "url", + "args": null, + "storageKey": null +}, +v5 = [ + { + "kind": "Variable", + "name": "after", + "variableName": "reviewCursor", + "type": "String" + }, + { + "kind": "Variable", + "name": "first", + "variableName": "reviewCount", + "type": "Int" + } +], +v6 = { + "kind": "LinkedField", + "alias": null, + "name": "pageInfo", + "storageKey": null, + "args": null, + "concreteType": "PageInfo", + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "hasNextPage", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "endCursor", + "args": null, + "storageKey": null + } + ] +}, +v7 = { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null +}, +v8 = { + "kind": "ScalarField", + "alias": null, + "name": "avatarUrl", + "args": null, + "storageKey": null +}; +return { + "kind": "Request", + "operationKind": "query", + "name": "prReviewsContainerQuery", + "id": null, + "text": "query prReviewsContainerQuery(\n $reviewCount: Int\n $reviewCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_2zzc96\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n", + "metadata": {}, + "fragment": { + "kind": "Fragment", + "name": "prReviewsContainerQuery", + "type": "Query", + "metadata": null, + "argumentDefinitions": v0, + "selections": [ + { + "kind": "LinkedField", + "alias": null, + "name": "resource", + "storageKey": null, + "args": v1, + "concreteType": null, + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "type": "PullRequest", + "selections": [ + { + "kind": "FragmentSpread", + "name": "prReviewsContainer_pullRequest", + "args": [ + { + "kind": "Variable", + "name": "reviewCount", + "variableName": "reviewCount", + "type": null + }, + { + "kind": "Variable", + "name": "reviewCursor", + "variableName": "reviewCursor", + "type": null + } + ] + } + ] + } + ] + } + ] + }, + "operation": { + "kind": "Operation", + "name": "prReviewsContainerQuery", + "argumentDefinitions": v0, + "selections": [ + { + "kind": "LinkedField", + "alias": null, + "name": "resource", + "storageKey": null, + "args": v1, + "concreteType": null, + "plural": false, + "selections": [ + v2, + v3, + { + "kind": "InlineFragment", + "type": "PullRequest", + "selections": [ + v4, + { + "kind": "LinkedField", + "alias": null, + "name": "reviews", + "storageKey": null, + "args": v5, + "concreteType": "PullRequestReviewConnection", + "plural": false, + "selections": [ + v6, + { + "kind": "LinkedField", + "alias": null, + "name": "edges", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewEdge", + "plural": true, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "cursor", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "node", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReview", + "plural": false, + "selections": [ + v3, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "commitId", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "oid", + "args": null, + "storageKey": null + }, + v3 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "state", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "login", + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v2, + v7, + v3 + ] + }, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v2, + v8, + v3 + ] + }, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": "comments(first:100)", + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } + ], + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + v6, + { + "kind": "LinkedField", + "alias": null, + "name": "nodes", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": true, + "selections": [ + v3, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v2, + v8, + v7, + v3 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "bodyHTML", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "path", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "position", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v3 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "createdAt", + "args": null, + "storageKey": null + }, + v4 + ] + } + ] + }, + v2 + ] + } + ] + } + ] + }, + { + "kind": "LinkedHandle", + "alias": null, + "name": "reviews", + "args": v5, + "handle": "connection", + "key": "prReviewsContainer_reviews", + "filters": null + } + ] + } + ] + } + ] + } +}; +})(); +// prettier-ignore +(node/*: any*/).hash = '29e5b225e2d3999e4cd475edc354015d'; +module.exports = node; diff --git a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js new file mode 100644 index 0000000000..192298ed34 --- /dev/null +++ b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js @@ -0,0 +1,354 @@ +/** + * @flow + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteFragment } from 'relay-runtime'; +export type PullRequestReviewState = "APPROVED" | "CHANGES_REQUESTED" | "COMMENTED" | "DISMISSED" | "PENDING" | "%future added value"; +import type { FragmentReference } from "relay-runtime"; +declare export opaque type prReviewsContainer_pullRequest$ref: FragmentReference; +export type prReviewsContainer_pullRequest = {| + +url: any, + +reviews: ?{| + +pageInfo: {| + +hasNextPage: boolean, + +endCursor: ?string, + |}, + +edges: ?$ReadOnlyArray, + |}, + |}, + |}>, + |}, + +$refType: prReviewsContainer_pullRequest$ref, +|}; +*/ + + +const node/*: ConcreteFragment*/ = (function(){ +var v0 = { + "kind": "ScalarField", + "alias": null, + "name": "url", + "args": null, + "storageKey": null +}, +v1 = { + "kind": "LinkedField", + "alias": null, + "name": "pageInfo", + "storageKey": null, + "args": null, + "concreteType": "PageInfo", + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "hasNextPage", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "endCursor", + "args": null, + "storageKey": null + } + ] +}, +v2 = { + "kind": "ScalarField", + "alias": null, + "name": "id", + "args": null, + "storageKey": null +}, +v3 = { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null +}, +v4 = { + "kind": "ScalarField", + "alias": null, + "name": "avatarUrl", + "args": null, + "storageKey": null +}; +return { + "kind": "Fragment", + "name": "prReviewsContainer_pullRequest", + "type": "PullRequest", + "metadata": { + "connection": [ + { + "count": "reviewCount", + "cursor": "reviewCursor", + "direction": "forward", + "path": [ + "reviews" + ] + } + ] + }, + "argumentDefinitions": [ + { + "kind": "LocalArgument", + "name": "reviewCount", + "type": "Int", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCursor", + "type": "String", + "defaultValue": null + } + ], + "selections": [ + v0, + { + "kind": "LinkedField", + "alias": "reviews", + "name": "__prReviewsContainer_reviews_connection", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewConnection", + "plural": false, + "selections": [ + v1, + { + "kind": "LinkedField", + "alias": null, + "name": "edges", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewEdge", + "plural": true, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "cursor", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "node", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReview", + "plural": false, + "selections": [ + v2, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "commitId", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "oid", + "args": null, + "storageKey": null + } + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "state", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "login", + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v3 + ] + }, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v4 + ] + }, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": "comments(first:100)", + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } + ], + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + v1, + { + "kind": "LinkedField", + "alias": null, + "name": "nodes", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": true, + "selections": [ + v2, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v4, + v3 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "bodyHTML", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "path", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "position", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v2 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "createdAt", + "args": null, + "storageKey": null + }, + v0 + ] + } + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "__typename", + "args": null, + "storageKey": null + } + ] + } + ] + } + ] + } + ] +}; +})(); +// prettier-ignore +(node/*: any*/).hash = 'd22654576b18d8a49cff9628b69d7b17'; +module.exports = node; diff --git a/lib/containers/issueish-detail-container.js b/lib/containers/issueish-detail-container.js index 2f8a2e40f1..ecb33175e9 100644 --- a/lib/containers/issueish-detail-container.js +++ b/lib/containers/issueish-detail-container.js @@ -124,6 +124,8 @@ export default class IssueishDetailContainer extends React.Component { $commitCursor: String, $commentCount: Int!, $commentCursor: String, + $reviewCount: Int, + $reviewCursor: String, ) { repository(owner: $repoOwner, name: $repoName) { ...issueishDetailController_repository @arguments( @@ -134,6 +136,8 @@ export default class IssueishDetailContainer extends React.Component { commitCursor: $commitCursor, commentCount: $commentCount, commentCursor: $commentCursor, + reviewCount: $reviewCount, + reviewCursor: $reviewCursor, ) } } @@ -148,6 +152,8 @@ export default class IssueishDetailContainer extends React.Component { commitCursor: null, commentCount: 100, commentCursor: null, + reviewCount: 3, + reviewCursor: null, }; return ( diff --git a/lib/containers/pr-reviews-container.js b/lib/containers/pr-reviews-container.js new file mode 100644 index 0000000000..d4f6992ee6 --- /dev/null +++ b/lib/containers/pr-reviews-container.js @@ -0,0 +1,92 @@ +import {graphql, createPaginationContainer} from 'react-relay'; + +import PullRequestReviewsView from '../views/pr-comments-view'; + +export default createPaginationContainer(PullRequestReviewsView, { + pullRequest: graphql` + fragment prReviewsContainer_pullRequest on PullRequest + @argumentDefinitions( + reviewCount: {type: "Int"}, + reviewCursor: {type: "String"} + ) { + ... on PullRequest { + url + reviews(first: $reviewCount, after: $reviewCursor) @connection(key: "prReviewsContainer_reviews") { + pageInfo { + hasNextPage + endCursor + } + + edges { + cursor + node { + id + body + commitId: commit { + oid + } + state + submittedAt + login: author { + login + } + author { + avatarUrl + } + comments(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + author { + avatarUrl + login + } + bodyHTML + path + position + replyTo { + id + } + createdAt + url + } + } + } + } + } + } + } + `, +}, { + direction: 'forward', + getConnectionFromProps(props) { + console.log(props.pullRequest); + return props.pullRequest.reviews; + }, + getFragmentVariables(prevVars, totalCount) { + return { + ...prevVars, + reviewCount: totalCount, + }; + }, + getVariables(props, {count, cursor}, fragmentVariables) { + console.log(props.pullRequest); + return { + url: props.pullRequest.url, + reviewCount: count, + reviewCursor: cursor, + }; + }, + query: graphql` + query prReviewsContainerQuery($reviewCount: Int, $reviewCursor: String, $url: URI!) { + resource(url: $url) { + ... on PullRequest { + ...prReviewsContainer_pullRequest @arguments(reviewCount: $reviewCount, reviewCursor: $reviewCursor) + } + } + } + `, +}); diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index 34aff4255d..c82a1a5e27 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 83a0f29490df40e31d9f5aee5cdbae2f + * @relayHash b8344287c886583940c118565aa06547 */ /* eslint-disable */ @@ -20,6 +20,8 @@ export type prDetailViewRefetchQueryVariables = {| commitCursor?: ?string, commentCount: number, commentCursor?: ?string, + reviewCount?: ?number, + reviewCursor?: ?string, |}; export type prDetailViewRefetchQueryResponse = {| +repository: ?{| @@ -44,6 +46,8 @@ query prDetailViewRefetchQuery( $timelineCursor: String $commitCount: Int! $commitCursor: String + $reviewCount: Int + $reviewCursor: String ) { repository: node(id: $repoId) { __typename @@ -52,7 +56,7 @@ query prDetailViewRefetchQuery( } pullRequest: node(id: $issueishId) { __typename - ...prDetailView_pullRequest_1Etigl + ...prDetailView_pullRequest_2qM2KL id } } @@ -67,94 +71,14 @@ fragment prDetailView_repository_3D8CP9 on Repository { } } -fragment prDetailView_pullRequest_1Etigl on PullRequest { +fragment prDetailView_pullRequest_2qM2KL on PullRequest { __typename ... on Node { id } isCrossRepository changedFiles - comments { - totalCount - } - reviews(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - body - commitId: commit { - oid - id - } - state - submittedAt - login: author { - __typename - login - ... on Node { - id - } - } - author { - __typename - avatarUrl - ... on Node { - id - } - } - comments(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - pullRequestId: pullRequest { - number - id - } - databaseId - login: author { - __typename - login - ... on Node { - id - } - } - author { - __typename - avatarUrl - login - ... on Node { - id - } - } - body - bodyHTML - path - commitSha: commit { - oid - id - } - diffHunk - position - originalPosition - originalCommitId: originalCommit { - oid - id - } - replyTo { - id - } - createdAt - url - } - } - } - } + ...prReviewsContainer_pullRequest_2zzc96 ...prCommitsView_pullRequest_38TpXw countedCommits: commits { totalCount @@ -194,6 +118,69 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { } } +fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { + url + reviews(first: $reviewCount, after: $reviewCursor) { + pageInfo { + hasNextPage + endCursor + } + edges { + cursor + node { + id + body + commitId: commit { + oid + id + } + state + submittedAt + login: author { + __typename + login + ... on Node { + id + } + } + author { + __typename + avatarUrl + ... on Node { + id + } + } + comments(first: 100) { + pageInfo { + hasNextPage + endCursor + } + nodes { + id + author { + __typename + avatarUrl + login + ... on Node { + id + } + } + bodyHTML + path + position + replyTo { + id + } + createdAt + url + } + } + __typename + } + } + } +} + fragment prCommitsView_pullRequest_38TpXw on PullRequest { url commits(first: $commitCount, after: $commitCursor) { @@ -539,6 +526,18 @@ var v0 = [ "name": "commentCursor", "type": "String", "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCount", + "type": "Int", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCursor", + "type": "String", + "defaultValue": null } ], v1 = [ @@ -615,7 +614,7 @@ v10 = { v11 = { "kind": "ScalarField", "alias": null, - "name": "state", + "name": "number", "args": null, "storageKey": null }, @@ -626,20 +625,24 @@ v12 = { "args": null, "storageKey": null }, -v13 = [ - { - "kind": "ScalarField", - "alias": null, - "name": "totalCount", - "args": null, - "storageKey": null - } -], +v13 = { + "kind": "ScalarField", + "alias": null, + "name": "url", + "args": null, + "storageKey": null +}, v14 = [ { - "kind": "Literal", + "kind": "Variable", + "name": "after", + "variableName": "reviewCursor", + "type": "String" + }, + { + "kind": "Variable", "name": "first", - "value": 100, + "variableName": "reviewCount", "type": "Int" } ], @@ -673,7 +676,7 @@ v17 = { v18 = { "kind": "ScalarField", "alias": null, - "name": "body", + "name": "cursor", "args": null, "storageKey": null }, @@ -688,14 +691,11 @@ v19 = [ v6 ], v20 = { - "kind": "LinkedField", - "alias": "login", - "name": "author", - "storageKey": null, + "kind": "ScalarField", + "alias": null, + "name": "state", "args": null, - "concreteType": null, - "plural": false, - "selections": v9 + "storageKey": null }, v21 = { "kind": "ScalarField", @@ -705,12 +705,20 @@ v21 = { "storageKey": null }, v22 = [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } +], +v23 = [ v5, v21, v8, v6 ], -v23 = { +v24 = { "kind": "LinkedField", "alias": null, "name": "author", @@ -718,26 +726,19 @@ v23 = { "args": null, "concreteType": null, "plural": false, - "selections": v22 -}, -v24 = { - "kind": "ScalarField", - "alias": null, - "name": "bodyHTML", - "args": null, - "storageKey": null + "selections": v23 }, v25 = { "kind": "ScalarField", "alias": null, - "name": "path", + "name": "bodyHTML", "args": null, "storageKey": null }, v26 = { "kind": "ScalarField", "alias": null, - "name": "number", + "name": "path", "args": null, "storageKey": null }, @@ -755,14 +756,7 @@ v28 = { "args": null, "storageKey": null }, -v29 = { - "kind": "ScalarField", - "alias": null, - "name": "url", - "args": null, - "storageKey": null -}, -v30 = [ +v29 = [ { "kind": "Variable", "name": "after", @@ -776,7 +770,7 @@ v30 = [ "type": "Int" } ], -v31 = { +v30 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -789,31 +783,33 @@ v31 = { v15 ] }, -v32 = { - "kind": "ScalarField", - "alias": null, - "name": "cursor", - "args": null, - "storageKey": null -}, -v33 = { +v31 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v34 = { +v32 = [ + { + "kind": "ScalarField", + "alias": null, + "name": "totalCount", + "args": null, + "storageKey": null + } +], +v33 = { "kind": "ScalarField", "alias": null, "name": "title", "args": null, "storageKey": null }, -v35 = [ - v29 +v34 = [ + v13 ], -v36 = [ +v35 = [ { "kind": "Variable", "name": "after", @@ -827,13 +823,13 @@ v36 = [ "type": "Int" } ], -v37 = [ +v36 = [ v5, v8, v21, v6 ], -v38 = { +v37 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -843,7 +839,7 @@ v38 = { "plural": false, "selections": v19 }, -v39 = { +v38 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -851,9 +847,9 @@ v39 = { "args": null, "concreteType": null, "plural": false, - "selections": v22 + "selections": v23 }, -v40 = { +v39 = { "kind": "LinkedField", "alias": null, "name": "user", @@ -871,7 +867,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_1Etigl\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n comments {\n totalCount\n }\n reviews(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n pullRequestId: pullRequest {\n number\n id\n }\n databaseId\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n commitSha: commit {\n oid\n id\n }\n diffHunk\n position\n originalPosition\n originalCommitId: originalCommit {\n oid\n id\n }\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n }\n }\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -936,6 +932,18 @@ return { "variableName": "commitCursor", "type": null }, + { + "kind": "Variable", + "name": "reviewCount", + "variableName": "reviewCount", + "type": null + }, + { + "kind": "Variable", + "name": "reviewCursor", + "variableName": "reviewCursor", + "type": null + }, v2, v3 ] @@ -995,21 +1003,12 @@ return { "args": null, "storageKey": null }, - { - "kind": "LinkedField", - "alias": null, - "name": "comments", - "storageKey": null, - "args": null, - "concreteType": "IssueCommentConnection", - "plural": false, - "selections": v13 - }, + v13, { "kind": "LinkedField", "alias": null, "name": "reviews", - "storageKey": "reviews(first:100)", + "storageKey": null, "args": v14, "concreteType": "PullRequestReviewConnection", "plural": false, @@ -1018,160 +1017,140 @@ return { { "kind": "LinkedField", "alias": null, - "name": "nodes", + "name": "edges", "storageKey": null, "args": null, - "concreteType": "PullRequestReview", + "concreteType": "PullRequestReviewEdge", "plural": true, "selections": [ - v6, v18, - { - "kind": "LinkedField", - "alias": "commitId", - "name": "commit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v19 - }, - v11, - { - "kind": "ScalarField", - "alias": null, - "name": "submittedAt", - "args": null, - "storageKey": null - }, - v20, { "kind": "LinkedField", "alias": null, - "name": "author", + "name": "node", "storageKey": null, "args": null, - "concreteType": null, - "plural": false, - "selections": [ - v5, - v21, - v6 - ] - }, - { - "kind": "LinkedField", - "alias": null, - "name": "comments", - "storageKey": "comments(first:100)", - "args": v14, - "concreteType": "PullRequestReviewCommentConnection", + "concreteType": "PullRequestReview", "plural": false, "selections": [ - v17, + v6, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "commitId", + "name": "commit", + "storageKey": null, + "args": null, + "concreteType": "Commit", + "plural": false, + "selections": v19 + }, + v20, + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": "login", + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": v9 + }, { "kind": "LinkedField", "alias": null, - "name": "nodes", + "name": "author", "storageKey": null, "args": null, - "concreteType": "PullRequestReviewComment", - "plural": true, + "concreteType": null, + "plural": false, "selections": [ - { - "kind": "LinkedField", - "alias": "commitSha", - "name": "commit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v19 - }, - v6, - { - "kind": "ScalarField", - "alias": null, - "name": "databaseId", - "args": null, - "storageKey": null - }, - v20, - v23, - v18, - v24, - v25, - { - "kind": "LinkedField", - "alias": "pullRequestId", - "name": "pullRequest", - "storageKey": null, - "args": null, - "concreteType": "PullRequest", - "plural": false, - "selections": [ - v26, - v6 - ] - }, - { - "kind": "ScalarField", - "alias": null, - "name": "diffHunk", - "args": null, - "storageKey": null - }, - v27, - { - "kind": "ScalarField", - "alias": null, - "name": "originalPosition", - "args": null, - "storageKey": null - }, - { - "kind": "LinkedField", - "alias": "originalCommitId", - "name": "originalCommit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v19 - }, + v5, + v21, + v6 + ] + }, + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": "comments(first:100)", + "args": v22, + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + v17, { "kind": "LinkedField", "alias": null, - "name": "replyTo", + "name": "nodes", "storageKey": null, "args": null, "concreteType": "PullRequestReviewComment", - "plural": false, + "plural": true, "selections": [ - v6 + v6, + v24, + v25, + v26, + v27, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v6 + ] + }, + v28, + v13 ] - }, - v28, - v29 + } ] - } + }, + v5 ] } ] } ] }, - v29, + { + "kind": "LinkedHandle", + "alias": null, + "name": "reviews", + "args": v14, + "handle": "connection", + "key": "prReviewsContainer_reviews", + "filters": null + }, { "kind": "LinkedField", "alias": null, "name": "commits", "storageKey": null, - "args": v30, + "args": v29, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ - v31, + v30, { "kind": "LinkedField", "alias": null, @@ -1181,7 +1160,7 @@ return { "concreteType": "PullRequestCommitEdge", "plural": true, "selections": [ - v32, + v18, { "kind": "LinkedField", "alias": null, @@ -1242,8 +1221,8 @@ return { "args": null, "storageKey": null }, - v33, - v29 + v31, + v13 ] }, v6, @@ -1258,7 +1237,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v30, + "args": v29, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -1271,7 +1250,7 @@ return { "args": null, "concreteType": "PullRequestCommitConnection", "plural": false, - "selections": v13 + "selections": v32 }, { "kind": "LinkedField", @@ -1325,7 +1304,7 @@ return { "concreteType": "Status", "plural": false, "selections": [ - v11, + v20, { "kind": "LinkedField", "alias": null, @@ -1336,7 +1315,7 @@ return { "plural": true, "selections": [ v6, - v11, + v20, { "kind": "ScalarField", "alias": null, @@ -1373,9 +1352,9 @@ return { } ] }, - v26, - v34, - v24, + v20, + v33, + v25, { "kind": "ScalarField", "alias": null, @@ -1406,12 +1385,12 @@ return { { "kind": "InlineFragment", "type": "Bot", - "selections": v35 + "selections": v34 }, { "kind": "InlineFragment", "type": "User", - "selections": v35 + "selections": v34 } ] }, @@ -1443,11 +1422,11 @@ return { "alias": null, "name": "timeline", "storageKey": null, - "args": v36, + "args": v35, "concreteType": "PullRequestTimelineConnection", "plural": false, "selections": [ - v31, + v30, { "kind": "LinkedField", "alias": null, @@ -1457,7 +1436,7 @@ return { "concreteType": "PullRequestTimelineItemEdge", "plural": true, "selections": [ - v32, + v18, { "kind": "LinkedField", "alias": null, @@ -1489,7 +1468,7 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v37 + "selections": v36 }, { "kind": "LinkedField", @@ -1527,9 +1506,9 @@ return { "kind": "InlineFragment", "type": "PullRequest", "selections": [ - v26, - v34, - v29, + v11, + v33, + v13, { "kind": "ScalarField", "alias": "prState", @@ -1543,9 +1522,9 @@ return { "kind": "InlineFragment", "type": "Issue", "selections": [ - v26, - v34, - v29, + v11, + v33, + v13, { "kind": "ScalarField", "alias": "issueState", @@ -1563,13 +1542,13 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v38, + v37, { "kind": "LinkedField", "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v14, + "args": v22, "concreteType": "CommitCommentConnection", "plural": false, "selections": [ @@ -1600,12 +1579,12 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v37 + "selections": v36 }, - v38, - v24, - v28, + v37, v25, + v28, + v26, v27 ] } @@ -1619,7 +1598,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v39, + v38, { "kind": "LinkedField", "alias": null, @@ -1647,8 +1626,8 @@ return { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ - v39, v38, + v37, { "kind": "ScalarField", "alias": null, @@ -1663,10 +1642,10 @@ return { "kind": "InlineFragment", "type": "IssueComment", "selections": [ - v23, v24, + v25, v28, - v29 + v13 ] }, { @@ -1683,7 +1662,7 @@ return { "plural": false, "selections": [ v7, - v40, + v39, v21 ] }, @@ -1698,7 +1677,7 @@ return { "selections": [ v7, v21, - v40 + v39 ] }, { @@ -1708,7 +1687,7 @@ return { "args": null, "storageKey": null }, - v33, + v31, { "kind": "ScalarField", "alias": null, @@ -1742,7 +1721,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "timeline", - "args": v36, + "args": v35, "handle": "connection", "key": "prTimelineContainer_timeline", "filters": null @@ -1771,7 +1750,7 @@ return { "args": null, "concreteType": "ReactingUserConnection", "plural": false, - "selections": v13 + "selections": v32 } ] } @@ -1784,5 +1763,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'f928e12221da7ed9e70170512e98cbb2'; +(node/*: any*/).hash = '443d5e2812d4ab3aca1a33b1e95e1d14'; module.exports = node; diff --git a/lib/views/__generated__/prDetailView_pullRequest.graphql.js b/lib/views/__generated__/prDetailView_pullRequest.graphql.js index e98a5c4a5f..331dbe1566 100644 --- a/lib/views/__generated__/prDetailView_pullRequest.graphql.js +++ b/lib/views/__generated__/prDetailView_pullRequest.graphql.js @@ -9,9 +9,9 @@ /*:: import type { ConcreteFragment } from 'relay-runtime'; type prCommitsView_pullRequest$ref = any; +type prReviewsContainer_pullRequest$ref = any; type prStatusesView_pullRequest$ref = any; type prTimelineController_pullRequest$ref = any; -export type PullRequestReviewState = "APPROVED" | "CHANGES_REQUESTED" | "COMMENTED" | "DISMISSED" | "PENDING" | "%future added value"; export type PullRequestState = "CLOSED" | "MERGED" | "OPEN" | "%future added value"; export type ReactionContent = "CONFUSED" | "HEART" | "HOORAY" | "LAUGH" | "THUMBS_DOWN" | "THUMBS_UP" | "%future added value"; import type { FragmentReference } from "relay-runtime"; @@ -20,67 +20,6 @@ export type prDetailView_pullRequest = {| +id?: string, +isCrossRepository: boolean, +changedFiles: number, - +comments: {| - +totalCount: number - |}, - +reviews: ?{| - +pageInfo: {| - +hasNextPage: boolean, - +endCursor: ?string, - |}, - +nodes: ?$ReadOnlyArray, - |}, - |}>, - |}, +countedCommits: {| +totalCount: number |}, @@ -103,21 +42,14 @@ export type prDetailView_pullRequest = {| |}, |}>, +__typename: "PullRequest", - +$fragmentRefs: prCommitsView_pullRequest$ref & prStatusesView_pullRequest$ref & prTimelineController_pullRequest$ref, + +$fragmentRefs: prReviewsContainer_pullRequest$ref & prCommitsView_pullRequest$ref & prStatusesView_pullRequest$ref & prTimelineController_pullRequest$ref, +$refType: prDetailView_pullRequest$ref, |}; */ const node/*: ConcreteFragment*/ = (function(){ -var v0 = { - "kind": "ScalarField", - "alias": null, - "name": "state", - "args": null, - "storageKey": null -}, -v1 = [ +var v0 = [ { "kind": "ScalarField", "alias": null, @@ -126,111 +58,15 @@ v1 = [ "storageKey": null } ], -v2 = [ - { - "kind": "Literal", - "name": "first", - "value": 100, - "type": "Int" - } -], -v3 = { - "kind": "LinkedField", - "alias": null, - "name": "pageInfo", - "storageKey": null, - "args": null, - "concreteType": "PageInfo", - "plural": false, - "selections": [ - { - "kind": "ScalarField", - "alias": null, - "name": "hasNextPage", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "endCursor", - "args": null, - "storageKey": null - } - ] -}, -v4 = { - "kind": "ScalarField", - "alias": null, - "name": "id", - "args": null, - "storageKey": null -}, -v5 = { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null -}, -v6 = [ - { - "kind": "ScalarField", - "alias": null, - "name": "oid", - "args": null, - "storageKey": null - } -], -v7 = { - "kind": "ScalarField", - "alias": null, - "name": "login", - "args": null, - "storageKey": null -}, -v8 = { - "kind": "LinkedField", - "alias": "login", - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": [ - v7 - ] -}, -v9 = { - "kind": "ScalarField", - "alias": null, - "name": "avatarUrl", - "args": null, - "storageKey": null -}, -v10 = { - "kind": "ScalarField", - "alias": null, - "name": "bodyHTML", - "args": null, - "storageKey": null -}, -v11 = { - "kind": "ScalarField", - "alias": null, - "name": "number", - "args": null, - "storageKey": null -}, -v12 = { +v1 = { "kind": "ScalarField", "alias": null, "name": "url", "args": null, "storageKey": null }, -v13 = [ - v12 +v2 = [ + v1 ]; return { "kind": "Fragment", @@ -273,221 +109,64 @@ return { "name": "commentCursor", "type": "String", "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCount", + "type": "Int", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCursor", + "type": "String", + "defaultValue": null } ], "selections": [ - v0, { "kind": "ScalarField", "alias": null, - "name": "__typename", + "name": "number", "args": null, "storageKey": null }, { "kind": "ScalarField", "alias": null, - "name": "isCrossRepository", + "name": "__typename", "args": null, "storageKey": null }, { "kind": "ScalarField", "alias": null, - "name": "changedFiles", + "name": "isCrossRepository", "args": null, "storageKey": null }, { - "kind": "LinkedField", + "kind": "ScalarField", "alias": null, - "name": "comments", - "storageKey": null, + "name": "changedFiles", "args": null, - "concreteType": "IssueCommentConnection", - "plural": false, - "selections": v1 + "storageKey": null }, { - "kind": "LinkedField", - "alias": null, - "name": "reviews", - "storageKey": "reviews(first:100)", - "args": v2, - "concreteType": "PullRequestReviewConnection", - "plural": false, - "selections": [ - v3, + "kind": "FragmentSpread", + "name": "prReviewsContainer_pullRequest", + "args": [ { - "kind": "LinkedField", - "alias": null, - "name": "nodes", - "storageKey": null, - "args": null, - "concreteType": "PullRequestReview", - "plural": true, - "selections": [ - v4, - v5, - { - "kind": "LinkedField", - "alias": "commitId", - "name": "commit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v6 - }, - v0, - { - "kind": "ScalarField", - "alias": null, - "name": "submittedAt", - "args": null, - "storageKey": null - }, - v8, - { - "kind": "LinkedField", - "alias": null, - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": [ - v9 - ] - }, - { - "kind": "LinkedField", - "alias": null, - "name": "comments", - "storageKey": "comments(first:100)", - "args": v2, - "concreteType": "PullRequestReviewCommentConnection", - "plural": false, - "selections": [ - v3, - { - "kind": "LinkedField", - "alias": null, - "name": "nodes", - "storageKey": null, - "args": null, - "concreteType": "PullRequestReviewComment", - "plural": true, - "selections": [ - { - "kind": "LinkedField", - "alias": "commitSha", - "name": "commit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v6 - }, - v4, - { - "kind": "ScalarField", - "alias": null, - "name": "databaseId", - "args": null, - "storageKey": null - }, - v8, - { - "kind": "LinkedField", - "alias": null, - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": [ - v9, - v7 - ] - }, - v5, - v10, - { - "kind": "ScalarField", - "alias": null, - "name": "path", - "args": null, - "storageKey": null - }, - { - "kind": "LinkedField", - "alias": "pullRequestId", - "name": "pullRequest", - "storageKey": null, - "args": null, - "concreteType": "PullRequest", - "plural": false, - "selections": [ - v11 - ] - }, - { - "kind": "ScalarField", - "alias": null, - "name": "diffHunk", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "position", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "originalPosition", - "args": null, - "storageKey": null - }, - { - "kind": "LinkedField", - "alias": "originalCommitId", - "name": "originalCommit", - "storageKey": null, - "args": null, - "concreteType": "Commit", - "plural": false, - "selections": v6 - }, - { - "kind": "LinkedField", - "alias": null, - "name": "replyTo", - "storageKey": null, - "args": null, - "concreteType": "PullRequestReviewComment", - "plural": false, - "selections": [ - v4 - ] - }, - { - "kind": "ScalarField", - "alias": null, - "name": "createdAt", - "args": null, - "storageKey": null - }, - v12 - ] - } - ] - } - ] + "kind": "Variable", + "name": "reviewCount", + "variableName": "reviewCount", + "type": null + }, + { + "kind": "Variable", + "name": "reviewCursor", + "variableName": "reviewCursor", + "type": null } ] }, @@ -517,15 +196,27 @@ return { "args": null, "concreteType": "PullRequestCommitConnection", "plural": false, - "selections": v1 + "selections": v0 }, { "kind": "FragmentSpread", "name": "prStatusesView_pullRequest", "args": null }, - v4, - v11, + { + "kind": "ScalarField", + "alias": null, + "name": "state", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "id", + "args": null, + "storageKey": null + }, { "kind": "ScalarField", "alias": null, @@ -533,7 +224,13 @@ return { "args": null, "storageKey": null }, - v10, + { + "kind": "ScalarField", + "alias": null, + "name": "bodyHTML", + "args": null, + "storageKey": null + }, { "kind": "ScalarField", "alias": null, @@ -557,17 +254,29 @@ return { "concreteType": null, "plural": false, "selections": [ - v7, - v9, + { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "avatarUrl", + "args": null, + "storageKey": null + }, { "kind": "InlineFragment", "type": "Bot", - "selections": v13 + "selections": v2 }, { "kind": "InlineFragment", "type": "User", - "selections": v13 + "selections": v2 } ] }, @@ -589,7 +298,7 @@ return { } ] }, - v12, + v1, { "kind": "LinkedField", "alias": null, @@ -614,7 +323,7 @@ return { "args": null, "concreteType": "ReactingUserConnection", "plural": false, - "selections": v1 + "selections": v0 } ] } @@ -622,5 +331,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'ab20ccdc3ccc10843176a48cd07d03ae'; +(node/*: any*/).hash = 'e4e973dd4a21d8051d6908ff6844245a'; module.exports = node; diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 7768d9d5e1..c82b530b19 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -15,7 +15,7 @@ import Commands, {Command} from '../atom/commands'; import FilePatchHeaderView from './file-patch-header-view'; import FilePatchMetaView from './file-patch-meta-view'; import HunkHeaderView from './hunk-header-view'; -import PullRequestCommentsView from './pr-comments-view'; +import PullRequestsReviewsContainer from '../containers/pr-reviews-container'; import RefHolder from '../models/ref-holder'; import ChangedFileItem from '../items/changed-file-item'; import CommitDetailItem from '../items/commit-detail-item'; @@ -281,7 +281,7 @@ export default class MultiFilePatchView extends React.Component { /> )} - + {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} {this.renderLineDecorations( diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index a1beeb9d72..c58233785d 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -16,7 +16,7 @@ export default class PullRequestCommentsView extends React.Component { const commentsByRootCommentId = new Map(); - this.props.reviews.nodes.forEach(review => { + this.props.reviews.edges.forEach(review => { review.comments.nodes.forEach(comment => { if (!comment.replyTo) { commentsByRootCommentId.set(comment.id, [comment]); diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index 44560797bf..e87e40600a 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -351,6 +351,8 @@ export class BarePullRequestDetailView extends React.Component { timelineCursor: null, commitCount: 100, commitCursor: null, + reviewCount: 3, + reviewCursor: null, }, null, () => { this.setState({refreshing: false}); }, {force: true}); @@ -376,7 +378,9 @@ export default createRefetchContainer(BarePullRequestDetailView, { commitCount: {type: "Int!"}, commitCursor: {type: "String"}, commentCount: {type: "Int!"}, - commentCursor: {type: "String"} + commentCursor: {type: "String"}, + reviewCount: {type: "Int"}, + reviewCursor: {type: "String"} ) { __typename @@ -387,67 +391,9 @@ export default createRefetchContainer(BarePullRequestDetailView, { ... on PullRequest { isCrossRepository changedFiles - comments { - totalCount - } - reviews(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - body - commitId: commit { - oid - } - state - submittedAt - login: author { - login - } - author { - avatarUrl - } - comments(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - pullRequestId: pullRequest { - number - } - databaseId - login: author { - login - } - author { - avatarUrl - login - } - body - bodyHTML - path - commitSha: commit { - oid - } - diffHunk - position - originalPosition - originalCommitId: originalCommit { - oid - } - replyTo { - id - } - createdAt - url - } - } - } - } + + ...prReviewsContainer_pullRequest @arguments(reviewCount: $reviewCount, reviewCursor: $reviewCursor) + ...prCommitsView_pullRequest @arguments(commitCount: $commitCount, commitCursor: $commitCursor) countedCommits: commits { totalCount @@ -482,7 +428,9 @@ export default createRefetchContainer(BarePullRequestDetailView, { $commitCount: Int!, $commitCursor: String, $commentCount: Int!, - $commentCursor: String + $commentCursor: String, + $reviewCount: Int, + $reviewCursor: String ) { repository:node(id: $repoId) { ...prDetailView_repository @arguments( @@ -498,7 +446,9 @@ export default createRefetchContainer(BarePullRequestDetailView, { commitCount: $commitCount, commitCursor: $commitCursor, commentCount: $commentCount, - commentCursor: $commentCursor + commentCursor: $commentCursor, + reviewCount: $reviewCount, + reviewCursor: $reviewCursor ) } } From 498d5ab261b4ce13e1fa6af9903c0bee96dc92db Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 16:57:51 -0800 Subject: [PATCH 035/120] Got reviews rendering again Only redner PullRequestReviewsContainer if itemType is IssueishDetailItem Co-Authored-By: Tilde Ann Thurium --- .../issueishDetailContainerQuery.graphql.js | 80 ++++++++++-------- .../prReviewsContainerQuery.graphql.js | 4 +- .../prReviewsContainer_pullRequest.graphql.js | 4 +- lib/containers/pr-reviews-container.js | 81 +++++++++---------- ...eishDetailController_repository.graphql.js | 26 +++++- lib/controllers/issueish-detail-controller.js | 4 + .../prDetailViewRefetchQuery.graphql.js | 4 +- lib/views/multi-file-patch-view.js | 11 ++- lib/views/pr-comments-view.js | 20 ++++- lib/views/pr-detail-view.js | 3 +- 10 files changed, 153 insertions(+), 84 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index ea0f609242..19a08b76f5 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 615fe759e1fcacb3ed5561310f21f8ed + * @relayHash e6b8ab56b47c1e91cd699080eeb040fa */ /* eslint-disable */ @@ -44,6 +44,8 @@ query issueishDetailContainerQuery( $timelineCursor: String $commitCount: Int! $commitCursor: String + $reviewCount: Int + $reviewCursor: String ) { repository(owner: $repoOwner, name: $repoName) { ...issueishDetailController_repository_y3nHF @@ -88,7 +90,7 @@ fragment issueishDetailController_repository_y3nHF on Repository { sshUrl id } - ...prDetailView_pullRequest_1Etigl + ...prDetailView_pullRequest_2qM2KL } ... on Node { id @@ -153,14 +155,14 @@ fragment issueDetailView_issue_4cAEh0 on Issue { } } -fragment prDetailView_pullRequest_1Etigl on PullRequest { +fragment prDetailView_pullRequest_2qM2KL on PullRequest { __typename ... on Node { id } isCrossRepository changedFiles - ...prReviewsContainer_pullRequest_3CUNoW + ...prReviewsContainer_pullRequest_2zzc96 ...prCommitsView_pullRequest_38TpXw countedCommits: commits { totalCount @@ -200,9 +202,9 @@ fragment prDetailView_pullRequest_1Etigl on PullRequest { } } -fragment prReviewsContainer_pullRequest_3CUNoW on PullRequest { +fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { url - reviews { + reviews(first: $reviewCount, after: $reviewCursor) { pageInfo { hasNextPage endCursor @@ -1103,7 +1105,21 @@ v34 = [ "type": "Int" } ], -v35 = { +v35 = [ + { + "kind": "Variable", + "name": "after", + "variableName": "reviewCursor", + "type": "String" + }, + { + "kind": "Variable", + "name": "first", + "variableName": "reviewCount", + "type": "Int" + } +], +v36 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -1116,7 +1132,7 @@ v35 = { v18 ] }, -v36 = [ +v37 = [ { "kind": "ScalarField", "alias": null, @@ -1126,7 +1142,7 @@ v36 = [ }, v2 ], -v37 = [ +v38 = [ { "kind": "Literal", "name": "first", @@ -1134,21 +1150,21 @@ v37 = [ "type": "Int" } ], -v38 = { +v39 = { "kind": "ScalarField", "alias": null, "name": "path", "args": null, "storageKey": null }, -v39 = { +v40 = { "kind": "ScalarField", "alias": null, "name": "position", "args": null, "storageKey": null }, -v40 = { +v41 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -1156,9 +1172,9 @@ v40 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v36 + "selections": v37 }, -v41 = { +v42 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -1173,7 +1189,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_1Etigl\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_1Etigl on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_3CUNoW\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_3CUNoW on PullRequest {\n url\n reviews {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1507,11 +1523,11 @@ return { "alias": null, "name": "reviews", "storageKey": null, - "args": null, + "args": v35, "concreteType": "PullRequestReviewConnection", "plural": false, "selections": [ - v35, + v36, { "kind": "LinkedField", "alias": null, @@ -1547,7 +1563,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v36 + "selections": v37 }, v11, { @@ -1586,11 +1602,11 @@ return { "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v37, + "args": v38, "concreteType": "PullRequestReviewCommentConnection", "plural": false, "selections": [ - v35, + v36, { "kind": "LinkedField", "alias": null, @@ -1603,8 +1619,8 @@ return { v2, v26, v12, - v38, v39, + v40, { "kind": "LinkedField", "alias": null, @@ -1634,9 +1650,9 @@ return { "kind": "LinkedHandle", "alias": null, "name": "reviews", - "args": null, + "args": v35, "handle": "connection", - "key": "prReviewsContainer_reviews", + "key": "PrReviewsContainer_reviews", "filters": null }, v10, @@ -1819,13 +1835,13 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v40, + v41, { "kind": "LinkedField", "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v37, + "args": v38, "concreteType": "CommitCommentConnection", "plural": false, "selections": [ @@ -1858,11 +1874,11 @@ return { "plural": false, "selections": v23 }, - v40, + v41, v12, v27, - v38, - v39 + v39, + v40 ] } ] @@ -1875,7 +1891,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v41, + v42, { "kind": "LinkedField", "alias": null, @@ -1884,7 +1900,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v36 + "selections": v37 }, { "kind": "LinkedField", @@ -1894,7 +1910,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v36 + "selections": v37 }, v27 ] @@ -1903,8 +1919,8 @@ return { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ + v42, v41, - v40, { "kind": "ScalarField", "alias": null, diff --git a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js index 8f1deb1224..853f2b03ed 100644 --- a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash dc9158ed713eb5e8c4c725dd4bfc9e00 + * @relayHash 78ed01f06235641c5292e2ee9fab3f03 */ /* eslint-disable */ @@ -487,7 +487,7 @@ return { "name": "reviews", "args": v5, "handle": "connection", - "key": "prReviewsContainer_reviews", + "key": "PrReviewsContainer_reviews", "filters": null } ] diff --git a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js index 192298ed34..502c34a9b2 100644 --- a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js +++ b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js @@ -152,7 +152,7 @@ return { { "kind": "LinkedField", "alias": "reviews", - "name": "__prReviewsContainer_reviews_connection", + "name": "__PrReviewsContainer_reviews_connection", "storageKey": null, "args": null, "concreteType": "PullRequestReviewConnection", @@ -350,5 +350,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'd22654576b18d8a49cff9628b69d7b17'; +(node/*: any*/).hash = 'd9ac6d62742b887f30bdeac72bbafefb'; module.exports = node; diff --git a/lib/containers/pr-reviews-container.js b/lib/containers/pr-reviews-container.js index d4f6992ee6..7897d2544e 100644 --- a/lib/containers/pr-reviews-container.js +++ b/lib/containers/pr-reviews-container.js @@ -9,50 +9,51 @@ export default createPaginationContainer(PullRequestReviewsView, { reviewCount: {type: "Int"}, reviewCursor: {type: "String"} ) { - ... on PullRequest { - url - reviews(first: $reviewCount, after: $reviewCursor) @connection(key: "prReviewsContainer_reviews") { - pageInfo { - hasNextPage - endCursor - } + url + reviews( + first: $reviewCount, + after: $reviewCursor + ) @connection(key: "PrReviewsContainer_reviews") { + pageInfo { + hasNextPage + endCursor + } - edges { - cursor - node { - id - body - commitId: commit { - oid - } - state - submittedAt - login: author { - login - } - author { - avatarUrl + edges { + cursor + node { + id + body + commitId: commit { + oid + } + state + submittedAt + login: author { + login + } + author { + avatarUrl + } + comments(first: 100) { + pageInfo { + hasNextPage + endCursor } - comments(first: 100) { - pageInfo { - hasNextPage - endCursor + nodes { + id + author { + avatarUrl + login } - nodes { + bodyHTML + path + position + replyTo { id - author { - avatarUrl - login - } - bodyHTML - path - position - replyTo { - id - } - createdAt - url } + createdAt + url } } } @@ -63,7 +64,6 @@ export default createPaginationContainer(PullRequestReviewsView, { }, { direction: 'forward', getConnectionFromProps(props) { - console.log(props.pullRequest); return props.pullRequest.reviews; }, getFragmentVariables(prevVars, totalCount) { @@ -73,7 +73,6 @@ export default createPaginationContainer(PullRequestReviewsView, { }; }, getVariables(props, {count, cursor}, fragmentVariables) { - console.log(props.pullRequest); return { url: props.pullRequest.url, reviewCount: count, diff --git a/lib/controllers/__generated__/issueishDetailController_repository.graphql.js b/lib/controllers/__generated__/issueishDetailController_repository.graphql.js index 5f17d1be10..3c9b629202 100644 --- a/lib/controllers/__generated__/issueishDetailController_repository.graphql.js +++ b/lib/controllers/__generated__/issueishDetailController_repository.graphql.js @@ -180,6 +180,18 @@ return { "name": "commentCursor", "type": "String", "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCount", + "type": "Int!", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "reviewCursor", + "type": "String", + "defaultValue": null } ], "selections": [ @@ -293,6 +305,18 @@ return { }, v6, v7, + { + "kind": "Variable", + "name": "reviewCount", + "variableName": "reviewCount", + "type": null + }, + { + "kind": "Variable", + "name": "reviewCursor", + "variableName": "reviewCursor", + "type": null + }, v8, v9 ] @@ -305,5 +329,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '0a288c1ab2398af40de27baf5db2aacb'; +(node/*: any*/).hash = 'f24ee4210befb63664396cf05d2afa79'; module.exports = node; diff --git a/lib/controllers/issueish-detail-controller.js b/lib/controllers/issueish-detail-controller.js index ae8bc47bda..75ef71c32d 100644 --- a/lib/controllers/issueish-detail-controller.js +++ b/lib/controllers/issueish-detail-controller.js @@ -299,6 +299,8 @@ export default createFragmentContainer(BareIssueishDetailController, { commitCursor: {type: "String"}, commentCount: {type: "Int!"}, commentCursor: {type: "String"}, + reviewCount: {type: "Int!"}, + reviewCursor: {type: "String"}, ) { ...issueDetailView_repository ...prDetailView_repository @@ -340,6 +342,8 @@ export default createFragmentContainer(BareIssueishDetailController, { commitCursor: $commitCursor, commentCount: $commentCount, commentCursor: $commentCursor, + reviewCount: $reviewCount, + reviewCursor: $reviewCursor, ) } } diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index c82a1a5e27..538e2cf4d6 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash b8344287c886583940c118565aa06547 + * @relayHash e7fd1c7c963c648913576e5f8a5f07d4 */ /* eslint-disable */ @@ -1138,7 +1138,7 @@ return { "name": "reviews", "args": v14, "handle": "connection", - "key": "prReviewsContainer_reviews", + "key": "PrReviewsContainer_reviews", "filters": null }, { diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index c82b530b19..7296aee04d 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -281,7 +281,8 @@ export default class MultiFilePatchView extends React.Component { /> )} - + {this.renderPullRequestReviews()} + {this.props.multiFilePatch.getFilePatches().map(this.renderFilePatchDecorations)} {this.renderLineDecorations( @@ -310,6 +311,14 @@ export default class MultiFilePatchView extends React.Component { ); } + renderPullRequestReviews() { + if (this.props.itemType === IssueishDetailItem) { + return ; + } else { + return null; + } + } + renderFilePatchDecorations = filePatch => { return ( diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index c58233785d..7ebf7294fc 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {Point, Range} from 'atom'; +import {RelayConnectionPropType} from '../prop-types'; import {toNativePathSep} from '../helpers'; import Marker from '../atom/marker'; @@ -9,14 +10,29 @@ import GithubDotcomMarkdown from './github-dotcom-markdown'; import Timeago from './timeago'; export default class PullRequestCommentsView extends React.Component { + static propTypes = { + relay: PropTypes.shape({ + hasMore: PropTypes.func.isRequired, + loadMore: PropTypes.func.isRequired, + isLoading: PropTypes.func.isRequired, + }).isRequired, + pullRequest: PropTypes.shape({ + reviews: RelayConnectionPropType( + PropTypes.object, + ), + }), + multiFilePatch: PropTypes.object.isRequired, + } + render() { - if (!this.props.reviews) { + if (!this.props.pullRequest || !this.props.pullRequest.reviews) { return null; } const commentsByRootCommentId = new Map(); - this.props.reviews.edges.forEach(review => { + this.props.pullRequest.reviews.edges.forEach(({node}) => { + const review = node; review.comments.nodes.forEach(comment => { if (!comment.replyTo) { commentsByRootCommentId.set(comment.id, [comment]); diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index e87e40600a..1abd62b92d 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -209,8 +209,9 @@ export class BarePullRequestDetailView extends React.Component { destroy={this.props.destroy} shouldRefetch={this.state.refreshing} - reviews={this.props.pullRequest.reviews} switchToIssueish={this.props.switchToIssueish} + + pullRequest={this.props.pullRequest} /> From 5ac1f5566778a0adb1215a86d935989099504617 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 17:51:41 -0800 Subject: [PATCH 036/120] Fetch all reviews --- .../issueishDetailContainerQuery.graphql.js | 59 ++++--- .../prReviewsContainerQuery.graphql.js | 29 +-- .../prReviewsContainer_pullRequest.graphql.js | 29 +-- lib/containers/issueish-detail-container.js | 2 +- lib/containers/pr-reviews-container.js | 1 + .../prDetailViewRefetchQuery.graphql.js | 167 +++++++++--------- lib/views/pr-comments-view.js | 49 ++++- 7 files changed, 192 insertions(+), 144 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 19a08b76f5..2005783ec7 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash e6b8ab56b47c1e91cd699080eeb040fa + * @relayHash eacb91752813910cc6e618d90f821447 */ /* eslint-disable */ @@ -249,6 +249,7 @@ fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { id } } + body bodyHTML path position @@ -1132,7 +1133,14 @@ v36 = { v18 ] }, -v37 = [ +v37 = { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null +}, +v38 = [ { "kind": "ScalarField", "alias": null, @@ -1142,7 +1150,7 @@ v37 = [ }, v2 ], -v38 = [ +v39 = [ { "kind": "Literal", "name": "first", @@ -1150,21 +1158,21 @@ v38 = [ "type": "Int" } ], -v39 = { +v40 = { "kind": "ScalarField", "alias": null, "name": "path", "args": null, "storageKey": null }, -v40 = { +v41 = { "kind": "ScalarField", "alias": null, "name": "position", "args": null, "storageKey": null }, -v41 = { +v42 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -1172,9 +1180,9 @@ v41 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, -v42 = { +v43 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -1189,7 +1197,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1548,13 +1556,7 @@ return { "plural": false, "selections": [ v2, - { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null - }, + v37, { "kind": "LinkedField", "alias": "commitId", @@ -1563,7 +1565,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, v11, { @@ -1602,7 +1604,7 @@ return { "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v38, + "args": v39, "concreteType": "PullRequestReviewCommentConnection", "plural": false, "selections": [ @@ -1618,9 +1620,10 @@ return { "selections": [ v2, v26, + v37, v12, - v39, v40, + v41, { "kind": "LinkedField", "alias": null, @@ -1835,13 +1838,13 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v41, + v42, { "kind": "LinkedField", "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v38, + "args": v39, "concreteType": "CommitCommentConnection", "plural": false, "selections": [ @@ -1874,11 +1877,11 @@ return { "plural": false, "selections": v23 }, - v41, + v42, v12, v27, - v39, - v40 + v40, + v41 ] } ] @@ -1891,7 +1894,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v42, + v43, { "kind": "LinkedField", "alias": null, @@ -1900,7 +1903,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, { "kind": "LinkedField", @@ -1910,7 +1913,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v37 + "selections": v38 }, v27 ] @@ -1919,8 +1922,8 @@ return { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ + v43, v42, - v41, { "kind": "ScalarField", "alias": null, diff --git a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js index 853f2b03ed..e6ee421cf3 100644 --- a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 78ed01f06235641c5292e2ee9fab3f03 + * @relayHash c79a1d774a35cceb455839a0124e28fc */ /* eslint-disable */ @@ -91,6 +91,7 @@ fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { id } } + body bodyHTML path position @@ -200,11 +201,18 @@ v6 = { v7 = { "kind": "ScalarField", "alias": null, - "name": "login", + "name": "body", "args": null, "storageKey": null }, v8 = { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null +}, +v9 = { "kind": "ScalarField", "alias": null, "name": "avatarUrl", @@ -216,7 +224,7 @@ return { "operationKind": "query", "name": "prReviewsContainerQuery", "id": null, - "text": "query prReviewsContainerQuery(\n $reviewCount: Int\n $reviewCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_2zzc96\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewsContainerQuery(\n $reviewCount: Int\n $reviewCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_2zzc96\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -319,13 +327,7 @@ return { "plural": false, "selections": [ v3, - { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null - }, + v7, { "kind": "LinkedField", "alias": "commitId", @@ -369,7 +371,7 @@ return { "plural": false, "selections": [ v2, - v7, + v8, v3 ] }, @@ -383,7 +385,7 @@ return { "plural": false, "selections": [ v2, - v8, + v9, v3 ] }, @@ -424,11 +426,12 @@ return { "plural": false, "selections": [ v2, + v9, v8, - v7, v3 ] }, + v7, { "kind": "ScalarField", "alias": null, diff --git a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js index 502c34a9b2..cd27865199 100644 --- a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js +++ b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js @@ -45,6 +45,7 @@ export type prReviewsContainer_pullRequest = {| +avatarUrl: any, +login: string, |}, + +body: string, +bodyHTML: any, +path: string, +position: ?number, @@ -106,11 +107,18 @@ v2 = { v3 = { "kind": "ScalarField", "alias": null, - "name": "login", + "name": "body", "args": null, "storageKey": null }, v4 = { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null +}, +v5 = { "kind": "ScalarField", "alias": null, "name": "avatarUrl", @@ -185,13 +193,7 @@ return { "plural": false, "selections": [ v2, - { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null - }, + v3, { "kind": "LinkedField", "alias": "commitId", @@ -233,7 +235,7 @@ return { "concreteType": null, "plural": false, "selections": [ - v3 + v4 ] }, { @@ -245,7 +247,7 @@ return { "concreteType": null, "plural": false, "selections": [ - v4 + v5 ] }, { @@ -284,10 +286,11 @@ return { "concreteType": null, "plural": false, "selections": [ - v4, - v3 + v5, + v4 ] }, + v3, { "kind": "ScalarField", "alias": null, @@ -350,5 +353,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'd9ac6d62742b887f30bdeac72bbafefb'; +(node/*: any*/).hash = 'd234d1f47b1a977b18174045b21cf0f0'; module.exports = node; diff --git a/lib/containers/issueish-detail-container.js b/lib/containers/issueish-detail-container.js index ecb33175e9..33e2404fbe 100644 --- a/lib/containers/issueish-detail-container.js +++ b/lib/containers/issueish-detail-container.js @@ -152,7 +152,7 @@ export default class IssueishDetailContainer extends React.Component { commitCursor: null, commentCount: 100, commentCursor: null, - reviewCount: 3, + reviewCount: 1, reviewCursor: null, }; diff --git a/lib/containers/pr-reviews-container.js b/lib/containers/pr-reviews-container.js index 7897d2544e..f90e50e1c2 100644 --- a/lib/containers/pr-reviews-container.js +++ b/lib/containers/pr-reviews-container.js @@ -46,6 +46,7 @@ export default createPaginationContainer(PullRequestReviewsView, { avatarUrl login } + body bodyHTML path position diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index 538e2cf4d6..fe380438d1 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash e7fd1c7c963c648913576e5f8a5f07d4 + * @relayHash 8b5005b08f8393c1b2d22577e9530360 */ /* eslint-disable */ @@ -165,6 +165,7 @@ fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { id } } + body bodyHTML path position @@ -680,7 +681,14 @@ v18 = { "args": null, "storageKey": null }, -v19 = [ +v19 = { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null +}, +v20 = [ { "kind": "ScalarField", "alias": null, @@ -690,21 +698,21 @@ v19 = [ }, v6 ], -v20 = { +v21 = { "kind": "ScalarField", "alias": null, "name": "state", "args": null, "storageKey": null }, -v21 = { +v22 = { "kind": "ScalarField", "alias": null, "name": "avatarUrl", "args": null, "storageKey": null }, -v22 = [ +v23 = [ { "kind": "Literal", "name": "first", @@ -712,13 +720,13 @@ v22 = [ "type": "Int" } ], -v23 = [ +v24 = [ v5, - v21, + v22, v8, v6 ], -v24 = { +v25 = { "kind": "LinkedField", "alias": null, "name": "author", @@ -726,37 +734,37 @@ v24 = { "args": null, "concreteType": null, "plural": false, - "selections": v23 + "selections": v24 }, -v25 = { +v26 = { "kind": "ScalarField", "alias": null, "name": "bodyHTML", "args": null, "storageKey": null }, -v26 = { +v27 = { "kind": "ScalarField", "alias": null, "name": "path", "args": null, "storageKey": null }, -v27 = { +v28 = { "kind": "ScalarField", "alias": null, "name": "position", "args": null, "storageKey": null }, -v28 = { +v29 = { "kind": "ScalarField", "alias": null, "name": "createdAt", "args": null, "storageKey": null }, -v29 = [ +v30 = [ { "kind": "Variable", "name": "after", @@ -770,7 +778,7 @@ v29 = [ "type": "Int" } ], -v30 = { +v31 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -783,14 +791,14 @@ v30 = { v15 ] }, -v31 = { +v32 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v32 = [ +v33 = [ { "kind": "ScalarField", "alias": null, @@ -799,17 +807,17 @@ v32 = [ "storageKey": null } ], -v33 = { +v34 = { "kind": "ScalarField", "alias": null, "name": "title", "args": null, "storageKey": null }, -v34 = [ +v35 = [ v13 ], -v35 = [ +v36 = [ { "kind": "Variable", "name": "after", @@ -823,13 +831,13 @@ v35 = [ "type": "Int" } ], -v36 = [ +v37 = [ v5, v8, - v21, + v22, v6 ], -v37 = { +v38 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -837,9 +845,9 @@ v37 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v19 + "selections": v20 }, -v38 = { +v39 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -847,9 +855,9 @@ v38 = { "args": null, "concreteType": null, "plural": false, - "selections": v23 + "selections": v24 }, -v39 = { +v40 = { "kind": "LinkedField", "alias": null, "name": "user", @@ -867,7 +875,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1034,13 +1042,7 @@ return { "plural": false, "selections": [ v6, - { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null - }, + v19, { "kind": "LinkedField", "alias": "commitId", @@ -1049,9 +1051,9 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v19 + "selections": v20 }, - v20, + v21, { "kind": "ScalarField", "alias": null, @@ -1079,7 +1081,7 @@ return { "plural": false, "selections": [ v5, - v21, + v22, v6 ] }, @@ -1088,7 +1090,7 @@ return { "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v22, + "args": v23, "concreteType": "PullRequestReviewCommentConnection", "plural": false, "selections": [ @@ -1103,10 +1105,11 @@ return { "plural": true, "selections": [ v6, - v24, v25, + v19, v26, v27, + v28, { "kind": "LinkedField", "alias": null, @@ -1119,7 +1122,7 @@ return { v6 ] }, - v28, + v29, v13 ] } @@ -1146,11 +1149,11 @@ return { "alias": null, "name": "commits", "storageKey": null, - "args": v29, + "args": v30, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ - v30, + v31, { "kind": "LinkedField", "alias": null, @@ -1189,7 +1192,7 @@ return { "concreteType": "GitActor", "plural": false, "selections": [ - v21, + v22, v7, { "kind": "ScalarField", @@ -1221,7 +1224,7 @@ return { "args": null, "storageKey": null }, - v31, + v32, v13 ] }, @@ -1237,7 +1240,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v29, + "args": v30, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -1250,7 +1253,7 @@ return { "args": null, "concreteType": "PullRequestCommitConnection", "plural": false, - "selections": v32 + "selections": v33 }, { "kind": "LinkedField", @@ -1304,7 +1307,7 @@ return { "concreteType": "Status", "plural": false, "selections": [ - v20, + v21, { "kind": "LinkedField", "alias": null, @@ -1315,7 +1318,7 @@ return { "plural": true, "selections": [ v6, - v20, + v21, { "kind": "ScalarField", "alias": null, @@ -1352,9 +1355,9 @@ return { } ] }, - v20, - v33, - v25, + v21, + v34, + v26, { "kind": "ScalarField", "alias": null, @@ -1380,17 +1383,17 @@ return { "selections": [ v5, v8, - v21, + v22, v6, { "kind": "InlineFragment", "type": "Bot", - "selections": v34 + "selections": v35 }, { "kind": "InlineFragment", "type": "User", - "selections": v34 + "selections": v35 } ] }, @@ -1422,11 +1425,11 @@ return { "alias": null, "name": "timeline", "storageKey": null, - "args": v35, + "args": v36, "concreteType": "PullRequestTimelineConnection", "plural": false, "selections": [ - v30, + v31, { "kind": "LinkedField", "alias": null, @@ -1468,7 +1471,7 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v36 + "selections": v37 }, { "kind": "LinkedField", @@ -1507,7 +1510,7 @@ return { "type": "PullRequest", "selections": [ v11, - v33, + v34, v13, { "kind": "ScalarField", @@ -1523,7 +1526,7 @@ return { "type": "Issue", "selections": [ v11, - v33, + v34, v13, { "kind": "ScalarField", @@ -1542,13 +1545,13 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v37, + v38, { "kind": "LinkedField", "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v22, + "args": v23, "concreteType": "CommitCommentConnection", "plural": false, "selections": [ @@ -1579,13 +1582,13 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v36 + "selections": v37 }, - v37, - v25, - v28, + v38, v26, - v27 + v29, + v27, + v28 ] } ] @@ -1598,7 +1601,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v38, + v39, { "kind": "LinkedField", "alias": null, @@ -1607,7 +1610,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v19 + "selections": v20 }, { "kind": "LinkedField", @@ -1617,17 +1620,17 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v19 + "selections": v20 }, - v28 + v29 ] }, { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ + v39, v38, - v37, { "kind": "ScalarField", "alias": null, @@ -1635,16 +1638,16 @@ return { "args": null, "storageKey": null }, - v28 + v29 ] }, { "kind": "InlineFragment", "type": "IssueComment", "selections": [ - v24, v25, - v28, + v26, + v29, v13 ] }, @@ -1662,8 +1665,8 @@ return { "plural": false, "selections": [ v7, - v39, - v21 + v40, + v22 ] }, { @@ -1676,8 +1679,8 @@ return { "plural": false, "selections": [ v7, - v21, - v39 + v22, + v40 ] }, { @@ -1687,7 +1690,7 @@ return { "args": null, "storageKey": null }, - v31, + v32, { "kind": "ScalarField", "alias": null, @@ -1721,7 +1724,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "timeline", - "args": v35, + "args": v36, "handle": "connection", "key": "prTimelineContainer_timeline", "filters": null @@ -1750,7 +1753,7 @@ return { "args": null, "concreteType": "ReactingUserConnection", "plural": false, - "selections": v32 + "selections": v33 } ] } diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index 7ebf7294fc..bd2369f41f 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -24,6 +24,37 @@ export default class PullRequestCommentsView extends React.Component { multiFilePatch: PropTypes.object.isRequired, } + componentDidMount() { + console.log('DID MOUNT'); + this._attemptToLoadMoreReviews(); + } + + _loadMoreReviews = () => { + this.props.relay.loadMore( + 1, // Fetch the next 10 feed items + error => { + this._attemptToLoadMoreReviews(); + if (error) { + console.log(error); + } + }, + ); + } + + _attemptToLoadMoreReviews = () => { + if (!this.props.relay.hasMore()) { + return; + } + + if (this.props.relay.isLoading()) { + setTimeout(() => { + this._loadMoreReviews(); + }, 300); + } else { + this._loadMoreReviews(); + } + } + render() { if (!this.props.pullRequest || !this.props.pullRequest.reviews) { return null; @@ -42,6 +73,7 @@ export default class PullRequestCommentsView extends React.Component { }); }); + console.log('SIZE', commentsByRootCommentId.size, [...commentsByRootCommentId]); return [...commentsByRootCommentId].reverse().map(([rootCommentId, comments]) => { const rootComment = comments[0]; @@ -56,13 +88,16 @@ export default class PullRequestCommentsView extends React.Component { return ( - {comments.map(comment => - , - )} + {comments.map(comment => { + console.log(comment.body); + return ( + + ); + })} ); From 38efd85cf03f8605eedec56de8952db197885fe1 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 17:52:08 -0800 Subject: [PATCH 037/120] Hack to get comments to show up in correct order. TODO: fixme --- lib/views/pr-comments-view.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index bd2369f41f..b0b5eebbb3 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -9,6 +9,8 @@ import Decoration from '../atom/decoration'; import GithubDotcomMarkdown from './github-dotcom-markdown'; import Timeago from './timeago'; +let count = 0; + export default class PullRequestCommentsView extends React.Component { static propTypes = { relay: PropTypes.shape({ @@ -86,7 +88,7 @@ export default class PullRequestCommentsView extends React.Component { const point = new Point(row, 0); const range = new Range(point, point); return ( - + {comments.map(comment => { console.log(comment.body); From e4abb3c121f1ca7ae4887110b1482d2fe631c45b Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 18:10:13 -0800 Subject: [PATCH 038/120] Fetch 100 review items at a time --- lib/containers/issueish-detail-container.js | 2 +- lib/views/pr-comments-view.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/containers/issueish-detail-container.js b/lib/containers/issueish-detail-container.js index 33e2404fbe..ee83411112 100644 --- a/lib/containers/issueish-detail-container.js +++ b/lib/containers/issueish-detail-container.js @@ -152,7 +152,7 @@ export default class IssueishDetailContainer extends React.Component { commitCursor: null, commentCount: 100, commentCursor: null, - reviewCount: 1, + reviewCount: 100, reviewCursor: null, }; diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index b0b5eebbb3..d269797d1f 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -33,7 +33,7 @@ export default class PullRequestCommentsView extends React.Component { _loadMoreReviews = () => { this.props.relay.loadMore( - 1, // Fetch the next 10 feed items + 100, error => { this._attemptToLoadMoreReviews(); if (error) { From 60c413a339127619f09afbaed959c1f2216db59b Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 18:14:44 -0800 Subject: [PATCH 039/120] Handle case then `replyTo` comment is outdated --- lib/views/pr-comments-view.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index d269797d1f..c1d7922f2e 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -70,7 +70,15 @@ export default class PullRequestCommentsView extends React.Component { if (!comment.replyTo) { commentsByRootCommentId.set(comment.id, [comment]); } else { - commentsByRootCommentId.get(comment.replyTo.id).push(comment); + // When comment being replied to is outdated... + // Ran into this error when viewing files for https://github.com/numpy/numpy/pull/9998 + // for comment MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MzA1NTUzMw, + // who's replyTo comment is an outdated comment + if (!commentsByRootCommentId.get(comment.replyTo.id)) { + commentsByRootCommentId.set(comment.replyTo.id, [comment]); + } else { + commentsByRootCommentId.get(comment.replyTo.id).push(comment); + } } }); }); From 929115f14a1249e7fb91b48c67662dd8ae6e064e Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 18:17:44 -0800 Subject: [PATCH 040/120] Add TODO to inline to fix hack to get comments to show up in order --- lib/views/pr-comments-view.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index c1d7922f2e..8624c1f159 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -95,6 +95,8 @@ export default class PullRequestCommentsView extends React.Component { const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, rootComment.position); const point = new Point(row, 0); const range = new Range(point, point); + // TODO: find way to re-use nodes by using same key. this count++ hack is in place to get the comments to show up + // in the correct order after new pages of data are fetched. Test it by reducing the reviewCount to a small number return ( From 130f862105d3388f0220e6b8b679399aa27d1349 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Thu, 27 Dec 2018 18:33:12 -0800 Subject: [PATCH 041/120] =?UTF-8?q?Make=20it=20clear=20in=20the=20comment?= =?UTF-8?q?=20that=20I'm=20not=20100%=20sure=20=C2=AF\=5F(=E3=83=84)=5F/?= =?UTF-8?q?=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/views/pr-comments-view.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index 8624c1f159..c0755edce2 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -70,7 +70,8 @@ export default class PullRequestCommentsView extends React.Component { if (!comment.replyTo) { commentsByRootCommentId.set(comment.id, [comment]); } else { - // When comment being replied to is outdated... + // When comment being replied to is outdated...?? Not 100% sure... + // Why would we even get an outdated comment or a response to one here? // Ran into this error when viewing files for https://github.com/numpy/numpy/pull/9998 // for comment MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MzA1NTUzMw, // who's replyTo comment is an outdated comment From cbca7804f0a32180fce8ec1247d70a612a54d6f7 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 11:29:56 -0800 Subject: [PATCH 042/120] WIP handle comments pagination Co-Authored-By: Tilde Ann Thurium --- .../pr-review-comments-container.js | 71 +++++++++++++++++++ lib/containers/pr-reviews-container.js | 30 ++------ lib/controllers/pr-reviews-controller.js | 60 ++++++++++++++++ 3 files changed, 137 insertions(+), 24 deletions(-) create mode 100644 lib/containers/pr-review-comments-container.js create mode 100644 lib/controllers/pr-reviews-controller.js diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js new file mode 100644 index 0000000000..ae23b3dca4 --- /dev/null +++ b/lib/containers/pr-review-comments-container.js @@ -0,0 +1,71 @@ +import {graphql, createPaginationContainer} from 'react-relay'; + +import PullRequestReviewCommentsView from '../views/pr-comments-view'; + +export default createPaginationContainer(PullRequestReviewCommentsView, { + review: graphql` + fragment prReviewCommentsContainer_review on PullRequestReview + @argumentDefinitions( + commentCount: {type: "Int!"}, + commentCursor: {type: "String"} + ) { + url + comments( + first: $commentCount, + after: $commentCursor + ) @connection(key: "PrReviewCommentsContainer_comments") { + pageInfo { + hasNextPage + endCursor + } + + edges { + cursor + node { + id + author { + avatarUrl + login + } + body + bodyHTML + path + position + replyTo { + id + } + createdAt + url + } + } + } + } + `, +}, { + direction: 'forward', + getConnectionFromProps(props) { + return props.review.comments; + }, + getFragmentVariables(prevVars, totalCount) { + return { + ...prevVars, + commentCount: totalCount, + }; + }, + getVariables(props, {count, cursor}, fragmentVariables) { + return { + url: props.review.url, + commentCount: count, + commentCursor: cursor, + }; + }, + query: graphql` + query prReviewCommentsContainerQuery($commentCount: Int, $commentCursor: String, $url: URI!) { + resource(url: $url) { + ... on PullRequestReview { + ...prReviewCommentsContainer_review @arguments(commentCount: $commentCount, commentCursor: $commentCursor) + } + } + } + `, +}); diff --git a/lib/containers/pr-reviews-container.js b/lib/containers/pr-reviews-container.js index f90e50e1c2..d57cd3a553 100644 --- a/lib/containers/pr-reviews-container.js +++ b/lib/containers/pr-reviews-container.js @@ -1,8 +1,8 @@ import {graphql, createPaginationContainer} from 'react-relay'; -import PullRequestReviewsView from '../views/pr-comments-view'; +import PullRequestReviewsController from '../controller/pr-reviews-controller'; -export default createPaginationContainer(PullRequestReviewsView, { +export default createPaginationContainer(PullRequestReviewsController, { pullRequest: graphql` fragment prReviewsContainer_pullRequest on PullRequest @argumentDefinitions( @@ -35,28 +35,10 @@ export default createPaginationContainer(PullRequestReviewsView, { author { avatarUrl } - comments(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - author { - avatarUrl - login - } - body - bodyHTML - path - position - replyTo { - id - } - createdAt - url - } - } + ...prReviewCommentsContainer_review @arguments( + commentCount: $commentCount, + commentCursor: $commentCursor + ) } } } diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js new file mode 100644 index 0000000000..a5b20a3882 --- /dev/null +++ b/lib/controllers/pr-reviews-controller.js @@ -0,0 +1,60 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {RelayConnectionPropType} from '../prop-types'; + +import PullRequestReviewCommentsContainer from '../containers/pr-review-comments-container'; + + +export default class PullRequestReviewsController extends React.Component { + static propTypes = { + relay: PropTypes.shape({ + hasMore: PropTypes.func.isRequired, + loadMore: PropTypes.func.isRequired, + isLoading: PropTypes.func.isRequired, + }).isRequired, + pullRequest: PropTypes.shape({ + reviews: RelayConnectionPropType( + PropTypes.object, + ), + }), + multiFilePatch: PropTypes.object.isRequired, + } + + componentDidMount() { + this._attemptToLoadMoreReviews(); + } + + _loadMoreReviews = () => { + this.props.relay.loadMore( + 100, + error => { + this._attemptToLoadMoreReviews(); + if (error) { + console.log(error); + } + }, + ); + } + + _attemptToLoadMoreReviews = () => { + if (!this.props.relay.hasMore()) { + return; + } + + if (this.props.relay.isLoading()) { + setTimeout(() => { + this._loadMoreReviews(); + }, 300); + } else { + this._loadMoreReviews(); + } + } + + render() { + if (!this.props.pullRequest || !this.props.pullRequest.reviews) { + return null; + } + + return ; + } +} From 2c239ac42722be9fb89a95eaa0c40a314d59d6ed Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 28 Dec 2018 13:18:44 -0800 Subject: [PATCH 043/120] wip - render paginated comments Co-Authored-By: Katrina Uychaco --- .../issueishDetailContainerQuery.graphql.js | 136 ++++--- .../prReviewCommentsContainerQuery.graphql.js | 375 ++++++++++++++++++ ...rReviewCommentsContainer_review.graphql.js | 242 +++++++++++ .../prReviewsContainerQuery.graphql.js | 233 ++++++----- .../prReviewsContainer_pullRequest.graphql.js | 256 ++++-------- .../pr-review-comments-container.js | 13 +- lib/containers/pr-reviews-container.js | 2 +- lib/controllers/pr-reviews-controller.js | 9 +- .../prDetailViewRefetchQuery.graphql.js | 136 ++++--- lib/views/pr-comments-view.js | 9 +- 10 files changed, 1044 insertions(+), 367 deletions(-) create mode 100644 lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js create mode 100644 lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 2005783ec7..85536bb239 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash eacb91752813910cc6e618d90f821447 + * @relayHash 2272e39d4e33d96fe66954cf4a808caa */ /* eslint-disable */ @@ -44,6 +44,8 @@ query issueishDetailContainerQuery( $timelineCursor: String $commitCount: Int! $commitCursor: String + $commentCount: Int! + $commentCursor: String $reviewCount: Int $reviewCursor: String ) { @@ -234,32 +236,7 @@ fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { id } } - comments(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - author { - __typename - avatarUrl - login - ... on Node { - id - } - } - body - bodyHTML - path - position - replyTo { - id - } - createdAt - url - } - } + ...prReviewCommentsContainer_review_1VbUmL __typename } } @@ -561,6 +538,40 @@ fragment prCommitView_item on Commit { url } +fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { + id + comments(first: $commentCount, after: $commentCursor) { + pageInfo { + hasNextPage + endCursor + } + edges { + cursor + node { + id + author { + __typename + avatarUrl + login + ... on Node { + id + } + } + body + bodyHTML + path + position + replyTo { + id + } + createdAt + url + __typename + } + } + } +} + fragment issueTimelineController_issue_3D8CP9 on Issue { url timeline(first: $timelineCount, after: $timelineCursor) { @@ -1152,9 +1163,15 @@ v38 = [ ], v39 = [ { - "kind": "Literal", + "kind": "Variable", + "name": "after", + "variableName": "commentCursor", + "type": "String" + }, + { + "kind": "Variable", "name": "first", - "value": 100, + "variableName": "commentCount", "type": "Int" } ], @@ -1197,7 +1214,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $commentCount: Int!\n $commentCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1603,7 +1620,7 @@ return { "kind": "LinkedField", "alias": null, "name": "comments", - "storageKey": "comments(first:100)", + "storageKey": null, "args": v39, "concreteType": "PullRequestReviewCommentConnection", "plural": false, @@ -1612,36 +1629,58 @@ return { { "kind": "LinkedField", "alias": null, - "name": "nodes", + "name": "edges", "storageKey": null, "args": null, - "concreteType": "PullRequestReviewComment", + "concreteType": "PullRequestReviewCommentEdge", "plural": true, "selections": [ - v2, - v26, - v37, - v12, - v40, - v41, + v21, { "kind": "LinkedField", "alias": null, - "name": "replyTo", + "name": "node", "storageKey": null, "args": null, "concreteType": "PullRequestReviewComment", "plural": false, "selections": [ - v2 + v2, + v26, + v37, + v12, + v40, + v41, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v2 + ] + }, + v27, + v14, + v4 ] - }, - v27, - v14 + } ] } ] }, + { + "kind": "LinkedHandle", + "alias": null, + "name": "comments", + "args": v39, + "handle": "connection", + "key": "PrReviewCommentsContainer_comments", + "filters": null + }, v4 ] } @@ -1844,7 +1883,14 @@ return { "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v39, + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } + ], "concreteType": "CommitCommentConnection", "plural": false, "selections": [ diff --git a/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js new file mode 100644 index 0000000000..dc46be1e33 --- /dev/null +++ b/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js @@ -0,0 +1,375 @@ +/** + * @flow + * @relayHash 5658256f086fc990e6f8c58966b65c77 + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteRequest } from 'relay-runtime'; +type prReviewCommentsContainer_review$ref = any; +export type prReviewCommentsContainerQueryVariables = {| + commentCount: number, + commentCursor?: ?string, + id: string, +|}; +export type prReviewCommentsContainerQueryResponse = {| + +node: ?{| + +$fragmentRefs: prReviewCommentsContainer_review$ref + |} +|}; +export type prReviewCommentsContainerQuery = {| + variables: prReviewCommentsContainerQueryVariables, + response: prReviewCommentsContainerQueryResponse, +|}; +*/ + + +/* +query prReviewCommentsContainerQuery( + $commentCount: Int! + $commentCursor: String + $id: ID! +) { + node(id: $id) { + __typename + ... on PullRequestReview { + ...prReviewCommentsContainer_review_1VbUmL + } + id + } +} + +fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { + id + comments(first: $commentCount, after: $commentCursor) { + pageInfo { + hasNextPage + endCursor + } + edges { + cursor + node { + id + author { + __typename + avatarUrl + login + ... on Node { + id + } + } + body + bodyHTML + path + position + replyTo { + id + } + createdAt + url + __typename + } + } + } +} +*/ + +const node/*: ConcreteRequest*/ = (function(){ +var v0 = [ + { + "kind": "LocalArgument", + "name": "commentCount", + "type": "Int!", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCursor", + "type": "String", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "id", + "type": "ID!", + "defaultValue": null + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "id", + "type": "ID!" + } +], +v2 = { + "kind": "ScalarField", + "alias": null, + "name": "__typename", + "args": null, + "storageKey": null +}, +v3 = { + "kind": "ScalarField", + "alias": null, + "name": "id", + "args": null, + "storageKey": null +}, +v4 = [ + { + "kind": "Variable", + "name": "after", + "variableName": "commentCursor", + "type": "String" + }, + { + "kind": "Variable", + "name": "first", + "variableName": "commentCount", + "type": "Int" + } +]; +return { + "kind": "Request", + "operationKind": "query", + "name": "prReviewCommentsContainerQuery", + "id": null, + "text": "query prReviewCommentsContainerQuery(\n $commentCount: Int!\n $commentCursor: String\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on PullRequestReview {\n ...prReviewCommentsContainer_review_1VbUmL\n }\n id\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "metadata": {}, + "fragment": { + "kind": "Fragment", + "name": "prReviewCommentsContainerQuery", + "type": "Query", + "metadata": null, + "argumentDefinitions": v0, + "selections": [ + { + "kind": "LinkedField", + "alias": null, + "name": "node", + "storageKey": null, + "args": v1, + "concreteType": null, + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "type": "PullRequestReview", + "selections": [ + { + "kind": "FragmentSpread", + "name": "prReviewCommentsContainer_review", + "args": [ + { + "kind": "Variable", + "name": "commentCount", + "variableName": "commentCount", + "type": null + }, + { + "kind": "Variable", + "name": "commentCursor", + "variableName": "commentCursor", + "type": null + } + ] + } + ] + } + ] + } + ] + }, + "operation": { + "kind": "Operation", + "name": "prReviewCommentsContainerQuery", + "argumentDefinitions": v0, + "selections": [ + { + "kind": "LinkedField", + "alias": null, + "name": "node", + "storageKey": null, + "args": v1, + "concreteType": null, + "plural": false, + "selections": [ + v2, + v3, + { + "kind": "InlineFragment", + "type": "PullRequestReview", + "selections": [ + { + "kind": "LinkedField", + "alias": null, + "name": "comments", + "storageKey": null, + "args": v4, + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + { + "kind": "LinkedField", + "alias": null, + "name": "pageInfo", + "storageKey": null, + "args": null, + "concreteType": "PageInfo", + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "hasNextPage", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "endCursor", + "args": null, + "storageKey": null + } + ] + }, + { + "kind": "LinkedField", + "alias": null, + "name": "edges", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewCommentEdge", + "plural": true, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "cursor", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "node", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v3, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v2, + { + "kind": "ScalarField", + "alias": null, + "name": "avatarUrl", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null + }, + v3 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "bodyHTML", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "path", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "position", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v3 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "createdAt", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "url", + "args": null, + "storageKey": null + }, + v2 + ] + } + ] + } + ] + }, + { + "kind": "LinkedHandle", + "alias": null, + "name": "comments", + "args": v4, + "handle": "connection", + "key": "PrReviewCommentsContainer_comments", + "filters": null + } + ] + } + ] + } + ] + } +}; +})(); +// prettier-ignore +(node/*: any*/).hash = 'd48507a6296f84357e94000010c34713'; +module.exports = node; diff --git a/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js b/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js new file mode 100644 index 0000000000..5a674efbcc --- /dev/null +++ b/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js @@ -0,0 +1,242 @@ +/** + * @flow + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteFragment } from 'relay-runtime'; +import type { FragmentReference } from "relay-runtime"; +declare export opaque type prReviewCommentsContainer_review$ref: FragmentReference; +export type prReviewCommentsContainer_review = {| + +id: string, + +comments: {| + +pageInfo: {| + +hasNextPage: boolean, + +endCursor: ?string, + |}, + +edges: ?$ReadOnlyArray, + |}, + +$refType: prReviewCommentsContainer_review$ref, +|}; +*/ + + +const node/*: ConcreteFragment*/ = (function(){ +var v0 = { + "kind": "ScalarField", + "alias": null, + "name": "id", + "args": null, + "storageKey": null +}; +return { + "kind": "Fragment", + "name": "prReviewCommentsContainer_review", + "type": "PullRequestReview", + "metadata": { + "connection": [ + { + "count": "commentCount", + "cursor": "commentCursor", + "direction": "forward", + "path": [ + "comments" + ] + } + ] + }, + "argumentDefinitions": [ + { + "kind": "LocalArgument", + "name": "commentCount", + "type": "Int!", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCursor", + "type": "String", + "defaultValue": null + } + ], + "selections": [ + v0, + { + "kind": "LinkedField", + "alias": "comments", + "name": "__PrReviewCommentsContainer_comments_connection", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewCommentConnection", + "plural": false, + "selections": [ + { + "kind": "LinkedField", + "alias": null, + "name": "pageInfo", + "storageKey": null, + "args": null, + "concreteType": "PageInfo", + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "hasNextPage", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "endCursor", + "args": null, + "storageKey": null + } + ] + }, + { + "kind": "LinkedField", + "alias": null, + "name": "edges", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewCommentEdge", + "plural": true, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "cursor", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "node", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v0, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "avatarUrl", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null + } + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "bodyHTML", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "path", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "position", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v0 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "createdAt", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "url", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "__typename", + "args": null, + "storageKey": null + } + ] + } + ] + } + ] + } + ] +}; +})(); +// prettier-ignore +(node/*: any*/).hash = 'd4b785b8fc4e5b4bedc5aa92491f37e7'; +module.exports = node; diff --git a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js index e6ee421cf3..aac991e4b6 100644 --- a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash c79a1d774a35cceb455839a0124e28fc + * @relayHash f0d1b6fd1bbccab16bb6901bb25f4120 */ /* eslint-disable */ @@ -76,32 +76,41 @@ fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { id } } - comments(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { + ...prReviewCommentsContainer_review_1VbUmL + __typename + } + } + } +} + +fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { + id + comments(first: $commentCount, after: $commentCursor) { + pageInfo { + hasNextPage + endCursor + } + edges { + cursor + node { + id + author { + __typename + avatarUrl + login + ... on Node { id - author { - __typename - avatarUrl - login - ... on Node { - id - } - } - body - bodyHTML - path - position - replyTo { - id - } - createdAt - url } } + body + bodyHTML + path + position + replyTo { + id + } + createdAt + url __typename } } @@ -201,30 +210,51 @@ v6 = { v7 = { "kind": "ScalarField", "alias": null, - "name": "body", + "name": "cursor", "args": null, "storageKey": null }, v8 = { "kind": "ScalarField", "alias": null, - "name": "login", + "name": "body", "args": null, "storageKey": null }, v9 = { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null +}, +v10 = { "kind": "ScalarField", "alias": null, "name": "avatarUrl", "args": null, "storageKey": null -}; +}, +v11 = [ + { + "kind": "Variable", + "name": "after", + "variableName": "commentCursor", + "type": "String" + }, + { + "kind": "Variable", + "name": "first", + "variableName": "commentCount", + "type": "Int" + } +]; return { "kind": "Request", "operationKind": "query", "name": "prReviewsContainerQuery", "id": null, - "text": "query prReviewsContainerQuery(\n $reviewCount: Int\n $reviewCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_2zzc96\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewsContainerQuery(\n $reviewCount: Int\n $reviewCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_2zzc96\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -310,13 +340,7 @@ return { "concreteType": "PullRequestReviewEdge", "plural": true, "selections": [ - { - "kind": "ScalarField", - "alias": null, - "name": "cursor", - "args": null, - "storageKey": null - }, + v7, { "kind": "LinkedField", "alias": null, @@ -327,7 +351,7 @@ return { "plural": false, "selections": [ v3, - v7, + v8, { "kind": "LinkedField", "alias": "commitId", @@ -371,7 +395,7 @@ return { "plural": false, "selections": [ v2, - v8, + v9, v3 ] }, @@ -385,7 +409,7 @@ return { "plural": false, "selections": [ v2, - v9, + v10, v3 ] }, @@ -393,15 +417,8 @@ return { "kind": "LinkedField", "alias": null, "name": "comments", - "storageKey": "comments(first:100)", - "args": [ - { - "kind": "Literal", - "name": "first", - "value": 100, - "type": "Int" - } - ], + "storageKey": null, + "args": v11, "concreteType": "PullRequestReviewCommentConnection", "plural": false, "selections": [ @@ -409,74 +426,96 @@ return { { "kind": "LinkedField", "alias": null, - "name": "nodes", + "name": "edges", "storageKey": null, "args": null, - "concreteType": "PullRequestReviewComment", + "concreteType": "PullRequestReviewCommentEdge", "plural": true, "selections": [ - v3, - { - "kind": "LinkedField", - "alias": null, - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": [ - v2, - v9, - v8, - v3 - ] - }, v7, - { - "kind": "ScalarField", - "alias": null, - "name": "bodyHTML", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "path", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "position", - "args": null, - "storageKey": null - }, { "kind": "LinkedField", "alias": null, - "name": "replyTo", + "name": "node", "storageKey": null, "args": null, "concreteType": "PullRequestReviewComment", "plural": false, "selections": [ - v3 + v3, + { + "kind": "LinkedField", + "alias": null, + "name": "author", + "storageKey": null, + "args": null, + "concreteType": null, + "plural": false, + "selections": [ + v2, + v10, + v9, + v3 + ] + }, + v8, + { + "kind": "ScalarField", + "alias": null, + "name": "bodyHTML", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "path", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "position", + "args": null, + "storageKey": null + }, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v3 + ] + }, + { + "kind": "ScalarField", + "alias": null, + "name": "createdAt", + "args": null, + "storageKey": null + }, + v4, + v2 ] - }, - { - "kind": "ScalarField", - "alias": null, - "name": "createdAt", - "args": null, - "storageKey": null - }, - v4 + } ] } ] }, + { + "kind": "LinkedHandle", + "alias": null, + "name": "comments", + "args": v11, + "handle": "connection", + "key": "PrReviewCommentsContainer_comments", + "filters": null + }, v2 ] } diff --git a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js index cd27865199..5145f6f6ec 100644 --- a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js +++ b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js @@ -8,6 +8,7 @@ /*:: import type { ConcreteFragment } from 'relay-runtime'; +type prReviewCommentsContainer_review$ref = any; export type PullRequestReviewState = "APPROVED" | "CHANGES_REQUESTED" | "COMMENTED" | "DISMISSED" | "PENDING" | "%future added value"; import type { FragmentReference } from "relay-runtime"; declare export opaque type prReviewsContainer_pullRequest$ref: FragmentReference; @@ -34,28 +35,7 @@ export type prReviewsContainer_pullRequest = {| +author: ?{| +avatarUrl: any |}, - +comments: {| - +pageInfo: {| - +hasNextPage: boolean, - +endCursor: ?string, - |}, - +nodes: ?$ReadOnlyArray, - |}, + +$fragmentRefs: prReviewCommentsContainer_review$ref, |}, |}>, |}, @@ -64,68 +44,7 @@ export type prReviewsContainer_pullRequest = {| */ -const node/*: ConcreteFragment*/ = (function(){ -var v0 = { - "kind": "ScalarField", - "alias": null, - "name": "url", - "args": null, - "storageKey": null -}, -v1 = { - "kind": "LinkedField", - "alias": null, - "name": "pageInfo", - "storageKey": null, - "args": null, - "concreteType": "PageInfo", - "plural": false, - "selections": [ - { - "kind": "ScalarField", - "alias": null, - "name": "hasNextPage", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "endCursor", - "args": null, - "storageKey": null - } - ] -}, -v2 = { - "kind": "ScalarField", - "alias": null, - "name": "id", - "args": null, - "storageKey": null -}, -v3 = { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null -}, -v4 = { - "kind": "ScalarField", - "alias": null, - "name": "login", - "args": null, - "storageKey": null -}, -v5 = { - "kind": "ScalarField", - "alias": null, - "name": "avatarUrl", - "args": null, - "storageKey": null -}; -return { +const node/*: ConcreteFragment*/ = { "kind": "Fragment", "name": "prReviewsContainer_pullRequest", "type": "PullRequest", @@ -153,10 +72,26 @@ return { "name": "reviewCursor", "type": "String", "defaultValue": null + }, + { + "kind": "RootArgument", + "name": "commentCount", + "type": null + }, + { + "kind": "RootArgument", + "name": "commentCursor", + "type": null } ], "selections": [ - v0, + { + "kind": "ScalarField", + "alias": null, + "name": "url", + "args": null, + "storageKey": null + }, { "kind": "LinkedField", "alias": "reviews", @@ -166,7 +101,31 @@ return { "concreteType": "PullRequestReviewConnection", "plural": false, "selections": [ - v1, + { + "kind": "LinkedField", + "alias": null, + "name": "pageInfo", + "storageKey": null, + "args": null, + "concreteType": "PageInfo", + "plural": false, + "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "hasNextPage", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "endCursor", + "args": null, + "storageKey": null + } + ] + }, { "kind": "LinkedField", "alias": null, @@ -192,8 +151,20 @@ return { "concreteType": "PullRequestReview", "plural": false, "selections": [ - v2, - v3, + { + "kind": "ScalarField", + "alias": null, + "name": "id", + "args": null, + "storageKey": null + }, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, { "kind": "LinkedField", "alias": "commitId", @@ -235,7 +206,13 @@ return { "concreteType": null, "plural": false, "selections": [ - v4 + { + "kind": "ScalarField", + "alias": null, + "name": "login", + "args": null, + "storageKey": null + } ] }, { @@ -247,92 +224,30 @@ return { "concreteType": null, "plural": false, "selections": [ - v5 + { + "kind": "ScalarField", + "alias": null, + "name": "avatarUrl", + "args": null, + "storageKey": null + } ] }, { - "kind": "LinkedField", - "alias": null, - "name": "comments", - "storageKey": "comments(first:100)", + "kind": "FragmentSpread", + "name": "prReviewCommentsContainer_review", "args": [ { - "kind": "Literal", - "name": "first", - "value": 100, - "type": "Int" - } - ], - "concreteType": "PullRequestReviewCommentConnection", - "plural": false, - "selections": [ - v1, + "kind": "Variable", + "name": "commentCount", + "variableName": "commentCount", + "type": null + }, { - "kind": "LinkedField", - "alias": null, - "name": "nodes", - "storageKey": null, - "args": null, - "concreteType": "PullRequestReviewComment", - "plural": true, - "selections": [ - v2, - { - "kind": "LinkedField", - "alias": null, - "name": "author", - "storageKey": null, - "args": null, - "concreteType": null, - "plural": false, - "selections": [ - v5, - v4 - ] - }, - v3, - { - "kind": "ScalarField", - "alias": null, - "name": "bodyHTML", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "path", - "args": null, - "storageKey": null - }, - { - "kind": "ScalarField", - "alias": null, - "name": "position", - "args": null, - "storageKey": null - }, - { - "kind": "LinkedField", - "alias": null, - "name": "replyTo", - "storageKey": null, - "args": null, - "concreteType": "PullRequestReviewComment", - "plural": false, - "selections": [ - v2 - ] - }, - { - "kind": "ScalarField", - "alias": null, - "name": "createdAt", - "args": null, - "storageKey": null - }, - v0 - ] + "kind": "Variable", + "name": "commentCursor", + "variableName": "commentCursor", + "type": null } ] }, @@ -351,7 +266,6 @@ return { } ] }; -})(); // prettier-ignore -(node/*: any*/).hash = 'd234d1f47b1a977b18174045b21cf0f0'; +(node/*: any*/).hash = '4d74fc25f4b854782495fc05521f961c'; module.exports = node; diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index ae23b3dca4..3caeb9f408 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -9,7 +9,7 @@ export default createPaginationContainer(PullRequestReviewCommentsView, { commentCount: {type: "Int!"}, commentCursor: {type: "String"} ) { - url + id comments( first: $commentCount, after: $commentCursor @@ -54,16 +54,19 @@ export default createPaginationContainer(PullRequestReviewCommentsView, { }, getVariables(props, {count, cursor}, fragmentVariables) { return { - url: props.review.url, + id: props.review.id, commentCount: count, commentCursor: cursor, }; }, query: graphql` - query prReviewCommentsContainerQuery($commentCount: Int, $commentCursor: String, $url: URI!) { - resource(url: $url) { + query prReviewCommentsContainerQuery($commentCount: Int!, $commentCursor: String, $id: ID!) { + node(id: $id) { ... on PullRequestReview { - ...prReviewCommentsContainer_review @arguments(commentCount: $commentCount, commentCursor: $commentCursor) + ...prReviewCommentsContainer_review @arguments( + commentCount: $commentCount, + commentCursor: $commentCursor + ) } } } diff --git a/lib/containers/pr-reviews-container.js b/lib/containers/pr-reviews-container.js index d57cd3a553..8de768a770 100644 --- a/lib/containers/pr-reviews-container.js +++ b/lib/containers/pr-reviews-container.js @@ -1,6 +1,6 @@ import {graphql, createPaginationContainer} from 'react-relay'; -import PullRequestReviewsController from '../controller/pr-reviews-controller'; +import PullRequestReviewsController from '../controllers/pr-reviews-controller'; export default createPaginationContainer(PullRequestReviewsController, { pullRequest: graphql` diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index a5b20a3882..e744234186 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -55,6 +55,13 @@ export default class PullRequestReviewsController extends React.Component { return null; } - return ; + return this.props.pullRequest.reviews.forEach.map(({node}) => { + const review = node; + const reviewProp = this.props.reviews.find(r => r.id === review.id) + reviewProp.comments = review.comments; + return ( + + ); + }); } } diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index fe380438d1..15337e8fdb 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 8b5005b08f8393c1b2d22577e9530360 + * @relayHash e23a0a2054c2cff16dfe71a64cf4fe9f */ /* eslint-disable */ @@ -46,6 +46,8 @@ query prDetailViewRefetchQuery( $timelineCursor: String $commitCount: Int! $commitCursor: String + $commentCount: Int! + $commentCursor: String $reviewCount: Int $reviewCursor: String ) { @@ -150,32 +152,7 @@ fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { id } } - comments(first: 100) { - pageInfo { - hasNextPage - endCursor - } - nodes { - id - author { - __typename - avatarUrl - login - ... on Node { - id - } - } - body - bodyHTML - path - position - replyTo { - id - } - createdAt - url - } - } + ...prReviewCommentsContainer_review_1VbUmL __typename } } @@ -476,6 +453,40 @@ fragment prCommitView_item on Commit { sha: oid url } + +fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { + id + comments(first: $commentCount, after: $commentCursor) { + pageInfo { + hasNextPage + endCursor + } + edges { + cursor + node { + id + author { + __typename + avatarUrl + login + ... on Node { + id + } + } + body + bodyHTML + path + position + replyTo { + id + } + createdAt + url + __typename + } + } + } +} */ const node/*: ConcreteRequest*/ = (function(){ @@ -714,9 +725,15 @@ v22 = { }, v23 = [ { - "kind": "Literal", + "kind": "Variable", + "name": "after", + "variableName": "commentCursor", + "type": "String" + }, + { + "kind": "Variable", "name": "first", - "value": 100, + "variableName": "commentCount", "type": "Int" } ], @@ -875,7 +892,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n comments(first: 100) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n }\n }\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $commentCount: Int!\n $commentCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1089,7 +1106,7 @@ return { "kind": "LinkedField", "alias": null, "name": "comments", - "storageKey": "comments(first:100)", + "storageKey": null, "args": v23, "concreteType": "PullRequestReviewCommentConnection", "plural": false, @@ -1098,36 +1115,58 @@ return { { "kind": "LinkedField", "alias": null, - "name": "nodes", + "name": "edges", "storageKey": null, "args": null, - "concreteType": "PullRequestReviewComment", + "concreteType": "PullRequestReviewCommentEdge", "plural": true, "selections": [ - v6, - v25, - v19, - v26, - v27, - v28, + v18, { "kind": "LinkedField", "alias": null, - "name": "replyTo", + "name": "node", "storageKey": null, "args": null, "concreteType": "PullRequestReviewComment", "plural": false, "selections": [ - v6 + v6, + v25, + v19, + v26, + v27, + v28, + { + "kind": "LinkedField", + "alias": null, + "name": "replyTo", + "storageKey": null, + "args": null, + "concreteType": "PullRequestReviewComment", + "plural": false, + "selections": [ + v6 + ] + }, + v29, + v13, + v5 ] - }, - v29, - v13 + } ] } ] }, + { + "kind": "LinkedHandle", + "alias": null, + "name": "comments", + "args": v23, + "handle": "connection", + "key": "PrReviewCommentsContainer_comments", + "filters": null + }, v5 ] } @@ -1551,7 +1590,14 @@ return { "alias": null, "name": "comments", "storageKey": "comments(first:100)", - "args": v23, + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 100, + "type": "Int" + } + ], "concreteType": "CommitCommentConnection", "plural": false, "selections": [ diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-comments-view.js index c0755edce2..a63f517a2c 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-comments-view.js @@ -27,7 +27,6 @@ export default class PullRequestCommentsView extends React.Component { } componentDidMount() { - console.log('DID MOUNT'); this._attemptToLoadMoreReviews(); } @@ -58,6 +57,7 @@ export default class PullRequestCommentsView extends React.Component { } render() { + console.log('!!!! props', this.props) if (!this.props.pullRequest || !this.props.pullRequest.reviews) { return null; } @@ -66,7 +66,12 @@ export default class PullRequestCommentsView extends React.Component { this.props.pullRequest.reviews.edges.forEach(({node}) => { const review = node; - review.comments.nodes.forEach(comment => { + if (!review.comments) { + return null; + } + review.comments.edges.forEach(({node}) => { + const comment = node; + console.log('comment!!!', comment); if (!comment.replyTo) { commentsByRootCommentId.set(comment.id, [comment]); } else { From 657c7a68212a7db8a09b46f32c6d56b7972f9952 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 15:32:41 -0800 Subject: [PATCH 044/120] Get comments rendering again! Woohoo Co-Authored-By: Tilde Ann Thurium --- .../pr-review-comments-container.js | 58 +++++++++++++- lib/controllers/pr-reviews-controller.js | 67 ++++++++++++++-- ...nts-view.js => pr-review-comments-view.js} | 76 ++----------------- 3 files changed, 121 insertions(+), 80 deletions(-) rename lib/views/{pr-comments-view.js => pr-review-comments-view.js} (56%) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 3caeb9f408..723d9b352e 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -1,8 +1,62 @@ import {graphql, createPaginationContainer} from 'react-relay'; +import React from 'react'; -import PullRequestReviewCommentsView from '../views/pr-comments-view'; +export class ReviewCommentsController extends React.Component { + // static getDerivedStateFromProps(nextProps, prevState) { + // console.log('getDerivedStateFromProps'); + // if (nextProps !== prevState.props) { + // nextProps.aggregateComments(nextProps.review.id, nextProps.review.comments); + // } + // return { + // props: nextProps, + // }; + // } -export default createPaginationContainer(PullRequestReviewCommentsView, { + constructor(props) { + super(props); + console.log('pr-review-container-constructor'); + } + + componentDidMount() { + this.props.aggregateComments(this.props.review.id, this.props.review.comments); + console.log('comments!!!', this.props.review.comments); + this._attemptToLoadMoreComments(); + } + + _loadMoreComments = () => { + this.props.relay.loadMore( + 100, + error => { + this.props.aggregateComments(this.props.review.id, this.props.review.comments); + console.log('comments!!!', this.props.review.comments); + this._attemptToLoadMoreComments(); + if (error) { + console.log(error); + } + }, + ); + } + + _attemptToLoadMoreComments = () => { + if (!this.props.relay.hasMore()) { + return; + } + + if (this.props.relay.isLoading()) { + setTimeout(() => { + this._loadMoreComments(); + }, 300); + } else { + this._loadMoreComments(); + } + } + + render() { + return null; + } +} + +export default createPaginationContainer(ReviewCommentsController, { review: graphql` fragment prReviewCommentsContainer_review on PullRequestReview @argumentDefinitions( diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index e744234186..79b3c32fb7 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import {RelayConnectionPropType} from '../prop-types'; import PullRequestReviewCommentsContainer from '../containers/pr-review-comments-container'; - +import PullRequestReviewCommentsView from '../views/pr-review-comments-view'; export default class PullRequestReviewsController extends React.Component { static propTypes = { @@ -20,6 +20,11 @@ export default class PullRequestReviewsController extends React.Component { multiFilePatch: PropTypes.object.isRequired, } + constructor(props) { + super(props); + this.state = {}; + } + componentDidMount() { this._attemptToLoadMoreReviews(); } @@ -50,18 +55,64 @@ export default class PullRequestReviewsController extends React.Component { } } + aggregateComments = (reviewId, comments) => { + const state = this.state; + comments.edges.forEach(({node}) => { + const comment = node; + if (!comment.replyTo) { + state[comment.id] = [comment]; + // this.setState({[comment.id]: [comment]}); + } else { + // When comment being replied to is outdated...?? Not 100% sure... + // Why would we even get an outdated comment or a response to one here? + // Ran into this error when viewing files for https://github.com/numpy/numpy/pull/9998 + // for comment MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MzA1NTUzMw, + // who's replyTo comment is an outdated comment + if (!state[comment.replyTo.id]) { + state[comment.id] = [comment]; + // this.setState({[comment.id]: [comment]}); + } else { + state[comment.replyTo.id].push(comment); + } + } + }); + this.setState(state); + } + + renderReviewCommentContainers() { + // Aggregate comments from all reviews + return this.props.pullRequest.reviews.edges.map(({node}) => { + const review = node; + console.log('!!!! review in PrReviewsController', review); + return ( + + ); + }); + } + render() { + console.log('PrReviewsController', this.props.pullRequest); + if (!this.props.pullRequest || !this.props.pullRequest.reviews) { return null; } - return this.props.pullRequest.reviews.forEach.map(({node}) => { - const review = node; - const reviewProp = this.props.reviews.find(r => r.id === review.id) - reviewProp.comments = review.comments; - return ( - - ); + const commentThreads = Object.keys(this.state).map(rootCommentId => { + return { + rootCommentId, + comments: this.state[rootCommentId], + }; }); + + return ( +
+ {this.renderReviewCommentContainers()} + +
+ ); } } diff --git a/lib/views/pr-comments-view.js b/lib/views/pr-review-comments-view.js similarity index 56% rename from lib/views/pr-comments-view.js rename to lib/views/pr-review-comments-view.js index a63f517a2c..a7434538bb 100644 --- a/lib/views/pr-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -18,80 +18,16 @@ export default class PullRequestCommentsView extends React.Component { loadMore: PropTypes.func.isRequired, isLoading: PropTypes.func.isRequired, }).isRequired, - pullRequest: PropTypes.shape({ - reviews: RelayConnectionPropType( - PropTypes.object, - ), - }), + commentThreads: PropTypes.arrayOf(PropTypes.shape({ + rootCommentId: PropTypes.number.isRequired, + comments: PropTypes.arrayOf(PropTypes.object).isRequired, + })), multiFilePatch: PropTypes.object.isRequired, } - componentDidMount() { - this._attemptToLoadMoreReviews(); - } - - _loadMoreReviews = () => { - this.props.relay.loadMore( - 100, - error => { - this._attemptToLoadMoreReviews(); - if (error) { - console.log(error); - } - }, - ); - } - - _attemptToLoadMoreReviews = () => { - if (!this.props.relay.hasMore()) { - return; - } - - if (this.props.relay.isLoading()) { - setTimeout(() => { - this._loadMoreReviews(); - }, 300); - } else { - this._loadMoreReviews(); - } - } - render() { - console.log('!!!! props', this.props) - if (!this.props.pullRequest || !this.props.pullRequest.reviews) { - return null; - } - - const commentsByRootCommentId = new Map(); - - this.props.pullRequest.reviews.edges.forEach(({node}) => { - const review = node; - if (!review.comments) { - return null; - } - review.comments.edges.forEach(({node}) => { - const comment = node; - console.log('comment!!!', comment); - if (!comment.replyTo) { - commentsByRootCommentId.set(comment.id, [comment]); - } else { - // When comment being replied to is outdated...?? Not 100% sure... - // Why would we even get an outdated comment or a response to one here? - // Ran into this error when viewing files for https://github.com/numpy/numpy/pull/9998 - // for comment MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MzA1NTUzMw, - // who's replyTo comment is an outdated comment - if (!commentsByRootCommentId.get(comment.replyTo.id)) { - commentsByRootCommentId.set(comment.replyTo.id, [comment]); - } else { - commentsByRootCommentId.get(comment.replyTo.id).push(comment); - } - } - }); - }); - - console.log('SIZE', commentsByRootCommentId.size, [...commentsByRootCommentId]); - - return [...commentsByRootCommentId].reverse().map(([rootCommentId, comments]) => { + console.log('!!!! comment threads', this.props.commentThreads); + return [...this.props.commentThreads].reverse().map(({rootCommentId, comments}) => { const rootComment = comments[0]; if (!rootComment.position) { return null; From 2de958fc19433527607d7826529a360ac5c02ead Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 15:58:53 -0800 Subject: [PATCH 045/120] Thread commentCount and commentCursor through component hierarchy Co-Authored-By: Tilde Ann Thurium --- .../issueishDetailContainerQuery.graphql.js | 28 ++++++------ .../prReviewsContainerQuery.graphql.js | 44 +++++++++++++++---- .../prReviewsContainer_pullRequest.graphql.js | 14 +++--- lib/containers/issueish-detail-container.js | 14 +++--- .../pr-review-comments-container.js | 18 +------- lib/containers/pr-reviews-container.js | 25 +++++++++-- ...eishDetailController_repository.graphql.js | 10 ++--- lib/controllers/issueish-detail-controller.js | 8 ++-- lib/controllers/pr-reviews-controller.js | 4 +- .../prDetailViewRefetchQuery.graphql.js | 28 ++++++------ .../prDetailView_pullRequest.graphql.js | 24 +++++++--- lib/views/pr-detail-view.js | 23 ++++++---- lib/views/pr-review-comments-view.js | 1 - 13 files changed, 144 insertions(+), 97 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 85536bb239..5158fd1965 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 2272e39d4e33d96fe66954cf4a808caa + * @relayHash 89eb63ec03a0c0f750b90f024809ee03 */ /* eslint-disable */ @@ -18,10 +18,10 @@ export type issueishDetailContainerQueryVariables = {| timelineCursor?: ?string, commitCount: number, commitCursor?: ?string, + reviewCount: number, + reviewCursor?: ?string, commentCount: number, commentCursor?: ?string, - reviewCount?: ?number, - reviewCursor?: ?string, |}; export type issueishDetailContainerQueryResponse = {| +repository: ?{| @@ -44,10 +44,10 @@ query issueishDetailContainerQuery( $timelineCursor: String $commitCount: Int! $commitCursor: String + $reviewCount: Int! + $reviewCursor: String $commentCount: Int! $commentCursor: String - $reviewCount: Int - $reviewCursor: String ) { repository(owner: $repoOwner, name: $repoName) { ...issueishDetailController_repository_y3nHF @@ -164,7 +164,7 @@ fragment prDetailView_pullRequest_2qM2KL on PullRequest { } isCrossRepository changedFiles - ...prReviewsContainer_pullRequest_2zzc96 + ...prReviewsContainer_pullRequest_y4qc0 ...prCommitsView_pullRequest_38TpXw countedCommits: commits { totalCount @@ -204,7 +204,7 @@ fragment prDetailView_pullRequest_2qM2KL on PullRequest { } } -fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { +fragment prReviewsContainer_pullRequest_y4qc0 on PullRequest { url reviews(first: $reviewCount, after: $reviewCursor) { pageInfo { @@ -641,25 +641,25 @@ var v0 = [ }, { "kind": "LocalArgument", - "name": "commentCount", + "name": "reviewCount", "type": "Int!", "defaultValue": null }, { "kind": "LocalArgument", - "name": "commentCursor", + "name": "reviewCursor", "type": "String", "defaultValue": null }, { "kind": "LocalArgument", - "name": "reviewCount", - "type": "Int", + "name": "commentCount", + "type": "Int!", "defaultValue": null }, { "kind": "LocalArgument", - "name": "reviewCursor", + "name": "commentCursor", "type": "String", "defaultValue": null } @@ -1214,7 +1214,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $commentCount: Int!\n $commentCursor: String\n $reviewCount: Int\n $reviewCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_2zzc96\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -2009,5 +2009,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'e4903c4025a67651b3086652adb8aa06'; +(node/*: any*/).hash = '6a16db513a3cd8bf14fafb3c8b269643'; module.exports = node; diff --git a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js index aac991e4b6..edf519cbfc 100644 --- a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash f0d1b6fd1bbccab16bb6901bb25f4120 + * @relayHash 4118118a2d92572dc108cf48c14c067f */ /* eslint-disable */ @@ -11,8 +11,10 @@ import type { ConcreteRequest } from 'relay-runtime'; type prReviewsContainer_pullRequest$ref = any; export type prReviewsContainerQueryVariables = {| - reviewCount?: ?number, + reviewCount: number, reviewCursor?: ?string, + commentCount: number, + commentCursor?: ?string, url: any, |}; export type prReviewsContainerQueryResponse = {| @@ -29,14 +31,16 @@ export type prReviewsContainerQuery = {| /* query prReviewsContainerQuery( - $reviewCount: Int + $reviewCount: Int! $reviewCursor: String + $commentCount: Int! + $commentCursor: String $url: URI! ) { resource(url: $url) { __typename ... on PullRequest { - ...prReviewsContainer_pullRequest_2zzc96 + ...prReviewsContainer_pullRequest_y4qc0 } ... on Node { id @@ -44,7 +48,7 @@ query prReviewsContainerQuery( } } -fragment prReviewsContainer_pullRequest_2zzc96 on PullRequest { +fragment prReviewsContainer_pullRequest_y4qc0 on PullRequest { url reviews(first: $reviewCount, after: $reviewCursor) { pageInfo { @@ -123,7 +127,7 @@ var v0 = [ { "kind": "LocalArgument", "name": "reviewCount", - "type": "Int", + "type": "Int!", "defaultValue": null }, { @@ -132,6 +136,18 @@ var v0 = [ "type": "String", "defaultValue": null }, + { + "kind": "LocalArgument", + "name": "commentCount", + "type": "Int!", + "defaultValue": null + }, + { + "kind": "LocalArgument", + "name": "commentCursor", + "type": "String", + "defaultValue": null + }, { "kind": "LocalArgument", "name": "url", @@ -254,7 +270,7 @@ return { "operationKind": "query", "name": "prReviewsContainerQuery", "id": null, - "text": "query prReviewsContainerQuery(\n $reviewCount: Int\n $reviewCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_2zzc96\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_2zzc96 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewsContainerQuery(\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_y4qc0\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -280,6 +296,18 @@ return { "kind": "FragmentSpread", "name": "prReviewsContainer_pullRequest", "args": [ + { + "kind": "Variable", + "name": "commentCount", + "variableName": "commentCount", + "type": null + }, + { + "kind": "Variable", + "name": "commentCursor", + "variableName": "commentCursor", + "type": null + }, { "kind": "Variable", "name": "reviewCount", @@ -541,5 +569,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '29e5b225e2d3999e4cd475edc354015d'; +(node/*: any*/).hash = 'a84a1ddfd0a7a0667a57d94d5db110cf'; module.exports = node; diff --git a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js index 5145f6f6ec..04d2100cf7 100644 --- a/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js +++ b/lib/containers/__generated__/prReviewsContainer_pullRequest.graphql.js @@ -64,7 +64,7 @@ const node/*: ConcreteFragment*/ = { { "kind": "LocalArgument", "name": "reviewCount", - "type": "Int", + "type": "Int!", "defaultValue": null }, { @@ -74,14 +74,16 @@ const node/*: ConcreteFragment*/ = { "defaultValue": null }, { - "kind": "RootArgument", + "kind": "LocalArgument", "name": "commentCount", - "type": null + "type": "Int!", + "defaultValue": null }, { - "kind": "RootArgument", + "kind": "LocalArgument", "name": "commentCursor", - "type": null + "type": "String", + "defaultValue": null } ], "selections": [ @@ -267,5 +269,5 @@ const node/*: ConcreteFragment*/ = { ] }; // prettier-ignore -(node/*: any*/).hash = '4d74fc25f4b854782495fc05521f961c'; +(node/*: any*/).hash = 'e5d1cfb5428af5817e22a53694345419'; module.exports = node; diff --git a/lib/containers/issueish-detail-container.js b/lib/containers/issueish-detail-container.js index ee83411112..fc326181ce 100644 --- a/lib/containers/issueish-detail-container.js +++ b/lib/containers/issueish-detail-container.js @@ -122,10 +122,10 @@ export default class IssueishDetailContainer extends React.Component { $timelineCursor: String $commitCount: Int! $commitCursor: String, + $reviewCount: Int!, + $reviewCursor: String, $commentCount: Int!, $commentCursor: String, - $reviewCount: Int, - $reviewCursor: String, ) { repository(owner: $repoOwner, name: $repoName) { ...issueishDetailController_repository @arguments( @@ -134,10 +134,10 @@ export default class IssueishDetailContainer extends React.Component { timelineCursor: $timelineCursor, commitCount: $commitCount, commitCursor: $commitCursor, - commentCount: $commentCount, - commentCursor: $commentCursor, reviewCount: $reviewCount, reviewCursor: $reviewCursor, + commentCount: $commentCount, + commentCursor: $commentCursor, ) } } @@ -150,10 +150,10 @@ export default class IssueishDetailContainer extends React.Component { timelineCursor: null, commitCount: 100, commitCursor: null, - commentCount: 100, - commentCursor: null, - reviewCount: 100, + reviewCount: 2, reviewCursor: null, + commentCount: 2, + commentCursor: null, }; return ( diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 723d9b352e..175ace49a0 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -2,24 +2,9 @@ import {graphql, createPaginationContainer} from 'react-relay'; import React from 'react'; export class ReviewCommentsController extends React.Component { - // static getDerivedStateFromProps(nextProps, prevState) { - // console.log('getDerivedStateFromProps'); - // if (nextProps !== prevState.props) { - // nextProps.aggregateComments(nextProps.review.id, nextProps.review.comments); - // } - // return { - // props: nextProps, - // }; - // } - - constructor(props) { - super(props); - console.log('pr-review-container-constructor'); - } componentDidMount() { this.props.aggregateComments(this.props.review.id, this.props.review.comments); - console.log('comments!!!', this.props.review.comments); this._attemptToLoadMoreComments(); } @@ -27,8 +12,7 @@ export class ReviewCommentsController extends React.Component { this.props.relay.loadMore( 100, error => { - this.props.aggregateComments(this.props.review.id, this.props.review.comments); - console.log('comments!!!', this.props.review.comments); + console.log('loaded more comments!', this.props.review.comments.edges); this._attemptToLoadMoreComments(); if (error) { console.log(error); diff --git a/lib/containers/pr-reviews-container.js b/lib/containers/pr-reviews-container.js index 8de768a770..a07dad5251 100644 --- a/lib/containers/pr-reviews-container.js +++ b/lib/containers/pr-reviews-container.js @@ -6,8 +6,10 @@ export default createPaginationContainer(PullRequestReviewsController, { pullRequest: graphql` fragment prReviewsContainer_pullRequest on PullRequest @argumentDefinitions( - reviewCount: {type: "Int"}, - reviewCursor: {type: "String"} + reviewCount: {type: "Int!"}, + reviewCursor: {type: "String"}, + commentCount: {type: "Int!"}, + commentCursor: {type: "String"} ) { url reviews( @@ -56,17 +58,32 @@ export default createPaginationContainer(PullRequestReviewsController, { }; }, getVariables(props, {count, cursor}, fragmentVariables) { + // console.log('fragmentVariables -------------->', fragmentVariables); + // console.log(arguments); return { url: props.pullRequest.url, reviewCount: count, reviewCursor: cursor, + commentCount: fragmentVariables.commentCount, + commentCursor: fragmentVariables.commentCursor, }; }, query: graphql` - query prReviewsContainerQuery($reviewCount: Int, $reviewCursor: String, $url: URI!) { + query prReviewsContainerQuery( + $reviewCount: Int!, + $reviewCursor: String, + $commentCount: Int!, + $commentCursor: String, + $url: URI! + ) { resource(url: $url) { ... on PullRequest { - ...prReviewsContainer_pullRequest @arguments(reviewCount: $reviewCount, reviewCursor: $reviewCursor) + ...prReviewsContainer_pullRequest @arguments( + reviewCount: $reviewCount, + reviewCursor: $reviewCursor, + commentCount: $commentCount, + commentCursor: $commentCursor + ) } } } diff --git a/lib/controllers/__generated__/issueishDetailController_repository.graphql.js b/lib/controllers/__generated__/issueishDetailController_repository.graphql.js index 3c9b629202..12a4a5d6e8 100644 --- a/lib/controllers/__generated__/issueishDetailController_repository.graphql.js +++ b/lib/controllers/__generated__/issueishDetailController_repository.graphql.js @@ -171,25 +171,25 @@ return { }, { "kind": "LocalArgument", - "name": "commentCount", + "name": "reviewCount", "type": "Int!", "defaultValue": null }, { "kind": "LocalArgument", - "name": "commentCursor", + "name": "reviewCursor", "type": "String", "defaultValue": null }, { "kind": "LocalArgument", - "name": "reviewCount", + "name": "commentCount", "type": "Int!", "defaultValue": null }, { "kind": "LocalArgument", - "name": "reviewCursor", + "name": "commentCursor", "type": "String", "defaultValue": null } @@ -329,5 +329,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'f24ee4210befb63664396cf05d2afa79'; +(node/*: any*/).hash = 'e348cf91ee76425342abf4aa3c60b143'; module.exports = node; diff --git a/lib/controllers/issueish-detail-controller.js b/lib/controllers/issueish-detail-controller.js index 75ef71c32d..697a1f0e96 100644 --- a/lib/controllers/issueish-detail-controller.js +++ b/lib/controllers/issueish-detail-controller.js @@ -297,10 +297,10 @@ export default createFragmentContainer(BareIssueishDetailController, { timelineCursor: {type: "String"}, commitCount: {type: "Int!"}, commitCursor: {type: "String"}, - commentCount: {type: "Int!"}, - commentCursor: {type: "String"}, reviewCount: {type: "Int!"}, reviewCursor: {type: "String"}, + commentCount: {type: "Int!"}, + commentCursor: {type: "String"}, ) { ...issueDetailView_repository ...prDetailView_repository @@ -340,10 +340,10 @@ export default createFragmentContainer(BareIssueishDetailController, { timelineCursor: $timelineCursor, commitCount: $commitCount, commitCursor: $commitCursor, - commentCount: $commentCount, - commentCursor: $commentCursor, reviewCount: $reviewCount, reviewCursor: $reviewCursor, + commentCount: $commentCount, + commentCursor: $commentCursor, ) } } diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 79b3c32fb7..3e3ee359de 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -34,6 +34,7 @@ export default class PullRequestReviewsController extends React.Component { 100, error => { this._attemptToLoadMoreReviews(); + console.log('loaded more reviews!', this.props.pullRequest.reviews.edges); if (error) { console.log(error); } @@ -83,7 +84,6 @@ export default class PullRequestReviewsController extends React.Component { // Aggregate comments from all reviews return this.props.pullRequest.reviews.edges.map(({node}) => { const review = node; - console.log('!!!! review in PrReviewsController', review); return ( { this.setState({refreshing: false}); }, {force: true}); @@ -378,10 +380,10 @@ export default createRefetchContainer(BarePullRequestDetailView, { timelineCursor: {type: "String"}, commitCount: {type: "Int!"}, commitCursor: {type: "String"}, + reviewCount: {type: "Int!"}, + reviewCursor: {type: "String"}, commentCount: {type: "Int!"}, commentCursor: {type: "String"}, - reviewCount: {type: "Int"}, - reviewCursor: {type: "String"} ) { __typename @@ -393,7 +395,12 @@ export default createRefetchContainer(BarePullRequestDetailView, { isCrossRepository changedFiles - ...prReviewsContainer_pullRequest @arguments(reviewCount: $reviewCount, reviewCursor: $reviewCursor) + ...prReviewsContainer_pullRequest @arguments( + reviewCount: $reviewCount, + reviewCursor: $reviewCursor, + commentCount: $commentCount, + commentCursor: $commentCursor, + ) ...prCommitsView_pullRequest @arguments(commitCount: $commitCount, commitCursor: $commitCursor) countedCommits: commits { @@ -428,10 +435,10 @@ export default createRefetchContainer(BarePullRequestDetailView, { $timelineCursor: String, $commitCount: Int!, $commitCursor: String, + $reviewCount: Int!, + $reviewCursor: String, $commentCount: Int!, $commentCursor: String, - $reviewCount: Int, - $reviewCursor: String ) { repository:node(id: $repoId) { ...prDetailView_repository @arguments( @@ -446,10 +453,10 @@ export default createRefetchContainer(BarePullRequestDetailView, { timelineCursor: $timelineCursor, commitCount: $commitCount, commitCursor: $commitCursor, + reviewCount: $reviewCount, + reviewCursor: $reviewCursor, commentCount: $commentCount, commentCursor: $commentCursor, - reviewCount: $reviewCount, - reviewCursor: $reviewCursor ) } } diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index a7434538bb..abf70c729e 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -43,7 +43,6 @@ export default class PullRequestCommentsView extends React.Component { {comments.map(comment => { - console.log(comment.body); return ( Date: Fri, 28 Dec 2018 15:59:30 -0800 Subject: [PATCH 046/120] Fix proptype error Co-Authored-By: Tilde Ann Thurium --- lib/views/pr-review-comments-view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index abf70c729e..1247585ee0 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -19,7 +19,7 @@ export default class PullRequestCommentsView extends React.Component { isLoading: PropTypes.func.isRequired, }).isRequired, commentThreads: PropTypes.arrayOf(PropTypes.shape({ - rootCommentId: PropTypes.number.isRequired, + rootCommentId: PropTypes.string.isRequired, comments: PropTypes.arrayOf(PropTypes.object).isRequired, })), multiFilePatch: PropTypes.object.isRequired, From 4fc8e7da2274a4cf7c4cb1684672bf8d25bf551e Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 16:23:19 -0800 Subject: [PATCH 047/120] Add PAGE_SIZE const to helper file Co-Authored-By: Tilde Ann Thurium --- lib/containers/issueish-detail-container.js | 10 +++++----- lib/containers/pr-review-comments-container.js | 4 +++- lib/controllers/pr-reviews-controller.js | 3 ++- lib/helpers.js | 1 + lib/views/pr-commits-view.js | 4 +--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/containers/issueish-detail-container.js b/lib/containers/issueish-detail-container.js index fc326181ce..7cd560d3fb 100644 --- a/lib/containers/issueish-detail-container.js +++ b/lib/containers/issueish-detail-container.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import yubikiri from 'yubikiri'; import {QueryRenderer, graphql} from 'react-relay'; -import {autobind} from '../helpers'; +import {autobind, PAGE_SIZE} from '../helpers'; import RelayNetworkLayerManager from '../relay-network-layer-manager'; import {GithubLoginModelPropType, ItemTypePropType, EndpointPropType} from '../prop-types'; import {UNAUTHENTICATED, INSUFFICIENT} from '../shared/keytar-strategy'; @@ -146,13 +146,13 @@ export default class IssueishDetailContainer extends React.Component { repoOwner: this.props.owner, repoName: this.props.repo, issueishNumber: this.props.issueishNumber, - timelineCount: 100, + timelineCount: PAGE_SIZE, timelineCursor: null, - commitCount: 100, + commitCount: PAGE_SIZE, commitCursor: null, - reviewCount: 2, + reviewCount: PAGE_SIZE, reviewCursor: null, - commentCount: 2, + commentCount: PAGE_SIZE, commentCursor: null, }; diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 175ace49a0..c55576b955 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -1,6 +1,8 @@ import {graphql, createPaginationContainer} from 'react-relay'; import React from 'react'; +import {PAGE_SIZE} from '../helpers'; + export class ReviewCommentsController extends React.Component { componentDidMount() { @@ -10,7 +12,7 @@ export class ReviewCommentsController extends React.Component { _loadMoreComments = () => { this.props.relay.loadMore( - 100, + PAGE_SIZE, error => { console.log('loaded more comments!', this.props.review.comments.edges); this._attemptToLoadMoreComments(); diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 3e3ee359de..86b33bb965 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -4,6 +4,7 @@ import {RelayConnectionPropType} from '../prop-types'; import PullRequestReviewCommentsContainer from '../containers/pr-review-comments-container'; import PullRequestReviewCommentsView from '../views/pr-review-comments-view'; +import {PAGE_SIZE} from '../helpers'; export default class PullRequestReviewsController extends React.Component { static propTypes = { @@ -31,7 +32,7 @@ export default class PullRequestReviewsController extends React.Component { _loadMoreReviews = () => { this.props.relay.loadMore( - 100, + PAGE_SIZE, error => { this._attemptToLoadMoreReviews(); console.log('loaded more reviews!', this.props.pullRequest.reviews.edges); diff --git a/lib/helpers.js b/lib/helpers.js index 74a77f9460..c45375b232 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -8,6 +8,7 @@ import RefHolder from './models/ref-holder'; export const LINE_ENDING_REGEX = /\r?\n/; export const CO_AUTHOR_REGEX = /^co-authored-by. (.+?) <(.+?)>$/i; +export const PAGE_SIZE = 50; export function autobind(self, ...methods) { for (const method of methods) { diff --git a/lib/views/pr-commits-view.js b/lib/views/pr-commits-view.js index 5398c58ad1..0ae3e6a76d 100644 --- a/lib/views/pr-commits-view.js +++ b/lib/views/pr-commits-view.js @@ -4,9 +4,7 @@ import {graphql, createPaginationContainer} from 'react-relay'; import {RelayConnectionPropType} from '../prop-types'; import PrCommitView from './pr-commit-view'; -import {autobind} from '../helpers'; - -const PAGE_SIZE = 50; +import {autobind, PAGE_SIZE} from '../helpers'; export class PrCommitsView extends React.Component { static propTypes = { From d215b328c0e0420b7015a0cea4dea65b99ffeded Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 16:23:40 -0800 Subject: [PATCH 048/120] Clean up logs Co-Authored-By: Tilde Ann Thurium --- lib/containers/pr-review-comments-container.js | 1 - lib/containers/pr-reviews-container.js | 2 -- lib/controllers/pr-reviews-controller.js | 1 - lib/views/pr-review-comments-view.js | 1 - 4 files changed, 5 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index c55576b955..031ae77653 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -14,7 +14,6 @@ export class ReviewCommentsController extends React.Component { this.props.relay.loadMore( PAGE_SIZE, error => { - console.log('loaded more comments!', this.props.review.comments.edges); this._attemptToLoadMoreComments(); if (error) { console.log(error); diff --git a/lib/containers/pr-reviews-container.js b/lib/containers/pr-reviews-container.js index a07dad5251..b0bc33a95b 100644 --- a/lib/containers/pr-reviews-container.js +++ b/lib/containers/pr-reviews-container.js @@ -58,8 +58,6 @@ export default createPaginationContainer(PullRequestReviewsController, { }; }, getVariables(props, {count, cursor}, fragmentVariables) { - // console.log('fragmentVariables -------------->', fragmentVariables); - // console.log(arguments); return { url: props.pullRequest.url, reviewCount: count, diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 86b33bb965..1e1d8c2f11 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -35,7 +35,6 @@ export default class PullRequestReviewsController extends React.Component { PAGE_SIZE, error => { this._attemptToLoadMoreReviews(); - console.log('loaded more reviews!', this.props.pullRequest.reviews.edges); if (error) { console.log(error); } diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index 1247585ee0..286615ab76 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -26,7 +26,6 @@ export default class PullRequestCommentsView extends React.Component { } render() { - console.log('!!!! comment threads', this.props.commentThreads); return [...this.props.commentThreads].reverse().map(({rootCommentId, comments}) => { const rootComment = comments[0]; if (!rootComment.position) { From 839583e36712d6c672f98365a94eb4bcbecb5ece Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 16:26:11 -0800 Subject: [PATCH 049/120] Add PAGINATION_WAIT_TIME_MS const to helper file Co-Authored-By: Tilde Ann Thurium --- lib/containers/pr-review-comments-container.js | 4 ++-- lib/controllers/pr-reviews-controller.js | 4 ++-- lib/helpers.js | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 031ae77653..c58d0ac7ee 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -1,7 +1,7 @@ import {graphql, createPaginationContainer} from 'react-relay'; import React from 'react'; -import {PAGE_SIZE} from '../helpers'; +import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../helpers'; export class ReviewCommentsController extends React.Component { @@ -30,7 +30,7 @@ export class ReviewCommentsController extends React.Component { if (this.props.relay.isLoading()) { setTimeout(() => { this._loadMoreComments(); - }, 300); + }, PAGINATION_WAIT_TIME_MS); } else { this._loadMoreComments(); } diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 1e1d8c2f11..b67df0c3f8 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -4,7 +4,7 @@ import {RelayConnectionPropType} from '../prop-types'; import PullRequestReviewCommentsContainer from '../containers/pr-review-comments-container'; import PullRequestReviewCommentsView from '../views/pr-review-comments-view'; -import {PAGE_SIZE} from '../helpers'; +import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../helpers'; export default class PullRequestReviewsController extends React.Component { static propTypes = { @@ -50,7 +50,7 @@ export default class PullRequestReviewsController extends React.Component { if (this.props.relay.isLoading()) { setTimeout(() => { this._loadMoreReviews(); - }, 300); + }, PAGINATION_WAIT_TIME_MS); } else { this._loadMoreReviews(); } diff --git a/lib/helpers.js b/lib/helpers.js index c45375b232..0b76f1bc71 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -9,6 +9,7 @@ import RefHolder from './models/ref-holder'; export const LINE_ENDING_REGEX = /\r?\n/; export const CO_AUTHOR_REGEX = /^co-authored-by. (.+?) <(.+?)>$/i; export const PAGE_SIZE = 50; +export const PAGINATION_WAIT_TIME_MS = 100; export function autobind(self, ...methods) { for (const method of methods) { From dd39ae5b561f91ef98457057ca144be3a851f338 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 16:47:58 -0800 Subject: [PATCH 050/120] Add explanatory comments Co-Authored-By: Tilde Ann Thurium --- lib/controllers/pr-reviews-controller.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index b67df0c3f8..38479ad8b3 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {Fragment} from 'react'; import PropTypes from 'prop-types'; import {RelayConnectionPropType} from '../prop-types'; @@ -57,12 +57,14 @@ export default class PullRequestReviewsController extends React.Component { } aggregateComments = (reviewId, comments) => { + // react batches calls to setState and does not update state synchronously + // therefore we need an intermediate state so we can do checks against keys + // we have just added. const state = this.state; comments.edges.forEach(({node}) => { const comment = node; if (!comment.replyTo) { state[comment.id] = [comment]; - // this.setState({[comment.id]: [comment]}); } else { // When comment being replied to is outdated...?? Not 100% sure... // Why would we even get an outdated comment or a response to one here? @@ -71,7 +73,6 @@ export default class PullRequestReviewsController extends React.Component { // who's replyTo comment is an outdated comment if (!state[comment.replyTo.id]) { state[comment.id] = [comment]; - // this.setState({[comment.id]: [comment]}); } else { state[comment.replyTo.id].push(comment); } @@ -80,7 +81,7 @@ export default class PullRequestReviewsController extends React.Component { this.setState(state); } - renderReviewCommentContainers() { + renderCommentFetchingContainers() { // Aggregate comments from all reviews return this.props.pullRequest.reviews.edges.map(({node}) => { const review = node; @@ -106,11 +107,20 @@ export default class PullRequestReviewsController extends React.Component { }; }); + /** Slightly hacky thing to deal with comment threading... + * + * Threads can have comments belonging to multiple reviews. + * We need a nested pagination container to fetch comment pages. + * Upon fetching new comments, the `aggregateComments` method is called with the comments to add. + * Ultimately we want to organize comments based on the root comment they are replies to. + * So `renderCommentFetchingContainers` simply fetches data and doesn't render any DOM elements. + * `PullRequestReviewCommentsView` renders the comment thread data aggregated. + * */ return ( -
- {this.renderReviewCommentContainers()} + + {this.renderCommentFetchingContainers()} -
+
); } } From 75da755b4a5fd426f0125865b77dd0877276094f Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 16:49:46 -0800 Subject: [PATCH 051/120] :fire: unused `body` field on review comment Co-Authored-By: Tilde Ann Thurium --- .../issueishDetailContainerQuery.graphql.js | 59 +++---- .../prReviewCommentsContainerQuery.graphql.js | 12 +- ...rReviewCommentsContainer_review.graphql.js | 10 +- .../prReviewsContainerQuery.graphql.js | 35 ++-- .../pr-review-comments-container.js | 2 - .../prDetailViewRefetchQuery.graphql.js | 167 +++++++++--------- 6 files changed, 129 insertions(+), 156 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 5158fd1965..6f0b3544a4 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 89eb63ec03a0c0f750b90f024809ee03 + * @relayHash 8593181024464fe44267e78f2c66b059 */ /* eslint-disable */ @@ -557,7 +557,6 @@ fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { id } } - body bodyHTML path position @@ -1144,14 +1143,7 @@ v36 = { v18 ] }, -v37 = { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null -}, -v38 = [ +v37 = [ { "kind": "ScalarField", "alias": null, @@ -1161,7 +1153,7 @@ v38 = [ }, v2 ], -v39 = [ +v38 = [ { "kind": "Variable", "name": "after", @@ -1175,21 +1167,21 @@ v39 = [ "type": "Int" } ], -v40 = { +v39 = { "kind": "ScalarField", "alias": null, "name": "path", "args": null, "storageKey": null }, -v41 = { +v40 = { "kind": "ScalarField", "alias": null, "name": "position", "args": null, "storageKey": null }, -v42 = { +v41 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -1197,9 +1189,9 @@ v42 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v38 + "selections": v37 }, -v43 = { +v42 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -1214,7 +1206,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1573,7 +1565,13 @@ return { "plural": false, "selections": [ v2, - v37, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, { "kind": "LinkedField", "alias": "commitId", @@ -1582,7 +1580,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v38 + "selections": v37 }, v11, { @@ -1621,7 +1619,7 @@ return { "alias": null, "name": "comments", "storageKey": null, - "args": v39, + "args": v38, "concreteType": "PullRequestReviewCommentConnection", "plural": false, "selections": [ @@ -1647,10 +1645,9 @@ return { "selections": [ v2, v26, - v37, v12, + v39, v40, - v41, { "kind": "LinkedField", "alias": null, @@ -1676,7 +1673,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "comments", - "args": v39, + "args": v38, "handle": "connection", "key": "PrReviewCommentsContainer_comments", "filters": null @@ -1877,7 +1874,7 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v42, + v41, { "kind": "LinkedField", "alias": null, @@ -1923,11 +1920,11 @@ return { "plural": false, "selections": v23 }, - v42, + v41, v12, v27, - v40, - v41 + v39, + v40 ] } ] @@ -1940,7 +1937,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v43, + v42, { "kind": "LinkedField", "alias": null, @@ -1949,7 +1946,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v38 + "selections": v37 }, { "kind": "LinkedField", @@ -1959,7 +1956,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v38 + "selections": v37 }, v27 ] @@ -1968,8 +1965,8 @@ return { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ - v43, v42, + v41, { "kind": "ScalarField", "alias": null, diff --git a/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js index dc46be1e33..6fc33f5de0 100644 --- a/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 5658256f086fc990e6f8c58966b65c77 + * @relayHash aa28e03673267c061792b18ed9e13038 */ /* eslint-disable */ @@ -61,7 +61,6 @@ fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { id } } - body bodyHTML path position @@ -139,7 +138,7 @@ return { "operationKind": "query", "name": "prReviewCommentsContainerQuery", "id": null, - "text": "query prReviewCommentsContainerQuery(\n $commentCount: Int!\n $commentCursor: String\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on PullRequestReview {\n ...prReviewCommentsContainer_review_1VbUmL\n }\n id\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewCommentsContainerQuery(\n $commentCount: Int!\n $commentCursor: String\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on PullRequestReview {\n ...prReviewCommentsContainer_review_1VbUmL\n }\n id\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -292,13 +291,6 @@ return { v3 ] }, - { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null - }, { "kind": "ScalarField", "alias": null, diff --git a/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js b/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js index 5a674efbcc..7f1b8d16e1 100644 --- a/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js +++ b/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js @@ -25,7 +25,6 @@ export type prReviewCommentsContainer_review = {| +avatarUrl: any, +login: string, |}, - +body: string, +bodyHTML: any, +path: string, +position: ?number, @@ -167,13 +166,6 @@ return { } ] }, - { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null - }, { "kind": "ScalarField", "alias": null, @@ -238,5 +230,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'd4b785b8fc4e5b4bedc5aa92491f37e7'; +(node/*: any*/).hash = 'd2db363653fb73e8f4d019026668babc'; module.exports = node; diff --git a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js index edf519cbfc..63254fbff3 100644 --- a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 4118118a2d92572dc108cf48c14c067f + * @relayHash a2fda52ce9272b72cf214c6bcd70719a */ /* eslint-disable */ @@ -106,7 +106,6 @@ fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { id } } - body bodyHTML path position @@ -231,27 +230,20 @@ v7 = { "storageKey": null }, v8 = { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null -}, -v9 = { "kind": "ScalarField", "alias": null, "name": "login", "args": null, "storageKey": null }, -v10 = { +v9 = { "kind": "ScalarField", "alias": null, "name": "avatarUrl", "args": null, "storageKey": null }, -v11 = [ +v10 = [ { "kind": "Variable", "name": "after", @@ -270,7 +262,7 @@ return { "operationKind": "query", "name": "prReviewsContainerQuery", "id": null, - "text": "query prReviewsContainerQuery(\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_y4qc0\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewsContainerQuery(\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_y4qc0\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -379,7 +371,13 @@ return { "plural": false, "selections": [ v3, - v8, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, { "kind": "LinkedField", "alias": "commitId", @@ -423,7 +421,7 @@ return { "plural": false, "selections": [ v2, - v9, + v8, v3 ] }, @@ -437,7 +435,7 @@ return { "plural": false, "selections": [ v2, - v10, + v9, v3 ] }, @@ -446,7 +444,7 @@ return { "alias": null, "name": "comments", "storageKey": null, - "args": v11, + "args": v10, "concreteType": "PullRequestReviewCommentConnection", "plural": false, "selections": [ @@ -481,12 +479,11 @@ return { "plural": false, "selections": [ v2, - v10, v9, + v8, v3 ] }, - v8, { "kind": "ScalarField", "alias": null, @@ -539,7 +536,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "comments", - "args": v11, + "args": v10, "handle": "connection", "key": "PrReviewCommentsContainer_comments", "filters": null diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index c58d0ac7ee..a06c19c52b 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -4,7 +4,6 @@ import React from 'react'; import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../helpers'; export class ReviewCommentsController extends React.Component { - componentDidMount() { this.props.aggregateComments(this.props.review.id, this.props.review.comments); this._attemptToLoadMoreComments(); @@ -66,7 +65,6 @@ export default createPaginationContainer(ReviewCommentsController, { avatarUrl login } - body bodyHTML path position diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index 73318ce8b6..d75b7040e7 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 6c0ffc5e033e9c921a9287900c81cc20 + * @relayHash 7e3a37960cf0fb44d162883d95c9838d */ /* eslint-disable */ @@ -473,7 +473,6 @@ fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { id } } - body bodyHTML path position @@ -692,14 +691,7 @@ v18 = { "args": null, "storageKey": null }, -v19 = { - "kind": "ScalarField", - "alias": null, - "name": "body", - "args": null, - "storageKey": null -}, -v20 = [ +v19 = [ { "kind": "ScalarField", "alias": null, @@ -709,21 +701,21 @@ v20 = [ }, v6 ], -v21 = { +v20 = { "kind": "ScalarField", "alias": null, "name": "state", "args": null, "storageKey": null }, -v22 = { +v21 = { "kind": "ScalarField", "alias": null, "name": "avatarUrl", "args": null, "storageKey": null }, -v23 = [ +v22 = [ { "kind": "Variable", "name": "after", @@ -737,13 +729,13 @@ v23 = [ "type": "Int" } ], -v24 = [ +v23 = [ v5, - v22, + v21, v8, v6 ], -v25 = { +v24 = { "kind": "LinkedField", "alias": null, "name": "author", @@ -751,37 +743,37 @@ v25 = { "args": null, "concreteType": null, "plural": false, - "selections": v24 + "selections": v23 }, -v26 = { +v25 = { "kind": "ScalarField", "alias": null, "name": "bodyHTML", "args": null, "storageKey": null }, -v27 = { +v26 = { "kind": "ScalarField", "alias": null, "name": "path", "args": null, "storageKey": null }, -v28 = { +v27 = { "kind": "ScalarField", "alias": null, "name": "position", "args": null, "storageKey": null }, -v29 = { +v28 = { "kind": "ScalarField", "alias": null, "name": "createdAt", "args": null, "storageKey": null }, -v30 = [ +v29 = [ { "kind": "Variable", "name": "after", @@ -795,7 +787,7 @@ v30 = [ "type": "Int" } ], -v31 = { +v30 = { "kind": "LinkedField", "alias": null, "name": "pageInfo", @@ -808,14 +800,14 @@ v31 = { v15 ] }, -v32 = { +v31 = { "kind": "ScalarField", "alias": "sha", "name": "oid", "args": null, "storageKey": null }, -v33 = [ +v32 = [ { "kind": "ScalarField", "alias": null, @@ -824,17 +816,17 @@ v33 = [ "storageKey": null } ], -v34 = { +v33 = { "kind": "ScalarField", "alias": null, "name": "title", "args": null, "storageKey": null }, -v35 = [ +v34 = [ v13 ], -v36 = [ +v35 = [ { "kind": "Variable", "name": "after", @@ -848,13 +840,13 @@ v36 = [ "type": "Int" } ], -v37 = [ +v36 = [ v5, v8, - v22, + v21, v6 ], -v38 = { +v37 = { "kind": "LinkedField", "alias": null, "name": "commit", @@ -862,9 +854,9 @@ v38 = { "args": null, "concreteType": "Commit", "plural": false, - "selections": v20 + "selections": v19 }, -v39 = { +v38 = { "kind": "LinkedField", "alias": null, "name": "actor", @@ -872,9 +864,9 @@ v39 = { "args": null, "concreteType": null, "plural": false, - "selections": v24 + "selections": v23 }, -v40 = { +v39 = { "kind": "LinkedField", "alias": null, "name": "user", @@ -892,7 +884,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n body\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1059,7 +1051,13 @@ return { "plural": false, "selections": [ v6, - v19, + { + "kind": "ScalarField", + "alias": null, + "name": "body", + "args": null, + "storageKey": null + }, { "kind": "LinkedField", "alias": "commitId", @@ -1068,9 +1066,9 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v20 + "selections": v19 }, - v21, + v20, { "kind": "ScalarField", "alias": null, @@ -1098,7 +1096,7 @@ return { "plural": false, "selections": [ v5, - v22, + v21, v6 ] }, @@ -1107,7 +1105,7 @@ return { "alias": null, "name": "comments", "storageKey": null, - "args": v23, + "args": v22, "concreteType": "PullRequestReviewCommentConnection", "plural": false, "selections": [ @@ -1132,11 +1130,10 @@ return { "plural": false, "selections": [ v6, + v24, v25, - v19, v26, v27, - v28, { "kind": "LinkedField", "alias": null, @@ -1149,7 +1146,7 @@ return { v6 ] }, - v29, + v28, v13, v5 ] @@ -1162,7 +1159,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "comments", - "args": v23, + "args": v22, "handle": "connection", "key": "PrReviewCommentsContainer_comments", "filters": null @@ -1188,11 +1185,11 @@ return { "alias": null, "name": "commits", "storageKey": null, - "args": v30, + "args": v29, "concreteType": "PullRequestCommitConnection", "plural": false, "selections": [ - v31, + v30, { "kind": "LinkedField", "alias": null, @@ -1231,7 +1228,7 @@ return { "concreteType": "GitActor", "plural": false, "selections": [ - v22, + v21, v7, { "kind": "ScalarField", @@ -1263,7 +1260,7 @@ return { "args": null, "storageKey": null }, - v32, + v31, v13 ] }, @@ -1279,7 +1276,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "commits", - "args": v30, + "args": v29, "handle": "connection", "key": "prCommitsView_commits", "filters": null @@ -1292,7 +1289,7 @@ return { "args": null, "concreteType": "PullRequestCommitConnection", "plural": false, - "selections": v33 + "selections": v32 }, { "kind": "LinkedField", @@ -1346,7 +1343,7 @@ return { "concreteType": "Status", "plural": false, "selections": [ - v21, + v20, { "kind": "LinkedField", "alias": null, @@ -1357,7 +1354,7 @@ return { "plural": true, "selections": [ v6, - v21, + v20, { "kind": "ScalarField", "alias": null, @@ -1394,9 +1391,9 @@ return { } ] }, - v21, - v34, - v26, + v20, + v33, + v25, { "kind": "ScalarField", "alias": null, @@ -1422,17 +1419,17 @@ return { "selections": [ v5, v8, - v22, + v21, v6, { "kind": "InlineFragment", "type": "Bot", - "selections": v35 + "selections": v34 }, { "kind": "InlineFragment", "type": "User", - "selections": v35 + "selections": v34 } ] }, @@ -1464,11 +1461,11 @@ return { "alias": null, "name": "timeline", "storageKey": null, - "args": v36, + "args": v35, "concreteType": "PullRequestTimelineConnection", "plural": false, "selections": [ - v31, + v30, { "kind": "LinkedField", "alias": null, @@ -1510,7 +1507,7 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v37 + "selections": v36 }, { "kind": "LinkedField", @@ -1549,7 +1546,7 @@ return { "type": "PullRequest", "selections": [ v11, - v34, + v33, v13, { "kind": "ScalarField", @@ -1565,7 +1562,7 @@ return { "type": "Issue", "selections": [ v11, - v34, + v33, v13, { "kind": "ScalarField", @@ -1584,7 +1581,7 @@ return { "kind": "InlineFragment", "type": "CommitCommentThread", "selections": [ - v38, + v37, { "kind": "LinkedField", "alias": null, @@ -1628,13 +1625,13 @@ return { "args": null, "concreteType": null, "plural": false, - "selections": v37 + "selections": v36 }, - v38, + v37, + v25, + v28, v26, - v29, - v27, - v28 + v27 ] } ] @@ -1647,7 +1644,7 @@ return { "kind": "InlineFragment", "type": "HeadRefForcePushedEvent", "selections": [ - v39, + v38, { "kind": "LinkedField", "alias": null, @@ -1656,7 +1653,7 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v20 + "selections": v19 }, { "kind": "LinkedField", @@ -1666,17 +1663,17 @@ return { "args": null, "concreteType": "Commit", "plural": false, - "selections": v20 + "selections": v19 }, - v29 + v28 ] }, { "kind": "InlineFragment", "type": "MergedEvent", "selections": [ - v39, v38, + v37, { "kind": "ScalarField", "alias": null, @@ -1684,16 +1681,16 @@ return { "args": null, "storageKey": null }, - v29 + v28 ] }, { "kind": "InlineFragment", "type": "IssueComment", "selections": [ + v24, v25, - v26, - v29, + v28, v13 ] }, @@ -1711,8 +1708,8 @@ return { "plural": false, "selections": [ v7, - v40, - v22 + v39, + v21 ] }, { @@ -1725,8 +1722,8 @@ return { "plural": false, "selections": [ v7, - v22, - v40 + v21, + v39 ] }, { @@ -1736,7 +1733,7 @@ return { "args": null, "storageKey": null }, - v32, + v31, { "kind": "ScalarField", "alias": null, @@ -1770,7 +1767,7 @@ return { "kind": "LinkedHandle", "alias": null, "name": "timeline", - "args": v36, + "args": v35, "handle": "connection", "key": "prTimelineContainer_timeline", "filters": null @@ -1799,7 +1796,7 @@ return { "args": null, "concreteType": "ReactingUserConnection", "plural": false, - "selections": v33 + "selections": v32 } ] } From 6cc0b89530d047831c52079f916b968b93f830d8 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 16:50:18 -0800 Subject: [PATCH 052/120] :fire: unused prop Co-Authored-By: Tilde Ann Thurium --- lib/views/pr-review-comments-view.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index 286615ab76..7d437ec71d 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -1,7 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import {Point, Range} from 'atom'; -import {RelayConnectionPropType} from '../prop-types'; import {toNativePathSep} from '../helpers'; import Marker from '../atom/marker'; From 3c21f20c0ef2ad29049bbc1123615066a9b093a8 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 28 Dec 2018 17:21:22 -0800 Subject: [PATCH 053/120] Get rid of hack for ensuring comment threads appear in the right order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No idea why this stopped being necessary... ¯\_(ツ)_/¯ Co-Authored-By: Tilde Ann Thurium --- lib/views/pr-review-comments-view.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index 7d437ec71d..f14da94c3c 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -8,8 +8,6 @@ import Decoration from '../atom/decoration'; import GithubDotcomMarkdown from './github-dotcom-markdown'; import Timeago from './timeago'; -let count = 0; - export default class PullRequestCommentsView extends React.Component { static propTypes = { relay: PropTypes.shape({ @@ -38,7 +36,7 @@ export default class PullRequestCommentsView extends React.Component { // TODO: find way to re-use nodes by using same key. this count++ hack is in place to get the comments to show up // in the correct order after new pages of data are fetched. Test it by reducing the reviewCount to a small number return ( - + {comments.map(comment => { return ( From 287b609981c62a548c034216d0949a26f1bc1c0a Mon Sep 17 00:00:00 2001 From: simurai Date: Wed, 2 Jan 2019 18:00:02 +0900 Subject: [PATCH 054/120] Add borders to comment threads --- lib/views/pr-review-comments-view.js | 2 +- styles/pr-comment.less | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index f14da94c3c..279e4deb51 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -59,7 +59,7 @@ export class PullRequestCommentView extends React.Component { const author = this.props.comment.author; const login = author ? author.login : 'someone'; return ( -
+
{login} {login} commented{' '} diff --git a/styles/pr-comment.less b/styles/pr-comment.less index 427dd1a0b3..65887aef25 100644 --- a/styles/pr-comment.less +++ b/styles/pr-comment.less @@ -2,18 +2,21 @@ @avatar-size: 16px; + +.github-PrCommentThread { + padding: @component-padding/2 0; + border-bottom: 1px solid @base-border-color; +} + + .github-PrComment { + max-width: 60em; + margin: @component-padding 0; + padding-right: @component-padding*2; font-family: @font-family; font-size: @font-size; - &-wrapper { - max-width: 60em; - padding-right: @component-padding*2; - padding-bottom: @component-padding; - } - &-header { - padding: @component-padding 0 @component-padding/2 0; color: @text-color-subtle; } From 2e3a244578d6e8e652868c94b9e79dc18b79ad22 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Wed, 2 Jan 2019 13:41:57 +0100 Subject: [PATCH 055/120] fix some linter errors --- lib/containers/pr-review-comments-container.js | 18 +++++++++++++++++- lib/controllers/multi-file-patch-controller.js | 2 ++ lib/controllers/pr-reviews-controller.js | 3 ++- lib/views/multi-file-patch-view.js | 9 ++++++++- lib/views/pr-review-comments-view.js | 15 +++++++++++++++ 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index a06c19c52b..d0a7ca7c31 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -1,9 +1,24 @@ import {graphql, createPaginationContainer} from 'react-relay'; +import PropTypes from 'prop-types'; import React from 'react'; import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../helpers'; export class ReviewCommentsController extends React.Component { + + static propTypes = { + aggregateComments: PropTypes.func.isRequired, + review: PropTypes.shape({ + id: PropTypes.number.isRequired, + comments: PropTypes.arrayOf(PropTypes.object).isRequired, + }), + relay: PropTypes.shape({ + hasMore: PropTypes.func.isRequired, + loadMore: PropTypes.func.isRequired, + isLoading: PropTypes.func.isRequired, + }).isRequired, + } + componentDidMount() { this.props.aggregateComments(this.props.review.id, this.props.review.comments); this._attemptToLoadMoreComments(); @@ -15,7 +30,8 @@ export class ReviewCommentsController extends React.Component { error => { this._attemptToLoadMoreComments(); if (error) { - console.log(error); + // eslint-disable-next-line no-console + console.error(error); } }, ); diff --git a/lib/controllers/multi-file-patch-controller.js b/lib/controllers/multi-file-patch-controller.js index 0214aa2db9..449747a3d0 100644 --- a/lib/controllers/multi-file-patch-controller.js +++ b/lib/controllers/multi-file-patch-controller.js @@ -25,6 +25,8 @@ export default class MultiFilePatchController extends React.Component { discardLines: PropTypes.func, undoLastDiscard: PropTypes.func, surface: PropTypes.func, + + switchToIssueish: PropTypes.func, } constructor(props) { diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 38479ad8b3..963c9d33bf 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -36,7 +36,8 @@ export default class PullRequestReviewsController extends React.Component { error => { this._attemptToLoadMoreReviews(); if (error) { - console.log(error); + // eslint-disable-next-line no-console + console.error(error); } }, ); diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 7296aee04d..80e46a0b86 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -47,8 +47,10 @@ export default class MultiFilePatchView extends React.Component { keymaps: PropTypes.object.isRequired, tooltips: PropTypes.object.isRequired, config: PropTypes.object.isRequired, + pullRequest: PropTypes.object, selectedRowsChanged: PropTypes.func, + switchToIssueish: PropTypes.func, diveIntoMirrorPatch: PropTypes.func, surface: PropTypes.func, @@ -313,7 +315,12 @@ export default class MultiFilePatchView extends React.Component { renderPullRequestReviews() { if (this.props.itemType === IssueishDetailItem) { - return ; + return ( + ); } else { return null; } diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index 279e4deb51..963abbe122 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -20,6 +20,7 @@ export default class PullRequestCommentsView extends React.Component { comments: PropTypes.arrayOf(PropTypes.object).isRequired, })), multiFilePatch: PropTypes.object.isRequired, + switchToIssueish: PropTypes.func.isRequired, } render() { @@ -55,6 +56,20 @@ export default class PullRequestCommentsView extends React.Component { } export class PullRequestCommentView extends React.Component { + + static propTypes = { + switchToIssueish: PropTypes.func.isRequired, + comment: PropTypes.shape({ + author: PropTypes.shape({ + avatarUrl: PropTypes.string, + login: PropTypes.string, + }), + bodyHTML: PropTypes.string, + url: PropTypes.string, + createdAt: PropTypes.string.isRequired, + }).isRequired, + } + render() { const author = this.props.comment.author; const login = author ? author.login : 'someone'; From 7c14d0c75f5886773e95320d7f533acb7d5fd623 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Wed, 2 Jan 2019 14:22:22 +0100 Subject: [PATCH 056/120] make tests run --- lib/containers/pr-review-comments-container.js | 2 +- test/views/pr-comments-view.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index d0a7ca7c31..6e634e3ca3 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -9,7 +9,7 @@ export class ReviewCommentsController extends React.Component { static propTypes = { aggregateComments: PropTypes.func.isRequired, review: PropTypes.shape({ - id: PropTypes.number.isRequired, + id: PropTypes.string.isRequired, comments: PropTypes.arrayOf(PropTypes.object).isRequired, }), relay: PropTypes.shape({ diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index ccb7b78673..7be8aa440a 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -3,7 +3,7 @@ import {shallow} from 'enzyme'; import {multiFilePatchBuilder} from '../builder/patch'; import {pullRequestBuilder} from '../builder/pr'; -import PullRequestCommentsView, {PullRequestCommentView} from '../../lib/views/pr-comments-view'; +import PullRequestCommentsView, {PullRequestCommentView} from '../../lib/views/pr-review-comments-view'; describe('PullRequestCommentsView', function() { it('adjusts the position for comments after hunk headers', function() { From 1bdb59e02ae4106d6e995bb0eb0ce025a35cc4dd Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Wed, 2 Jan 2019 16:44:24 +0100 Subject: [PATCH 057/120] compute comment threads in pr builder helper --- test/builder/pr.js | 23 +++++++++++++++++++++++ test/views/pr-comments-view.test.js | 5 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/test/builder/pr.js b/test/builder/pr.js index 24758ece0b..63352c8e8b 100644 --- a/test/builder/pr.js +++ b/test/builder/pr.js @@ -8,6 +8,7 @@ class CommentBuilder { this._url = 'https://github.com/atom/github/pull/1829/files#r242224689'; this._createdAt = 0; this._body = 'Lorem ipsum dolor sit amet, te urbanitas appellantur est.'; + this._replyTo = null; } id(i) { @@ -50,6 +51,11 @@ class CommentBuilder { return this; } + replyTo(replyToId) { + this._replyTo = replyToId; + return this; + } + build() { return { id: this._id, @@ -62,6 +68,7 @@ class CommentBuilder { position: this._position, createdAt: this._createdAt, url: this._url, + replyTo: this._replyTo, }; } } @@ -115,8 +122,24 @@ class PullRequestBuilder { } build() { + const commentThreads = {}; + this._reviews.forEach(review => { + review.comments.nodes.forEach(comment => { + if (comment.replyTo && commentThreads[comment.replyTo]) { + commentThreads[comment.replyTo].push(comment); + } else { + commentThreads[comment.id] = [comment]; + } + }); + }); return { reviews: {nodes: this._reviews}, + commentThreads: Object.keys(commentThreads).map(rootCommentId => { + return { + rootCommentId, + comments: commentThreads[rootCommentId], + }; + }), }; } } diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index 7be8aa440a..75e5f4d7fc 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -31,12 +31,13 @@ describe('PullRequestCommentsView', function() { }) .build(); - const wrapper = shallow(); + const wrapper = shallow(); assert.deepEqual(wrapper.find('Marker').at(0).prop('bufferRange').serialize(), [[1, 0], [1, 0]]); assert.deepEqual(wrapper.find('Marker').at(1).prop('bufferRange').serialize(), [[12, 0], [12, 0]]); assert.deepEqual(wrapper.find('Marker').at(2).prop('bufferRange').serialize(), [[20, 0], [20, 0]]); }); + it('does not render comment if position is null', function() { const {multiFilePatch} = multiFilePatchBuilder() .addFilePatch(fp => { @@ -56,7 +57,7 @@ describe('PullRequestCommentsView', function() { }) .build(); - const wrapper = shallow(); + const wrapper = shallow(); const comments = wrapper.find('PullRequestCommentView'); assert.lengthOf(comments, 1); From 3b61634adf5339a29e8e9ca0ead8909a590e96af Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Wed, 2 Jan 2019 13:03:23 -0800 Subject: [PATCH 058/120] :fire: stale todo --- lib/views/pr-review-comments-view.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index 963abbe122..ea926a730d 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -34,8 +34,6 @@ export default class PullRequestCommentsView extends React.Component { const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, rootComment.position); const point = new Point(row, 0); const range = new Range(point, point); - // TODO: find way to re-use nodes by using same key. this count++ hack is in place to get the comments to show up - // in the correct order after new pages of data are fetched. Test it by reducing the reviewCount to a small number return ( From f47c68b7ae3456a62c763eedec139895841b027f Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 2 Jan 2019 12:08:46 -0800 Subject: [PATCH 059/120] follow bare container component naming convention --- lib/containers/pr-review-comments-container.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 6e634e3ca3..d1e8789740 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -4,7 +4,7 @@ import React from 'react'; import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../helpers'; -export class ReviewCommentsController extends React.Component { +export class BarePullRequestReviewCommentsContainer extends React.Component { static propTypes = { aggregateComments: PropTypes.func.isRequired, @@ -56,7 +56,7 @@ export class ReviewCommentsController extends React.Component { } } -export default createPaginationContainer(ReviewCommentsController, { +export default createPaginationContainer(BarePullRequestReviewCommentsContainer, { review: graphql` fragment prReviewCommentsContainer_review on PullRequestReview @argumentDefinitions( From 72af9951a97da9b1df7c62df0aa25c63cc9cfe87 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 3 Jan 2019 15:37:28 -0800 Subject: [PATCH 060/120] Fix issue with comment grouping Previously, we were not grouping comments correctly if there were multiple pages of comments. The best approach we found was to wait until we have all reviews and all comments, and then group them by root comment ID. Co-Authored-By: Katrina Uychaco --- .../issueishDetailContainerQuery.graphql.js | 5 +- .../prReviewCommentsContainerQuery.graphql.js | 12 ++- ...rReviewCommentsContainer_review.graphql.js | 10 ++- .../prReviewsContainerQuery.graphql.js | 5 +- .../pr-review-comments-container.js | 9 ++- lib/controllers/pr-reviews-controller.js | 73 ++++++++++++------- .../prDetailViewRefetchQuery.graphql.js | 5 +- 7 files changed, 80 insertions(+), 39 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 6f0b3544a4..0ee982a7d9 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 8593181024464fe44267e78f2c66b059 + * @relayHash 86a6d997a1bfd3d4f567397ecdaa752b */ /* eslint-disable */ @@ -540,6 +540,7 @@ fragment prCommitView_item on Commit { fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { id + submittedAt comments(first: $commentCount, after: $commentCursor) { pageInfo { hasNextPage @@ -1206,7 +1207,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", diff --git a/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js index 6fc33f5de0..0904ea42ba 100644 --- a/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash aa28e03673267c061792b18ed9e13038 + * @relayHash 5e0b465f16f55322d70100cd893a1c04 */ /* eslint-disable */ @@ -44,6 +44,7 @@ query prReviewCommentsContainerQuery( fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { id + submittedAt comments(first: $commentCount, after: $commentCursor) { pageInfo { hasNextPage @@ -138,7 +139,7 @@ return { "operationKind": "query", "name": "prReviewCommentsContainerQuery", "id": null, - "text": "query prReviewCommentsContainerQuery(\n $commentCount: Int!\n $commentCursor: String\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on PullRequestReview {\n ...prReviewCommentsContainer_review_1VbUmL\n }\n id\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewCommentsContainerQuery(\n $commentCount: Int!\n $commentCursor: String\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on PullRequestReview {\n ...prReviewCommentsContainer_review_1VbUmL\n }\n id\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -204,6 +205,13 @@ return { "kind": "InlineFragment", "type": "PullRequestReview", "selections": [ + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, { "kind": "LinkedField", "alias": null, diff --git a/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js b/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js index 7f1b8d16e1..aec8134452 100644 --- a/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js +++ b/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js @@ -12,6 +12,7 @@ import type { FragmentReference } from "relay-runtime"; declare export opaque type prReviewCommentsContainer_review$ref: FragmentReference; export type prReviewCommentsContainer_review = {| +id: string, + +submittedAt: ?any, +comments: {| +pageInfo: {| +hasNextPage: boolean, @@ -81,6 +82,13 @@ return { ], "selections": [ v0, + { + "kind": "ScalarField", + "alias": null, + "name": "submittedAt", + "args": null, + "storageKey": null + }, { "kind": "LinkedField", "alias": "comments", @@ -230,5 +238,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'd2db363653fb73e8f4d019026668babc'; +(node/*: any*/).hash = '63492273ddd049ed59809581c7795811'; module.exports = node; diff --git a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js index 63254fbff3..7e64650ea5 100644 --- a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash a2fda52ce9272b72cf214c6bcd70719a + * @relayHash 455845bc2fe2987a2c32d72dbc9247b6 */ /* eslint-disable */ @@ -89,6 +89,7 @@ fragment prReviewsContainer_pullRequest_y4qc0 on PullRequest { fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { id + submittedAt comments(first: $commentCount, after: $commentCursor) { pageInfo { hasNextPage @@ -262,7 +263,7 @@ return { "operationKind": "query", "name": "prReviewsContainerQuery", "id": null, - "text": "query prReviewsContainerQuery(\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_y4qc0\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewsContainerQuery(\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_y4qc0\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index d1e8789740..67151ff784 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -7,9 +7,10 @@ import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../helpers'; export class BarePullRequestReviewCommentsContainer extends React.Component { static propTypes = { - aggregateComments: PropTypes.func.isRequired, + collectComments: PropTypes.func.isRequired, review: PropTypes.shape({ id: PropTypes.string.isRequired, + submittedAt: PropTypes.string.isRequired, comments: PropTypes.arrayOf(PropTypes.object).isRequired, }), relay: PropTypes.shape({ @@ -20,14 +21,17 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { } componentDidMount() { - this.props.aggregateComments(this.props.review.id, this.props.review.comments); this._attemptToLoadMoreComments(); + const {submittedAt, comments, id} = this.props.review; + this.props.collectComments({reviewId: id, submittedAt, comments, hasMore: this.props.relay.hasMore()}); } _loadMoreComments = () => { this.props.relay.loadMore( PAGE_SIZE, error => { + const {submittedAt, comments, id} = this.props.review; + this.props.collectComments({reviewId: id, submittedAt, comments, hasMore: this.props.relay.hasMore()}); this._attemptToLoadMoreComments(); if (error) { // eslint-disable-next-line no-console @@ -64,6 +68,7 @@ export default createPaginationContainer(BarePullRequestReviewCommentsContainer, commentCursor: {type: "String"} ) { id + submittedAt comments( first: $commentCount, after: $commentCursor diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 963c9d33bf..dca64a9bfa 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -24,6 +24,7 @@ export default class PullRequestReviewsController extends React.Component { constructor(props) { super(props); this.state = {}; + this.reviewsById = new Map(); } componentDidMount() { @@ -57,40 +58,15 @@ export default class PullRequestReviewsController extends React.Component { } } - aggregateComments = (reviewId, comments) => { - // react batches calls to setState and does not update state synchronously - // therefore we need an intermediate state so we can do checks against keys - // we have just added. - const state = this.state; - comments.edges.forEach(({node}) => { - const comment = node; - if (!comment.replyTo) { - state[comment.id] = [comment]; - } else { - // When comment being replied to is outdated...?? Not 100% sure... - // Why would we even get an outdated comment or a response to one here? - // Ran into this error when viewing files for https://github.com/numpy/numpy/pull/9998 - // for comment MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MzA1NTUzMw, - // who's replyTo comment is an outdated comment - if (!state[comment.replyTo.id]) { - state[comment.id] = [comment]; - } else { - state[comment.replyTo.id].push(comment); - } - } - }); - this.setState(state); - } - renderCommentFetchingContainers() { - // Aggregate comments from all reviews - return this.props.pullRequest.reviews.edges.map(({node}) => { + this.props.pullRequest.reviews.edges.map(({node}) => { const review = node; + return ( ); }); @@ -124,4 +100,45 @@ export default class PullRequestReviewsController extends React.Component { ); } + + collectComments = ({reviewId, submittedAt, comments, hasMore}) => { + this.reviewsById.set(reviewId, {submittedAt, comments, hasMore}); + const noMoreReviewsToFetch = !this.props.relay.hasMore(); + if (noMoreReviewsToFetch) { + const noMoreCommentsToFetch = [...this.reviewsById.values()].every(review => !review.hasMore) + if (noMoreCommentsToFetch) { + this.groupCommentsByThread(); + } + } + } + + groupCommentsByThread() { + // TODO make sure they're sorted according to submitted at + + // react batches calls to setState and does not update state synchronously + // therefore we need an intermediate state so we can do checks against keys + // we have just added. + const state = {}; + [...this.reviewsById.values()].forEach(({comments}) => { + comments.edges.forEach(({node}) => { + const comment = node; + if (!comment.replyTo) { + state[comment.id] = [comment]; + } else { + // When comment being replied to is outdated...?? Not 100% sure... + // Why would we even get an outdated comment or a response to one here? + // Ran into this error when viewing files for https://github.com/numpy/numpy/pull/9998 + // for comment MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MzA1NTUzMw, + // who's replyTo comment is an outdated comment + if (!state[comment.replyTo.id]) { + state[comment.id] = [comment]; + } else { + state[comment.replyTo.id].push(comment); + } + } + }); + }) + + this.setState(state); + } } diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index d75b7040e7..8b5d424baa 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 7e3a37960cf0fb44d162883d95c9838d + * @relayHash 631a28049723f0b6b8a3f8eb25a4f955 */ /* eslint-disable */ @@ -456,6 +456,7 @@ fragment prCommitView_item on Commit { fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { id + submittedAt comments(first: $commentCount, after: $commentCursor) { pageInfo { hasNextPage @@ -884,7 +885,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", From 033c18d4744a6e06ce7a1d257481686d4ddef752 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 3 Jan 2019 15:59:39 -0800 Subject: [PATCH 061/120] render helpers actually need to return some jsx, dawg --- lib/controllers/pr-reviews-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index dca64a9bfa..6dc8050e23 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -59,7 +59,7 @@ export default class PullRequestReviewsController extends React.Component { } renderCommentFetchingContainers() { - this.props.pullRequest.reviews.edges.map(({node}) => { + return this.props.pullRequest.reviews.edges.map(({node}) => { const review = node; return ( From 065c78bff8d060a2d7efa36bedcc4090ecbfd8b6 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 3 Jan 2019 16:21:52 -0800 Subject: [PATCH 062/120] sort reviews by date --- lib/controllers/pr-reviews-controller.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 6dc8050e23..c5976e1a58 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -113,13 +113,24 @@ export default class PullRequestReviewsController extends React.Component { } groupCommentsByThread() { - // TODO make sure they're sorted according to submitted at + // we have no guarantees that reviews will return in order so sort them by date. + const sortedReviews = [...this.reviewsById.values()].sort((a, b) => { + const dateA = new Date(a.submittedAt); + const dateB = new Date(b.submittedAt); + if (dateA > dateB) { + return 1; + } else if (dateB > dateA) { + return -1; + } else { + return 0; + } + }); // react batches calls to setState and does not update state synchronously // therefore we need an intermediate state so we can do checks against keys // we have just added. const state = {}; - [...this.reviewsById.values()].forEach(({comments}) => { + sortedReviews.forEach(({comments}) => { comments.edges.forEach(({node}) => { const comment = node; if (!comment.replyTo) { From be7659698210dbd43742919ea6ab949099ce92b0 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 3 Jan 2019 16:26:31 -0800 Subject: [PATCH 063/120] :art: move sort comparator to be its own function --- lib/controllers/pr-reviews-controller.js | 25 +++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index c5976e1a58..f70ef509ea 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -101,6 +101,19 @@ export default class PullRequestReviewsController extends React.Component { ); } + // sorts reviews by date ascending (oldest to newest) + sortComparator(a, b) { + const dateA = new Date(a.submittedAt); + const dateB = new Date(b.submittedAt); + if (dateA > dateB) { + return 1; + } else if (dateB > dateA) { + return -1; + } else { + return 0; + } + } + collectComments = ({reviewId, submittedAt, comments, hasMore}) => { this.reviewsById.set(reviewId, {submittedAt, comments, hasMore}); const noMoreReviewsToFetch = !this.props.relay.hasMore(); @@ -114,17 +127,7 @@ export default class PullRequestReviewsController extends React.Component { groupCommentsByThread() { // we have no guarantees that reviews will return in order so sort them by date. - const sortedReviews = [...this.reviewsById.values()].sort((a, b) => { - const dateA = new Date(a.submittedAt); - const dateB = new Date(b.submittedAt); - if (dateA > dateB) { - return 1; - } else if (dateB > dateA) { - return -1; - } else { - return 0; - } - }); + const sortedReviews = [...this.reviewsById.values()].sort(this.sortComparator); // react batches calls to setState and does not update state synchronously // therefore we need an intermediate state so we can do checks against keys From 5706820aaca0a9ed2ed1eaf332af088f447de365 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 3 Jan 2019 16:30:12 -0800 Subject: [PATCH 064/120] :shirt: --- lib/controllers/pr-reviews-controller.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index f70ef509ea..282793e740 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -109,8 +109,8 @@ export default class PullRequestReviewsController extends React.Component { return 1; } else if (dateB > dateA) { return -1; - } else { - return 0; + } else { + return 0; } } @@ -118,7 +118,7 @@ export default class PullRequestReviewsController extends React.Component { this.reviewsById.set(reviewId, {submittedAt, comments, hasMore}); const noMoreReviewsToFetch = !this.props.relay.hasMore(); if (noMoreReviewsToFetch) { - const noMoreCommentsToFetch = [...this.reviewsById.values()].every(review => !review.hasMore) + const noMoreCommentsToFetch = [...this.reviewsById.values()].every(review => !review.hasMore); if (noMoreCommentsToFetch) { this.groupCommentsByThread(); } @@ -151,7 +151,7 @@ export default class PullRequestReviewsController extends React.Component { } } }); - }) + }); this.setState(state); } From 1c9912003d732c77d54b2ef24dae93f2e1b76ddb Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 3 Jan 2019 16:32:03 -0800 Subject: [PATCH 065/120] to the PropTypes mobile, batman!! --- lib/containers/pr-review-comments-container.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 67151ff784..5e5f0f24c1 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -11,7 +11,7 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { review: PropTypes.shape({ id: PropTypes.string.isRequired, submittedAt: PropTypes.string.isRequired, - comments: PropTypes.arrayOf(PropTypes.object).isRequired, + comments: PropTypes.object.isRequired, }), relay: PropTypes.shape({ hasMore: PropTypes.func.isRequired, From 915947102ffeee6667ee957f24349ba5159cefce Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 3 Jan 2019 17:02:30 -0800 Subject: [PATCH 066/120] add some tests for `PullRequestReviewCommentsContainer` --- .../pr-review-comments-container.test.js | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 test/containers/pr-review-comments-container.test.js diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js new file mode 100644 index 0000000000..fe83100f18 --- /dev/null +++ b/test/containers/pr-review-comments-container.test.js @@ -0,0 +1,72 @@ +import React from 'react'; +import {shallow} from 'enzyme'; + +import {BarePullRequestReviewCommentsContainer} from '../../lib/containers/pr-review-comments-container'; + +describe('PullRequestReviewCommentsContainer', function() { + function buildApp(opts, overrideProps = {}) { + const o = { + relayHasMore: () => { return false; }, + relayLoadMore: () => {}, + relayIsLoading: () => { return false; }, + ...opts, + }; + + const props = { + relay: { + hasMore: o.relayHasMore, + loadMore: o.relayLoadMore, + isLoading: o.relayIsLoading, + }, + collectComments: () => {}, + review: { + id: '123', + submittedAt: '2018-12-27T20:40:55Z', + comments: {edges: ['this kiki is marvelous']}, + }, + ...overrideProps, + }; + return ; + } + it('aggregates the comments after component has been mounted', function() { + const collectCommentsStub = sinon.stub(); + shallow(buildApp({}, {collectComments: collectCommentsStub})); + assert.strictEqual(collectCommentsStub.callCount, 1); + const args = collectCommentsStub.lastCall.args[0]; + + assert.strictEqual(args.reviewId, '123'); + assert.strictEqual(args.submittedAt, '2018-12-27T20:40:55Z'); + assert.deepEqual(args.comments, {edges: ['this kiki is marvelous']}); + assert.isFalse(args.hasMore); + }); + + it('attempts to load comments after component has been mounted', function() { + const wrapper = shallow(buildApp()); + sinon.stub(wrapper.instance(), '_attemptToLoadMoreComments'); + wrapper.instance().componentDidMount(); + + }); + + + describe('loadMoreComments', function() { + it('calls this.props.relay.loadMore with correct arguments', function() { + }); + }); + + it('handles errors', function() { + + }); + + describe('attemptToLoadMoreComments', function() { + it('does not call loadMore if hasMore prop is falsy', function() { + }); + + it('calls loadMore immediately if not already loading more', function() { + }); + + it('if already loading more, calls loadMore after a timeout', function() { + }); + + }); + +}); From 3f61b5dea358101c882d83820e3408df0448f981 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 3 Jan 2019 17:57:09 -0800 Subject: [PATCH 067/120] add some more tests for PullRequestReviewCommentsContainer Co-Authored-By: Katrina Uychaco --- .../pr-review-comments-container.test.js | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index fe83100f18..d37df302fc 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -1,6 +1,8 @@ import React from 'react'; import {shallow} from 'enzyme'; +import {PAGE_SIZE} from '../../lib/helpers'; + import {BarePullRequestReviewCommentsContainer} from '../../lib/containers/pr-review-comments-container'; describe('PullRequestReviewCommentsContainer', function() { @@ -28,7 +30,7 @@ describe('PullRequestReviewCommentsContainer', function() { }; return ; } - it('aggregates the comments after component has been mounted', function() { + it('collects the comments after component has been mounted', function() { const collectCommentsStub = sinon.stub(); shallow(buildApp({}, {collectComments: collectCommentsStub})); assert.strictEqual(collectCommentsStub.callCount, 1); @@ -44,19 +46,48 @@ describe('PullRequestReviewCommentsContainer', function() { const wrapper = shallow(buildApp()); sinon.stub(wrapper.instance(), '_attemptToLoadMoreComments'); wrapper.instance().componentDidMount(); - + assert.strictEqual(wrapper.instance()._attemptToLoadMoreComments.callCount, 1); }); describe('loadMoreComments', function() { - it('calls this.props.relay.loadMore with correct arguments', function() { + it('calls this.props.relay.loadMore with correct args', function() { + const relayLoadMoreStub = sinon.stub(); + const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); + wrapper.instance()._loadMoreComments(); + + const args = relayLoadMoreStub.lastCall.args; + assert.strictEqual(args[0], PAGE_SIZE); + assert.strictEqual(args[1], wrapper.instance().onDidLoadMore); }); }); - it('handles errors', function() { + describe('onDidLoadMore', function() { + it('collects comments and attempts to load more comments', function() { + const collectCommentsStub = sinon.stub(); + const wrapper = shallow(buildApp({}, {collectComments: collectCommentsStub})); + // collect comments is called when mounted, we don't care about that in this test so reset the count + collectCommentsStub.reset(); + sinon.stub(wrapper.instance(), '_attemptToLoadMoreComments'); + wrapper.instance().onDidLoadMore(); + + assert.strictEqual(collectCommentsStub.callCount, 1); + const args = collectCommentsStub.lastCall.args[0]; + + assert.strictEqual(args.reviewId, '123'); + assert.strictEqual(args.submittedAt, '2018-12-27T20:40:55Z'); + assert.deepEqual(args.comments, {edges: ['this kiki is marvelous']}); + assert.isFalse(args.hasMore); + }); + + it('handles errors', function() { + + }); + }); + describe('attemptToLoadMoreComments', function() { it('does not call loadMore if hasMore prop is falsy', function() { }); From 968ad4da85012601231f8f9d201d6bdba4854667 Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 4 Jan 2019 20:07:55 +0900 Subject: [PATCH 068/120] Put comments into boxes --- styles/pr-comment.less | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/styles/pr-comment.less b/styles/pr-comment.less index 65887aef25..f2ff654985 100644 --- a/styles/pr-comment.less +++ b/styles/pr-comment.less @@ -1,30 +1,45 @@ @import 'variables'; @avatar-size: 16px; +@avatar-spacing: 6px; .github-PrCommentThread { - padding: @component-padding/2 0; - border-bottom: 1px solid @base-border-color; + padding: @component-padding 0; } .github-PrComment { max-width: 60em; - margin: @component-padding 0; - padding-right: @component-padding*2; + padding: @component-padding; font-family: @font-family; font-size: @font-size; + border: 1px solid @base-border-color; + + &:first-child { + border-top-left-radius: @component-border-radius; + border-top-right-radius: @component-border-radius; + } + &:last-child { + border-bottom-left-radius: @component-border-radius; + border-bottom-right-radius: @component-border-radius; + } + + & + .github-PrComment { + border-top: none; + } &-header { color: @text-color-subtle; + line-height: @avatar-size; } &-avatar { - margin-right: 4px; + margin-right: @avatar-spacing; height: @avatar-size; width: @avatar-size; border-radius: @component-border-radius; + vertical-align: top; } &-timeAgo { @@ -32,7 +47,7 @@ } &-body { - margin-left: @avatar-size + 4px; // avatar + margin + margin-left: @avatar-size + @avatar-spacing; // avatar + margin } } From b36f05bcca7fd71671305dff5473c26ed9d818e7 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 10:58:45 -0800 Subject: [PATCH 069/120] import PAGE_SIZE in `IssueishDetailContainer` tests --- test/containers/issueish-detail-container.test.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/containers/issueish-detail-container.test.js b/test/containers/issueish-detail-container.test.js index 934f24df9f..d8323e8f89 100644 --- a/test/containers/issueish-detail-container.test.js +++ b/test/containers/issueish-detail-container.test.js @@ -5,6 +5,7 @@ import {cloneRepository, buildRepository} from '../helpers'; import {expectRelayQuery} from '../../lib/relay-network-layer-manager'; import {issueishDetailContainerProps} from '../fixtures/props/issueish-pane-props'; import {createPullRequestDetailResult} from '../fixtures/factories/pull-request-result'; +import {PAGE_SIZE} from '../../lib/helpers'; import GithubLoginModel from '../../lib/models/github-login-model'; import {InMemoryStrategy, UNAUTHENTICATED} from '../../lib/shared/keytar-strategy'; import IssueishDetailContainer from '../../lib/containers/issueish-detail-container'; @@ -26,12 +27,14 @@ describe('IssueishDetailContainer', function() { repoOwner: 'owner', repoName: 'repo', issueishNumber: 1, - timelineCount: 100, + timelineCount: PAGE_SIZE, timelineCursor: null, - commitCount: 100, + commitCount: PAGE_SIZE, commitCursor: null, - commentCount: 100, + commentCount: PAGE_SIZE, commentCursor: null, + reviewCount: PAGE_SIZE, + reviewCursor: null, }, }, { repository: { From bf3d4c17f842059ee0eaf78bb0c3087159a66f7f Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 11:02:08 -0800 Subject: [PATCH 070/120] import PAGE_SIXE in checkout pr integration tests --- test/integration/checkout-pr.test.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration/checkout-pr.test.js b/test/integration/checkout-pr.test.js index a15a1adced..6509d22b8a 100644 --- a/test/integration/checkout-pr.test.js +++ b/test/integration/checkout-pr.test.js @@ -2,6 +2,7 @@ import hock from 'hock'; import http from 'http'; import {setup, teardown} from './helpers'; +import {PAGE_SIZE} from '../../lib/helpers'; import {expectRelayQuery} from '../../lib/relay-network-layer-manager'; import GitShellOutStrategy from '../../lib/git-shell-out-strategy'; import {createRepositoryResult} from '../fixtures/factories/repository-result'; @@ -136,11 +137,13 @@ describe('integration: check out a pull request', function() { repoOwner: 'owner', repoName: 'repo', issueishNumber: 1, - timelineCount: 100, + timelineCount: PAGE_SIZE, timelineCursor: null, - commitCount: 100, + commitCount: PAGE_SIZE, commitCursor: null, - commentCount: 100, + reviewCount: PAGE_SIZE, + reviewCursor: null, + commentCount: PAGE_SIZE, commentCursor: null, }, }, result); From e927e76c1c67819762785074a4e7952b590493ed Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 11:07:32 -0800 Subject: [PATCH 071/120] extract callback into its own function for better testability Co-Authored-By: Katrina Uychaco --- .../pr-review-comments-container.js | 20 ++++++++++--------- .../pr-review-comments-container.test.js | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 5e5f0f24c1..885da598ff 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -26,18 +26,20 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { this.props.collectComments({reviewId: id, submittedAt, comments, hasMore: this.props.relay.hasMore()}); } + onDidLoadMore = error => { + const {submittedAt, comments, id} = this.props.review; + this.props.collectComments({reviewId: id, submittedAt, comments, hasMore: this.props.relay.hasMore()}); + this._attemptToLoadMoreComments(); + if (error) { + // eslint-disable-next-line no-console + console.error(error); + } + } + _loadMoreComments = () => { this.props.relay.loadMore( PAGE_SIZE, - error => { - const {submittedAt, comments, id} = this.props.review; - this.props.collectComments({reviewId: id, submittedAt, comments, hasMore: this.props.relay.hasMore()}); - this._attemptToLoadMoreComments(); - if (error) { - // eslint-disable-next-line no-console - console.error(error); - } - }, + this.onDidLoadMore, ); } diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index d37df302fc..c9477a195c 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -89,7 +89,7 @@ describe('PullRequestReviewCommentsContainer', function() { describe('attemptToLoadMoreComments', function() { - it('does not call loadMore if hasMore prop is falsy', function() { + it('does not call loadMore if hasMore is false', function() { }); it('calls loadMore immediately if not already loading more', function() { From 083c048b726f14964b9e4c3b5dd04c4047ffc6c3 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 13:45:36 -0800 Subject: [PATCH 072/120] moar tests for `PullRequestReviewCommentsContainer` --- .../pr-review-comments-container.test.js | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index c9477a195c..342909610f 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -1,7 +1,7 @@ import React from 'react'; import {shallow} from 'enzyme'; -import {PAGE_SIZE} from '../../lib/helpers'; +import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../../lib/helpers'; import {BarePullRequestReviewCommentsContainer} from '../../lib/containers/pr-review-comments-container'; @@ -89,15 +89,53 @@ describe('PullRequestReviewCommentsContainer', function() { describe('attemptToLoadMoreComments', function() { - it('does not call loadMore if hasMore is false', function() { + let clock; + beforeEach(function() { + clock = sinon.useFakeTimers(); + }); + afterEach(function() { + clock = sinon.restore(); }); + it('does not call loadMore if hasMore is false', function() { + const relayLoadMoreStub = sinon.stub(); + const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); + relayLoadMoreStub.reset(); - it('calls loadMore immediately if not already loading more', function() { + wrapper.instance()._attemptToLoadMoreComments(); + assert.strictEqual(relayLoadMoreStub.callCount, 0); }); - it('if already loading more, calls loadMore after a timeout', function() { + it('calls loadMore immediately if hasMore is true and isLoading is false', function() { + const relayLoadMoreStub = sinon.stub(); + const relayHasMore = () => { return true; }; + const wrapper = shallow(buildApp({relayHasMore, relayLoadMore: relayLoadMoreStub})); + relayLoadMoreStub.reset(); + + wrapper.instance()._attemptToLoadMoreComments(); + assert.strictEqual(relayLoadMoreStub.callCount, 1); + const args = relayLoadMoreStub.lastCall.args; + assert.strictEqual(args[0], PAGE_SIZE); + assert.strictEqual(args[1], wrapper.instance().onDidLoadMore); }); + it('calls loadMore after a timeout if hasMore is true and isLoading is true', function() { + const relayLoadMoreStub = sinon.stub(); + const relayHasMore = () => { return true; }; + const relayIsLoading = () => { return true; }; + const wrapper = shallow(buildApp({relayHasMore, relayIsLoading, relayLoadMore: relayLoadMoreStub})); + // advancing the timer and resetting the stub to clear the initial calls of + // _attemptToLoadMoreComments when the component is initially mounted. + clock.tick(PAGINATION_WAIT_TIME_MS); + relayLoadMoreStub.reset(); + + wrapper.instance()._attemptToLoadMoreComments(); + assert.strictEqual(relayLoadMoreStub.callCount, 0); + + clock.tick(PAGINATION_WAIT_TIME_MS); + assert.strictEqual(relayLoadMoreStub.callCount, 1); + const args = relayLoadMoreStub.lastCall.args; + assert.strictEqual(args[0], PAGE_SIZE); + assert.strictEqual(args[1], wrapper.instance().onDidLoadMore); + }); }); - }); From 1e24ba2287f0224a7e4971f546d2181ac602efee Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 13:45:47 -0800 Subject: [PATCH 073/120] :fire: unnecessary arrow function --- lib/containers/pr-review-comments-container.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 885da598ff..72cda3b23f 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -49,9 +49,7 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { } if (this.props.relay.isLoading()) { - setTimeout(() => { - this._loadMoreComments(); - }, PAGINATION_WAIT_TIME_MS); + setTimeout(this._loadMoreComments, PAGINATION_WAIT_TIME_MS); } else { this._loadMoreComments(); } From 5f15a181c96a62a1e804d3fd53eee8c46687b96e Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 14:00:32 -0800 Subject: [PATCH 074/120] we don't need that other arrow function either --- lib/controllers/pr-reviews-controller.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 282793e740..f95135643a 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -50,9 +50,7 @@ export default class PullRequestReviewsController extends React.Component { } if (this.props.relay.isLoading()) { - setTimeout(() => { - this._loadMoreReviews(); - }, PAGINATION_WAIT_TIME_MS); + setTimeout(this._loadMoreReviews, PAGINATION_WAIT_TIME_MS); } else { this._loadMoreReviews(); } From cdc717f69361d67e632bcda72bf395a2db6173de Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 14:21:07 -0800 Subject: [PATCH 075/120] pass getBufferRowForDiffPosition function as a prop we don't really need the entire multiFilePatch, dawg. --- lib/controllers/pr-reviews-controller.js | 2 +- lib/models/patch/multi-file-patch.js | 2 +- lib/views/multi-file-patch-view.js | 2 +- lib/views/pr-review-comments-view.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index f95135643a..85d9687cae 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -18,7 +18,7 @@ export default class PullRequestReviewsController extends React.Component { PropTypes.object, ), }), - multiFilePatch: PropTypes.object.isRequired, + getBufferRowForDiffPosition: PropTypes.func.isRequired, } constructor(props) { diff --git a/lib/models/patch/multi-file-patch.js b/lib/models/patch/multi-file-patch.js index 132573214d..e04a498416 100644 --- a/lib/models/patch/multi-file-patch.js +++ b/lib/models/patch/multi-file-patch.js @@ -339,7 +339,7 @@ export default class MultiFilePatch { return false; } - getBufferRowForDiffPosition(fileName, diffRow) { + getBufferRowForDiffPosition = (fileName, diffRow) => { // TODO verify that this works on Windows const {startBufferRow, index} = this.diffRowOffsetIndices.get(fileName); const {offset} = index.lowerBound({diffRow}).data(); diff --git a/lib/views/multi-file-patch-view.js b/lib/views/multi-file-patch-view.js index 80e46a0b86..9d0655b770 100644 --- a/lib/views/multi-file-patch-view.js +++ b/lib/views/multi-file-patch-view.js @@ -318,7 +318,7 @@ export default class MultiFilePatchView extends React.Component { return ( ); } else { diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index ea926a730d..7eb1276902 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -19,7 +19,7 @@ export default class PullRequestCommentsView extends React.Component { rootCommentId: PropTypes.string.isRequired, comments: PropTypes.arrayOf(PropTypes.object).isRequired, })), - multiFilePatch: PropTypes.object.isRequired, + getBufferRowForDiffPosition: PropTypes.func.isRequired, switchToIssueish: PropTypes.func.isRequired, } @@ -31,7 +31,7 @@ export default class PullRequestCommentsView extends React.Component { } const nativePath = toNativePathSep(rootComment.path); - const row = this.props.multiFilePatch.getBufferRowForDiffPosition(nativePath, rootComment.position); + const row = this.props.getBufferRowForDiffPosition(nativePath, rootComment.position); const point = new Point(row, 0); const range = new Range(point, point); return ( From 33a79c25cb7aa89c091ec900e7cbee824be11640 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 17:23:06 -0800 Subject: [PATCH 076/120] Istanbul ignore if statements that handle errors when loading more pages Co-Authored-By: Tilde Ann Thurium --- lib/containers/pr-review-comments-container.js | 2 ++ lib/controllers/pr-reviews-controller.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 72cda3b23f..9b3138f1fd 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -30,6 +30,8 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { const {submittedAt, comments, id} = this.props.review; this.props.collectComments({reviewId: id, submittedAt, comments, hasMore: this.props.relay.hasMore()}); this._attemptToLoadMoreComments(); + + /* istanbul ignore if */ if (error) { // eslint-disable-next-line no-console console.error(error); diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 85d9687cae..62262e9130 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -36,6 +36,8 @@ export default class PullRequestReviewsController extends React.Component { PAGE_SIZE, error => { this._attemptToLoadMoreReviews(); + + /* istanbul ignore if */ if (error) { // eslint-disable-next-line no-console console.error(error); From d913c9fb8de6180836808365f7b627aff506c53d Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 17:24:13 -0800 Subject: [PATCH 077/120] :fire: unnecessary test for error handling Co-Authored-By: Tilde Ann Thurium --- test/containers/pr-review-comments-container.test.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index 342909610f..d690000057 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -30,6 +30,7 @@ describe('PullRequestReviewCommentsContainer', function() { }; return ; } + it('collects the comments after component has been mounted', function() { const collectCommentsStub = sinon.stub(); shallow(buildApp({}, {collectComments: collectCommentsStub})); @@ -49,7 +50,6 @@ describe('PullRequestReviewCommentsContainer', function() { assert.strictEqual(wrapper.instance()._attemptToLoadMoreComments.callCount, 1); }); - describe('loadMoreComments', function() { it('calls this.props.relay.loadMore with correct args', function() { const relayLoadMoreStub = sinon.stub(); @@ -79,23 +79,18 @@ describe('PullRequestReviewCommentsContainer', function() { assert.deepEqual(args.comments, {edges: ['this kiki is marvelous']}); assert.isFalse(args.hasMore); }); - - it('handles errors', function() { - - }); - - }); - describe('attemptToLoadMoreComments', function() { let clock; beforeEach(function() { clock = sinon.useFakeTimers(); }); + afterEach(function() { clock = sinon.restore(); }); + it('does not call loadMore if hasMore is false', function() { const relayLoadMoreStub = sinon.stub(); const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); From e71dbb77a6763fcd0b3651538501dc039ef99a61 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 16:56:12 -0800 Subject: [PATCH 078/120] [wip] add tests for PullRequestReviewsController --- .../controllers/pr-reviews-controller.test.js | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 test/controllers/pr-reviews-controller.test.js diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js new file mode 100644 index 0000000000..7105fcbcff --- /dev/null +++ b/test/controllers/pr-reviews-controller.test.js @@ -0,0 +1,57 @@ +import React from 'react'; +import {shallow} from 'enzyme'; + +import PullRequestReviewsController from '../../lib/controllers/pr-reviews-controller'; + +describe('PullRequestReviewsController', function() { + function buildApp(opts, overrideProps = {}) { + const o = { + relayHasMore: () => { return false; }, + relayLoadMore: () => {}, + relayIsLoading: () => { return false; }, + reveiwSpecs: [], + reviewStartCursor: 0, + ...opts, + }; + + const review = { + edges: o.reviewItemSpecs.map((spec, i) => ({ + cursor: `result${i}`, + node: { + id: spec.id, + __typename: spec.kind, + }, + })), + pageInfo: { + startCursor: `result${o.reviewStartCursor}`, + endCursor: `result${o.reviewStartCursor + o.reviewItemSpecs.length}`, + hasNextPage: o.reviewStartCursor + o.reviewItemSpecs.length < o.reviewItemTotal, + hasPreviousPage: o.reviewStartCursor !== 0, + }, + totalCount: o.reviewItemTotal, + }; + + const props = { + relay: { + hasMore: o.relayHasMore, + loadMore: o.relayLoadMore, + isLoading: o.relayIsLoading, + }, + getBufferRowForDiffPosition: () => {}, + pullRequest: review, + ...overrideProps, + }; + return ; + } + it('renders a PullRequestReviewCommentsContainer for every review', function() { + + }); + + it('renders a PullRequestReviewCommentsView', function() { + + }); + + it('groups the comments into threads once all the data has been fetched', function() { + + }); +}); From 7d76f4f8b8ef3de1111fe4856abfe89a4b2fb6b0 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 17:43:57 -0800 Subject: [PATCH 079/120] give `PullRequestCommentsView` tests the new getBufferRowForDiffPosition prop --- test/views/pr-comments-view.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index 75e5f4d7fc..346542323d 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -31,7 +31,7 @@ describe('PullRequestCommentsView', function() { }) .build(); - const wrapper = shallow(); + const wrapper = shallow(); assert.deepEqual(wrapper.find('Marker').at(0).prop('bufferRange').serialize(), [[1, 0], [1, 0]]); assert.deepEqual(wrapper.find('Marker').at(1).prop('bufferRange').serialize(), [[12, 0], [12, 0]]); @@ -57,7 +57,7 @@ describe('PullRequestCommentsView', function() { }) .build(); - const wrapper = shallow(); + const wrapper = shallow(); const comments = wrapper.find('PullRequestCommentView'); assert.lengthOf(comments, 1); From 2aa93bbcb4a683f9a8bc9e380ec845a630715d76 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 4 Jan 2019 18:20:24 -0800 Subject: [PATCH 080/120] reverse order of comment threads in pr builder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the test was asserting on 3 individual comments, that they rendered in the correct positions. when Katrina implemented grouping comments by thread, she did something like: `[...this.props.commentThreads].reverse().map(({rootCommentId, comments}) => {` tbh I don’t really understand why we need to call `reverse` there but we also need to be calling reverse in the comment builder, so that the tests are doing the same thing as the code. and then there was also a minor problem where we were passing in two comments with the same ID, which is now fixed. --- test/builder/pr.js | 2 +- test/views/pr-comments-view.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/builder/pr.js b/test/builder/pr.js index 63352c8e8b..55f3465fbc 100644 --- a/test/builder/pr.js +++ b/test/builder/pr.js @@ -134,7 +134,7 @@ class PullRequestBuilder { }); return { reviews: {nodes: this._reviews}, - commentThreads: Object.keys(commentThreads).map(rootCommentId => { + commentThreads: Object.keys(commentThreads).reverse().map(rootCommentId => { return { rootCommentId, comments: commentThreads[rootCommentId], diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index 346542323d..1a740bccae 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -27,7 +27,7 @@ describe('PullRequestCommentsView', function() { .addReview(r => { r.addComment(c => c.id(0).path('file0.txt').position(2).body('one')); r.addComment(c => c.id(1).path('file0.txt').position(15).body('three')); - r.addComment(c => c.id(1).path('file1.txt').position(7).body('three')); + r.addComment(c => c.id(2).path('file1.txt').position(7).body('three')); }) .build(); From 47dbdaf626b12c57f6d1de92973a7de69dac6af9 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 17:55:54 -0800 Subject: [PATCH 081/120] :fire: unnecessary commit-related arguments from issueDetailView fragment --- lib/controllers/issueish-detail-controller.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/controllers/issueish-detail-controller.js b/lib/controllers/issueish-detail-controller.js index 697a1f0e96..cd19de9636 100644 --- a/lib/controllers/issueish-detail-controller.js +++ b/lib/controllers/issueish-detail-controller.js @@ -287,7 +287,7 @@ export class BareIssueishDetailController extends React.Component { addEvent('open-commit-in-pane', {package: 'github', from: this.constructor.name}); } } -// todo: we probably don't need to commit count and cursor in the issue fragment + export default createFragmentContainer(BareIssueishDetailController, { repository: graphql` fragment issueishDetailController_repository on Repository @@ -316,8 +316,6 @@ export default createFragmentContainer(BareIssueishDetailController, { ...issueDetailView_issue @arguments( timelineCount: $timelineCount, timelineCursor: $timelineCursor, - commitCount: $commitCount, - commitCursor: $commitCursor, ) } } From bb47ca58a8498983a6f2412d9bb9ea2457d41343 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 18:16:03 -0800 Subject: [PATCH 082/120] Attempt to load more reviews only if no error ... in case we hit an error case where we fall into an infinite loop of retrying --- lib/controllers/pr-reviews-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 62262e9130..9021cfd1fa 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -35,12 +35,12 @@ export default class PullRequestReviewsController extends React.Component { this.props.relay.loadMore( PAGE_SIZE, error => { - this._attemptToLoadMoreReviews(); - /* istanbul ignore if */ if (error) { // eslint-disable-next-line no-console console.error(error); + } else { + this._attemptToLoadMoreReviews(); } }, ); From 99c6cc1e0712128915be4455e84d906d84f252d9 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 18:16:37 -0800 Subject: [PATCH 083/120] :art: re-order methods for readability --- lib/controllers/pr-reviews-controller.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 9021cfd1fa..1e1e2c06fa 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -31,6 +31,18 @@ export default class PullRequestReviewsController extends React.Component { this._attemptToLoadMoreReviews(); } + _attemptToLoadMoreReviews = () => { + if (!this.props.relay.hasMore()) { + return; + } + + if (this.props.relay.isLoading()) { + setTimeout(this._loadMoreReviews, PAGINATION_WAIT_TIME_MS); + } else { + this._loadMoreReviews(); + } + } + _loadMoreReviews = () => { this.props.relay.loadMore( PAGE_SIZE, @@ -46,18 +58,6 @@ export default class PullRequestReviewsController extends React.Component { ); } - _attemptToLoadMoreReviews = () => { - if (!this.props.relay.hasMore()) { - return; - } - - if (this.props.relay.isLoading()) { - setTimeout(this._loadMoreReviews, PAGINATION_WAIT_TIME_MS); - } else { - this._loadMoreReviews(); - } - } - renderCommentFetchingContainers() { return this.props.pullRequest.reviews.edges.map(({node}) => { const review = node; From 816ab62624396cf4ce3ef94ba464d846e3112f6c Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 18:31:36 -0800 Subject: [PATCH 084/120] Update generated relay code after :fire:ing commit-related arguments --- .../issueishDetailContainerQuery.graphql.js | 8 ++-- ...eishDetailController_repository.graphql.js | 38 +++++++++---------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 0ee982a7d9..08c8d4132a 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 86a6d997a1bfd3d4f567397ecdaa752b + * @relayHash b2844afc76c2e9c390039931a9af7d40 */ /* eslint-disable */ @@ -69,7 +69,7 @@ fragment issueishDetailController_repository_y3nHF on Repository { ... on Issue { title number - ...issueDetailView_issue_4cAEh0 + ...issueDetailView_issue_3D8CP9 } ... on Node { id @@ -120,7 +120,7 @@ fragment prDetailView_repository on Repository { } } -fragment issueDetailView_issue_4cAEh0 on Issue { +fragment issueDetailView_issue_3D8CP9 on Issue { __typename ... on Node { id @@ -1207,7 +1207,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_4cAEh0\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_4cAEh0 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_3D8CP9\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_3D8CP9 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", diff --git a/lib/controllers/__generated__/issueishDetailController_repository.graphql.js b/lib/controllers/__generated__/issueishDetailController_repository.graphql.js index 12a4a5d6e8..fa323bdbdd 100644 --- a/lib/controllers/__generated__/issueishDetailController_repository.graphql.js +++ b/lib/controllers/__generated__/issueishDetailController_repository.graphql.js @@ -110,24 +110,12 @@ v5 = { "storageKey": null }, v6 = { - "kind": "Variable", - "name": "commitCount", - "variableName": "commitCount", - "type": null -}, -v7 = { - "kind": "Variable", - "name": "commitCursor", - "variableName": "commitCursor", - "type": null -}, -v8 = { "kind": "Variable", "name": "timelineCount", "variableName": "timelineCount", "type": null }, -v9 = { +v7 = { "kind": "Variable", "name": "timelineCursor", "variableName": "timelineCursor", @@ -228,9 +216,7 @@ return { "name": "issueDetailView_issue", "args": [ v6, - v7, - v8, - v9 + v7 ] } ] @@ -303,8 +289,18 @@ return { "variableName": "commentCursor", "type": null }, - v6, - v7, + { + "kind": "Variable", + "name": "commitCount", + "variableName": "commitCount", + "type": null + }, + { + "kind": "Variable", + "name": "commitCursor", + "variableName": "commitCursor", + "type": null + }, { "kind": "Variable", "name": "reviewCount", @@ -317,8 +313,8 @@ return { "variableName": "reviewCursor", "type": null }, - v8, - v9 + v6, + v7 ] } ] @@ -329,5 +325,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = 'e348cf91ee76425342abf4aa3c60b143'; +(node/*: any*/).hash = 'c06dfbb4f1cc1c45187449da61fd7328'; module.exports = node; From 8eba48bd7fb3f39fdc01933d7c5718ddeefd7c71 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 18:31:55 -0800 Subject: [PATCH 085/120] More :art: for readability. Fix up comment --- lib/controllers/pr-reviews-controller.js | 32 +++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 1e1e2c06fa..0051b5abd5 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -58,20 +58,6 @@ export default class PullRequestReviewsController extends React.Component { ); } - renderCommentFetchingContainers() { - return this.props.pullRequest.reviews.edges.map(({node}) => { - const review = node; - - return ( - - ); - }); - } - render() { if (!this.props.pullRequest || !this.props.pullRequest.reviews) { return null; @@ -84,14 +70,14 @@ export default class PullRequestReviewsController extends React.Component { }; }); - /** Slightly hacky thing to deal with comment threading... + /** Dealing with comment threading... * * Threads can have comments belonging to multiple reviews. * We need a nested pagination container to fetch comment pages. - * Upon fetching new comments, the `aggregateComments` method is called with the comments to add. + * Upon fetching new comments, the `collectComments` method is called with all comments fetched for that review. * Ultimately we want to organize comments based on the root comment they are replies to. * So `renderCommentFetchingContainers` simply fetches data and doesn't render any DOM elements. - * `PullRequestReviewCommentsView` renders the comment thread data aggregated. + * `PullRequestReviewCommentsView` renders the aggregated comment thread data. * */ return ( @@ -101,6 +87,18 @@ export default class PullRequestReviewsController extends React.Component { ); } + renderCommentFetchingContainers() { + return this.props.pullRequest.reviews.edges.map(({node: review}) => { + return ( + + ); + }); + } + // sorts reviews by date ascending (oldest to newest) sortComparator(a, b) { const dateA = new Date(a.submittedAt); From 2c6c8eb54576c2168d04e8cb1cc4c6c528c86de5 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 19:11:44 -0800 Subject: [PATCH 086/120] :art: :art: :art: --- .../pr-review-comments-container.js | 33 ++++++++------ lib/controllers/pr-reviews-controller.js | 44 +++++++++---------- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 9b3138f1fd..c514c9f313 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -21,28 +21,26 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { } componentDidMount() { - this._attemptToLoadMoreComments(); - const {submittedAt, comments, id} = this.props.review; - this.props.collectComments({reviewId: id, submittedAt, comments, hasMore: this.props.relay.hasMore()}); + this.handleComments(); } - onDidLoadMore = error => { - const {submittedAt, comments, id} = this.props.review; - this.props.collectComments({reviewId: id, submittedAt, comments, hasMore: this.props.relay.hasMore()}); - this._attemptToLoadMoreComments(); - + handleComments = error => { /* istanbul ignore if */ if (error) { // eslint-disable-next-line no-console console.error(error); + return; } - } - _loadMoreComments = () => { - this.props.relay.loadMore( - PAGE_SIZE, - this.onDidLoadMore, - ); + const {submittedAt, comments, id} = this.props.review; + this.props.collectComments({ + reviewId: id, + submittedAt, + comments, + fetchingMoreComments: this.props.relay.hasMore(), + }); + + this._attemptToLoadMoreComments(); } _attemptToLoadMoreComments = () => { @@ -57,6 +55,13 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { } } + _loadMoreComments = () => { + this.props.relay.loadMore( + PAGE_SIZE, + this.handleComments, + ); + } + render() { return null; } diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 0051b5abd5..ad3d89b652 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -99,25 +99,12 @@ export default class PullRequestReviewsController extends React.Component { }); } - // sorts reviews by date ascending (oldest to newest) - sortComparator(a, b) { - const dateA = new Date(a.submittedAt); - const dateB = new Date(b.submittedAt); - if (dateA > dateB) { - return 1; - } else if (dateB > dateA) { - return -1; - } else { - return 0; - } - } - - collectComments = ({reviewId, submittedAt, comments, hasMore}) => { - this.reviewsById.set(reviewId, {submittedAt, comments, hasMore}); - const noMoreReviewsToFetch = !this.props.relay.hasMore(); - if (noMoreReviewsToFetch) { - const noMoreCommentsToFetch = [...this.reviewsById.values()].every(review => !review.hasMore); - if (noMoreCommentsToFetch) { + collectComments = ({reviewId, submittedAt, comments, fetchingMoreCommnts}) => { + this.reviewsById.set(reviewId, {submittedAt, comments, fetchingMoreCommnts}); + const stillFetchingReviews = this.props.relay.hasMore(); + if (!stillFetchingReviews) { + const stillFetchingComments = [...this.reviewsById.values()].some(review => review.fetchingMoreCommnts); + if (!stillFetchingComments) { this.groupCommentsByThread(); } } @@ -125,18 +112,18 @@ export default class PullRequestReviewsController extends React.Component { groupCommentsByThread() { // we have no guarantees that reviews will return in order so sort them by date. - const sortedReviews = [...this.reviewsById.values()].sort(this.sortComparator); + const sortedReviews = [...this.reviewsById.values()].sort(this.sortByDate); // react batches calls to setState and does not update state synchronously // therefore we need an intermediate state so we can do checks against keys // we have just added. const state = {}; sortedReviews.forEach(({comments}) => { - comments.edges.forEach(({node}) => { - const comment = node; + comments.edges.forEach(({node: comment}) => { if (!comment.replyTo) { state[comment.id] = [comment]; } else { + // TODO: look at this more closely... // When comment being replied to is outdated...?? Not 100% sure... // Why would we even get an outdated comment or a response to one here? // Ran into this error when viewing files for https://github.com/numpy/numpy/pull/9998 @@ -153,4 +140,17 @@ export default class PullRequestReviewsController extends React.Component { this.setState(state); } + + // sorts reviews by date ascending (oldest to newest) + sortByDate(a, b) { + const dateA = new Date(a.submittedAt); + const dateB = new Date(b.submittedAt); + if (dateA > dateB) { + return 1; + } else if (dateB > dateA) { + return -1; + } else { + return 0; + } + } } From 708700825ddf8bab55d949b867399c533c387382 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 19:16:29 -0800 Subject: [PATCH 087/120] Reverse the array earlier --- lib/controllers/pr-reviews-controller.js | 2 +- lib/views/pr-review-comments-view.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index ad3d89b652..ba5674883f 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -63,7 +63,7 @@ export default class PullRequestReviewsController extends React.Component { return null; } - const commentThreads = Object.keys(this.state).map(rootCommentId => { + const commentThreads = Object.keys(this.state).reverse().map(rootCommentId => { return { rootCommentId, comments: this.state[rootCommentId], diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index 7eb1276902..09f8bc9bf9 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -24,7 +24,7 @@ export default class PullRequestCommentsView extends React.Component { } render() { - return [...this.props.commentThreads].reverse().map(({rootCommentId, comments}) => { + return [...this.props.commentThreads].map(({rootCommentId, comments}) => { const rootComment = comments[0]; if (!rootComment.position) { return null; From b42ab575763f51105fb135607c50bddaa2dbfda4 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 19:34:26 -0800 Subject: [PATCH 088/120] Use PAGE_SIZE for refetch variables --- lib/views/pr-detail-view.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/views/pr-detail-view.js b/lib/views/pr-detail-view.js index d0f18ae388..ed8d1f6d3d 100644 --- a/lib/views/pr-detail-view.js +++ b/lib/views/pr-detail-view.js @@ -15,6 +15,7 @@ import EmojiReactionsView from '../views/emoji-reactions-view'; import IssueishBadge from '../views/issueish-badge'; import PrCommitsView from '../views/pr-commits-view'; import PrStatusesView from '../views/pr-statuses-view'; +import {PAGE_SIZE} from '../helpers'; class CheckoutState { constructor(name) { @@ -348,13 +349,13 @@ export class BarePullRequestDetailView extends React.Component { this.props.relay.refetch({ repoId: this.props.repository.id, issueishId: this.props.pullRequest.id, - timelineCount: 100, + timelineCount: PAGE_SIZE, timelineCursor: null, - commitCount: 100, + commitCount: PAGE_SIZE, commitCursor: null, - reviewCount: 2, + reviewCount: PAGE_SIZE, reviewCursor: null, - commentCount: 2, + commentCount: PAGE_SIZE, commentCursor: null, }, null, () => { this.setState({refreshing: false}); From 0ce67983023f0307d6bba478ab6e99d5ff4f5993 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 19:59:26 -0800 Subject: [PATCH 089/120] Make tests consistent --- test/models/patch/multi-file-patch.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/models/patch/multi-file-patch.test.js b/test/models/patch/multi-file-patch.test.js index 767b17e233..cad02eaffa 100644 --- a/test/models/patch/multi-file-patch.test.js +++ b/test/models/patch/multi-file-patch.test.js @@ -710,7 +710,7 @@ describe('MultiFilePatch', function() { .addFilePatch(fp => { fp.setOldFile(f => f.path('file.txt')); fp.addHunk(h => { - h.unchanged('1 (0)').added('2 (1)', '3 (2)').deleted('4 (3)', '5 (4)', '6 (5)').unchanged('7 (6)'); + h.unchanged('0 (1)').added('1 (2)', '2 (3)').deleted('3 (4)', '4 (5)', '5 (6)').unchanged('6 (7)'); }); }) .build(); From 0498b50922bdcc7d1fae589c897fa871c6e5a5fc Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 23:02:18 -0800 Subject: [PATCH 090/120] Fix PullRequestReviewCommentsContainer tests --- .../pr-review-comments-container.test.js | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index d690000057..43f3f9c08d 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -6,6 +6,12 @@ import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../../lib/helpers'; import {BarePullRequestReviewCommentsContainer} from '../../lib/containers/pr-review-comments-container'; describe('PullRequestReviewCommentsContainer', function() { + const review = { + id: '123', + submittedAt: '2018-12-27T20:40:55Z', + comments: {edges: ['this kiki is marvelous']}, + }; + function buildApp(opts, overrideProps = {}) { const o = { relayHasMore: () => { return false; }, @@ -21,11 +27,7 @@ describe('PullRequestReviewCommentsContainer', function() { isLoading: o.relayIsLoading, }, collectComments: () => {}, - review: { - id: '123', - submittedAt: '2018-12-27T20:40:55Z', - comments: {edges: ['this kiki is marvelous']}, - }, + review, ...overrideProps, }; return ; @@ -35,12 +37,14 @@ describe('PullRequestReviewCommentsContainer', function() { const collectCommentsStub = sinon.stub(); shallow(buildApp({}, {collectComments: collectCommentsStub})); assert.strictEqual(collectCommentsStub.callCount, 1); - const args = collectCommentsStub.lastCall.args[0]; - assert.strictEqual(args.reviewId, '123'); - assert.strictEqual(args.submittedAt, '2018-12-27T20:40:55Z'); - assert.deepEqual(args.comments, {edges: ['this kiki is marvelous']}); - assert.isFalse(args.hasMore); + const {submittedAt, comments, id} = review; + assert.deepEqual(collectCommentsStub.lastCall.args[0], { + reviewId: id, + submittedAt, + comments, + fetchingMoreComments: false, + }); }); it('attempts to load comments after component has been mounted', function() { @@ -56,28 +60,29 @@ describe('PullRequestReviewCommentsContainer', function() { const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); wrapper.instance()._loadMoreComments(); - const args = relayLoadMoreStub.lastCall.args; - assert.strictEqual(args[0], PAGE_SIZE); - assert.strictEqual(args[1], wrapper.instance().onDidLoadMore); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleComments]); }); }); - describe('onDidLoadMore', function() { + describe('handleComments', function() { it('collects comments and attempts to load more comments', function() { const collectCommentsStub = sinon.stub(); const wrapper = shallow(buildApp({}, {collectComments: collectCommentsStub})); // collect comments is called when mounted, we don't care about that in this test so reset the count collectCommentsStub.reset(); sinon.stub(wrapper.instance(), '_attemptToLoadMoreComments'); - wrapper.instance().onDidLoadMore(); + wrapper.instance().handleComments(); assert.strictEqual(collectCommentsStub.callCount, 1); const args = collectCommentsStub.lastCall.args[0]; - assert.strictEqual(args.reviewId, '123'); - assert.strictEqual(args.submittedAt, '2018-12-27T20:40:55Z'); - assert.deepEqual(args.comments, {edges: ['this kiki is marvelous']}); - assert.isFalse(args.hasMore); + const {submittedAt, comments, id} = review; + assert.deepEqual(collectCommentsStub.lastCall.args[0], { + reviewId: id, + submittedAt, + comments, + fetchingMoreComments: false, + }); }); }); @@ -108,9 +113,7 @@ describe('PullRequestReviewCommentsContainer', function() { wrapper.instance()._attemptToLoadMoreComments(); assert.strictEqual(relayLoadMoreStub.callCount, 1); - const args = relayLoadMoreStub.lastCall.args; - assert.strictEqual(args[0], PAGE_SIZE); - assert.strictEqual(args[1], wrapper.instance().onDidLoadMore); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleComments]); }); it('calls loadMore after a timeout if hasMore is true and isLoading is true', function() { @@ -128,9 +131,7 @@ describe('PullRequestReviewCommentsContainer', function() { clock.tick(PAGINATION_WAIT_TIME_MS); assert.strictEqual(relayLoadMoreStub.callCount, 1); - const args = relayLoadMoreStub.lastCall.args; - assert.strictEqual(args[0], PAGE_SIZE); - assert.strictEqual(args[1], wrapper.instance().onDidLoadMore); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleComments]); }); }); }); From 80c97c5aeb7e964b1cec9b7ab5c6f5f8836cef12 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 23:06:04 -0800 Subject: [PATCH 091/120] Don't `reverse` in PullRequestBuilder --- test/builder/pr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/builder/pr.js b/test/builder/pr.js index 55f3465fbc..63352c8e8b 100644 --- a/test/builder/pr.js +++ b/test/builder/pr.js @@ -134,7 +134,7 @@ class PullRequestBuilder { }); return { reviews: {nodes: this._reviews}, - commentThreads: Object.keys(commentThreads).reverse().map(rootCommentId => { + commentThreads: Object.keys(commentThreads).map(rootCommentId => { return { rootCommentId, comments: commentThreads[rootCommentId], From 905a1a27dbe7a02b7d159b74b7a6ec125d963b71 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Fri, 4 Jan 2019 23:16:31 -0800 Subject: [PATCH 092/120] :art: tests --- test/views/pr-comments-view.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index 1a740bccae..3a87f20737 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -73,7 +73,7 @@ describe('PullRequestCommentView', function() { const bodyHTML = '
yo yo
'; const switchToIssueish = () => {}; - function buildApp(overrideProps = {}, opts = {}) { + function buildApp(commentOverrideProps = {}, opts = {}) { const props = { comment: { bodyHTML, @@ -83,7 +83,7 @@ describe('PullRequestCommentView', function() { avatarUrl, login, }, - ...overrideProps, + ...commentOverrideProps, }, switchToIssueish, ...opts, @@ -93,6 +93,7 @@ describe('PullRequestCommentView', function() { ); } + it('renders the PullRequestCommentReview information', function() { const wrapper = shallow(buildApp()); const avatar = wrapper.find('.github-PrComment-avatar'); From d08daca581f51e57871a9c214fee21b222e6caeb Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Mon, 7 Jan 2019 14:04:26 -0800 Subject: [PATCH 093/120] fix typo in method name --- lib/controllers/pr-reviews-controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index ba5674883f..18f503b996 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -99,11 +99,11 @@ export default class PullRequestReviewsController extends React.Component { }); } - collectComments = ({reviewId, submittedAt, comments, fetchingMoreCommnts}) => { - this.reviewsById.set(reviewId, {submittedAt, comments, fetchingMoreCommnts}); + collectComments = ({reviewId, submittedAt, comments, fetchingMoreComments}) => { + this.reviewsById.set(reviewId, {submittedAt, comments, fetchingMoreComments}); const stillFetchingReviews = this.props.relay.hasMore(); if (!stillFetchingReviews) { - const stillFetchingComments = [...this.reviewsById.values()].some(review => review.fetchingMoreCommnts); + const stillFetchingComments = [...this.reviewsById.values()].some(review => review.fetchingMoreComments); if (!stillFetchingComments) { this.groupCommentsByThread(); } From edc49781f2ee6cadbfab161234797aa30b92bfc0 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Mon, 7 Jan 2019 14:08:33 -0800 Subject: [PATCH 094/120] pedantic af function name change --- lib/controllers/pr-reviews-controller.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 18f503b996..73ac847aa9 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -112,7 +112,7 @@ export default class PullRequestReviewsController extends React.Component { groupCommentsByThread() { // we have no guarantees that reviews will return in order so sort them by date. - const sortedReviews = [...this.reviewsById.values()].sort(this.sortByDate); + const sortedReviews = [...this.reviewsById.values()].sort(this.compareReviewsByDate); // react batches calls to setState and does not update state synchronously // therefore we need an intermediate state so we can do checks against keys @@ -141,10 +141,10 @@ export default class PullRequestReviewsController extends React.Component { this.setState(state); } - // sorts reviews by date ascending (oldest to newest) - sortByDate(a, b) { - const dateA = new Date(a.submittedAt); - const dateB = new Date(b.submittedAt); + // compare reviews by date ascending (in order to sort oldest to newest) + compareReviewsByDate(reviewA, reviewB) { + const dateA = new Date(reviewA.submittedAt); + const dateB = new Date(reviewB.submittedAt); if (dateA > dateB) { return 1; } else if (dateB > dateA) { From 73b06c69a56dac66612c51c2978e7cf380c9d95f Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Mon, 7 Jan 2019 15:59:20 -0800 Subject: [PATCH 095/120] :fire: unused variable --- test/containers/pr-review-comments-container.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index 43f3f9c08d..ca3bbcc1f0 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -74,7 +74,6 @@ describe('PullRequestReviewCommentsContainer', function() { wrapper.instance().handleComments(); assert.strictEqual(collectCommentsStub.callCount, 1); - const args = collectCommentsStub.lastCall.args[0]; const {submittedAt, comments, id} = review; assert.deepEqual(collectCommentsStub.lastCall.args[0], { From dcaee75346663874a3d30f88621c2847bf6e86d2 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Mon, 7 Jan 2019 17:24:40 -0800 Subject: [PATCH 096/120] make builder reflect the new improved shape of our data - we're using edges now instead of nodes, as the query was originally using - add `submittedAt` to reviews - `replyTo` is an object with an id - --- test/builder/pr.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test/builder/pr.js b/test/builder/pr.js index 63352c8e8b..f6f14e8fdb 100644 --- a/test/builder/pr.js +++ b/test/builder/pr.js @@ -52,7 +52,7 @@ class CommentBuilder { } replyTo(replyToId) { - this._replyTo = replyToId; + this._replyTo = {id: replyToId}; return this; } @@ -78,6 +78,7 @@ class ReviewBuilder { this.nextCommentID = 0; this._id = 0; this._comments = []; + this._submittedAt = '2018-12-28T20:40:55Z'; } id(i) { @@ -85,6 +86,11 @@ class ReviewBuilder { return this; } + submittedAt(timestamp) { + this._submittedAt = timestamp; + return this; + } + addComment(block = () => {}) { const builder = new CommentBuilder(); builder.id(this.nextCommentID); @@ -97,9 +103,12 @@ class ReviewBuilder { } build() { + const comments = this._comments.map(comment => { + return {node: comment}; + }); return { id: this._id, - comments: {nodes: this._comments}, + comments: {edges: comments}, }; } } @@ -124,9 +133,9 @@ class PullRequestBuilder { build() { const commentThreads = {}; this._reviews.forEach(review => { - review.comments.nodes.forEach(comment => { - if (comment.replyTo && commentThreads[comment.replyTo]) { - commentThreads[comment.replyTo].push(comment); + review.comments.edges.forEach(({node: comment}) => { + if (comment.replyTo && comment.replyTo.id && commentThreads[comment.replyTo.id]) { + commentThreads[comment.replyTo.id].push(comment); } else { commentThreads[comment.id] = [comment]; } From 8d83ebd55a25301221422824193f8df0d4bc35f0 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Mon, 7 Jan 2019 17:27:19 -0800 Subject: [PATCH 097/120] add more tests for `PullRequestReviewsController` --- .../controllers/pr-reviews-controller.test.js | 94 +++++++++++++++++-- 1 file changed, 86 insertions(+), 8 deletions(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 7105fcbcff..41bcbff8fb 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -1,5 +1,6 @@ import React from 'react'; import {shallow} from 'enzyme'; +import {reviewBuilder} from '../builder/pr'; import PullRequestReviewsController from '../../lib/controllers/pr-reviews-controller'; @@ -9,23 +10,23 @@ describe('PullRequestReviewsController', function() { relayHasMore: () => { return false; }, relayLoadMore: () => {}, relayIsLoading: () => { return false; }, - reveiwSpecs: [], + reviewSpecs: [], reviewStartCursor: 0, ...opts, }; - const review = { - edges: o.reviewItemSpecs.map((spec, i) => ({ + const reviews = { + edges: o.reviewSpecs.map((spec, i) => ({ cursor: `result${i}`, node: { id: spec.id, - __typename: spec.kind, + __typename: 'review', }, })), pageInfo: { startCursor: `result${o.reviewStartCursor}`, - endCursor: `result${o.reviewStartCursor + o.reviewItemSpecs.length}`, - hasNextPage: o.reviewStartCursor + o.reviewItemSpecs.length < o.reviewItemTotal, + endCursor: `result${o.reviewStartCursor + o.reviewSpecs.length}`, + hasNextPage: o.reviewStartCursor + o.reviewSpecs.length < o.reviewItemTotal, hasPreviousPage: o.reviewStartCursor !== 0, }, totalCount: o.reviewItemTotal, @@ -37,21 +38,98 @@ describe('PullRequestReviewsController', function() { loadMore: o.relayLoadMore, isLoading: o.relayIsLoading, }, + + switchToIssueish: () => {}, getBufferRowForDiffPosition: () => {}, - pullRequest: review, + pullRequest: {reviews}, ...overrideProps, }; return ; } + it('returns null if props.pullRequest is falsy', function() { + const wrapper = shallow(buildApp({}, {pullRequest: null})); + assert.isNull(wrapper.getElement()); + }); + + it('returns null if props.pullRequest.reviews is falsy', function() { + const wrapper = shallow(buildApp({}, {pullRequest: {reviews: null}})); + assert.isNull(wrapper.getElement()); + }); + it('renders a PullRequestReviewCommentsContainer for every review', function() { + const review1 = reviewBuilder().build(); + const review2 = reviewBuilder().build(); + const reviewSpecs = [review1, review2]; + const wrapper = shallow(buildApp({reviewSpecs})); + const containers = wrapper.find('Relay(BarePullRequestReviewCommentsContainer)'); + assert.strictEqual(containers.length, 2); + // should I assert on props here? }); - it('renders a PullRequestReviewCommentsView', function() { + it('renders a PullRequestReviewCommentsView and passes props through', function() { + const review1 = reviewBuilder().build(); + const review2 = reviewBuilder().build(); + + const reviewSpecs = [review1, review2]; + const passThroughProp = 'I only exist for the children'; + const wrapper = shallow(buildApp({reviewSpecs}, {passThroughProp})); + const view = wrapper.find('PullRequestCommentsView'); + assert.strictEqual(view.length, 1); + assert.strictEqual(wrapper.instance().props.passThroughProp, view.prop('passThroughProp')); + + // should I assert on the commentThreads prop? }); + describe('collectComments', function() { + it('sets this.reviewsById with correct data', function() { + const wrapper = shallow(buildApp()); + const args = {reviewId: 123, submittedAt: '2018-12-27T20:40:55Z', comments: ['a comment', + ], fetchingMoreComments: true}; + assert.strictEqual(wrapper.instance().reviewsById.size, 0); + wrapper.instance().collectComments(args); + const review = wrapper.instance().reviewsById.get(args.reviewId); + delete args.reviewId; + assert.deepEqual(review, args); + }); + + it('calls groupCommentsByThread if there are no more reviews or comments to be fetched', function() { + const wrapper = shallow(buildApp()); + const groupCommentsStub = sinon.stub(wrapper.instance(), 'groupCommentsByThread'); + assert.isFalse(groupCommentsStub.called); + const args = {reviewId: 123, submittedAt: '2018-12-27T20:40:55Z', comments: ['a comment', + ], fetchingMoreComments: false}; + wrapper.instance().collectComments(args); + assert.strictEqual(groupCommentsStub.callCount, 1); + }); + }); + + it('groups the comments into threads once all the data has been fetched', function() { + const review1 = reviewBuilder() + .id(0) + .submittedAt('2018-12-27T20:40:55Z') + .addComment(c => c.id(1).path('file0.txt').body('OG comment')) + .build(); + + const review2 = reviewBuilder() + .id(1) + .submittedAt('2018-12-28T20:40:55Z') + .addComment(c => c.id(2).path('file0.txt').replyTo(1).body('reply to OG comment')) + .build(); + + const reviewSpecs = [review1, review2]; + + const wrapper = shallow(buildApp({reviewSpecs})); + + // adding this manually to reviewsById because the last time you call collectComments + wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); + wrapper.instance().collectComments({reviewId: review2.id, submittedAt: review2.submittedAt, comments: review2.comments, fetchingMoreComments: false}); + const threadedComments = wrapper.instance().state[1]; + assert.lengthOf(threadedComments, 2); + assert.strictEqual(threadedComments[0].body, 'OG comment'); + assert.strictEqual(threadedComments[1].body, 'reply to OG comment'); }); }); From 8baab2f0f257315794b4620928516e560c015aab Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Mon, 7 Jan 2019 17:28:37 -0800 Subject: [PATCH 098/120] :shirt: --- test/builder/pr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/builder/pr.js b/test/builder/pr.js index f6f14e8fdb..e7b78ba2db 100644 --- a/test/builder/pr.js +++ b/test/builder/pr.js @@ -133,7 +133,7 @@ class PullRequestBuilder { build() { const commentThreads = {}; this._reviews.forEach(review => { - review.comments.edges.forEach(({node: comment}) => { + review.comments.edges.forEach(({node: comment}) => { if (comment.replyTo && comment.replyTo.id && commentThreads[comment.replyTo.id]) { commentThreads[comment.replyTo.id].push(comment); } else { From 7542c0d36988becbf70fb421373137cbc9ab0043 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Mon, 7 Jan 2019 17:34:19 -0800 Subject: [PATCH 099/120] clean up some cruft --- test/controllers/pr-reviews-controller.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 41bcbff8fb..66d6f78896 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -64,7 +64,9 @@ describe('PullRequestReviewsController', function() { const wrapper = shallow(buildApp({reviewSpecs})); const containers = wrapper.find('Relay(BarePullRequestReviewCommentsContainer)'); assert.strictEqual(containers.length, 2); - // should I assert on props here? + + assert.strictEqual(containers.at(0).prop('review').id, review1.id); + assert.strictEqual(containers.at(1).prop('review').id, review2.id); }); it('renders a PullRequestReviewCommentsView and passes props through', function() { @@ -78,8 +80,6 @@ describe('PullRequestReviewsController', function() { assert.strictEqual(view.length, 1); assert.strictEqual(wrapper.instance().props.passThroughProp, view.prop('passThroughProp')); - - // should I assert on the commentThreads prop? }); describe('collectComments', function() { From 2c75c8b6db22b90f9aa9a80ffbae78c67f8ad610 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 10:31:15 -0800 Subject: [PATCH 100/120] test that mfpView renders the `PullRequestReviewsController` --- test/views/multi-file-patch-view.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/views/multi-file-patch-view.test.js b/test/views/multi-file-patch-view.test.js index 30cf1d92af..813c206af9 100644 --- a/test/views/multi-file-patch-view.test.js +++ b/test/views/multi-file-patch-view.test.js @@ -9,6 +9,7 @@ import FilePatch from '../../lib/models/patch/file-patch'; import RefHolder from '../../lib/models/ref-holder'; import CommitPreviewItem from '../../lib/items/commit-preview-item'; import ChangedFileItem from '../../lib/items/changed-file-item'; +import IssueishDetailItem from '../../lib/items/issueish-detail-item'; describe('MultiFilePatchView', function() { let atomEnv, workspace, repository, filePatches; @@ -134,6 +135,11 @@ describe('MultiFilePatchView', function() { assert.isFalse(wrapper.find('FilePatchHeaderView[relPath="1"]').prop('hasMultipleFileSelections')); }); + it('renders a PullRequestsReviewsContainer if itemType is IssueishDetailItem', function() { + const wrapper = shallow(buildApp({itemType: IssueishDetailItem})); + assert.lengthOf(wrapper.find('Relay(PullRequestReviewsController)'), 1); + }); + it('renders the file patch within an editor', function() { const wrapper = mount(buildApp()); From 8817466d3c39299e4882149c14e16adcdf60b20b Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 11:05:57 -0800 Subject: [PATCH 101/120] add test for error handling in `PullRequestReviewsController` --- lib/controllers/pr-reviews-controller.js | 23 +++--- .../pr-review-comments-container.test.js | 2 +- .../controllers/pr-reviews-controller.test.js | 80 ++++++++++++++----- 3 files changed, 72 insertions(+), 33 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 73ac847aa9..140586d79f 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -43,19 +43,18 @@ export default class PullRequestReviewsController extends React.Component { } } + handleError = error => { + /* istanbul ignore if */ + if (error) { + // eslint-disable-next-line no-console + console.error(error); + } else { + this._attemptToLoadMoreReviews(); + } + } + _loadMoreReviews = () => { - this.props.relay.loadMore( - PAGE_SIZE, - error => { - /* istanbul ignore if */ - if (error) { - // eslint-disable-next-line no-console - console.error(error); - } else { - this._attemptToLoadMoreReviews(); - } - }, - ); + this.props.relay.loadMore(PAGE_SIZE, this.handleError); } render() { diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index ca3bbcc1f0..8eb7916221 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -54,7 +54,7 @@ describe('PullRequestReviewCommentsContainer', function() { assert.strictEqual(wrapper.instance()._attemptToLoadMoreComments.callCount, 1); }); - describe('loadMoreComments', function() { + describe('_loadMoreComments', function() { it('calls this.props.relay.loadMore with correct args', function() { const relayLoadMoreStub = sinon.stub(); const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 66d6f78896..6a9d13ed34 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -4,6 +4,8 @@ import {reviewBuilder} from '../builder/pr'; import PullRequestReviewsController from '../../lib/controllers/pr-reviews-controller'; +import {PAGE_SIZE} from '../../lib/helpers'; + describe('PullRequestReviewsController', function() { function buildApp(opts, overrideProps = {}) { const o = { @@ -105,31 +107,69 @@ describe('PullRequestReviewsController', function() { }); }); + describe('_loadMoreReviews', function() { + it('calls this.props.relay.loadMore with correct args', function() { + const relayLoadMoreStub = sinon.stub(); + const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); + wrapper.instance()._loadMoreReviews(); - it('groups the comments into threads once all the data has been fetched', function() { - const review1 = reviewBuilder() - .id(0) - .submittedAt('2018-12-27T20:40:55Z') - .addComment(c => c.id(1).path('file0.txt').body('OG comment')) - .build(); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleError]); + }); + }); - const review2 = reviewBuilder() - .id(1) - .submittedAt('2018-12-28T20:40:55Z') - .addComment(c => c.id(2).path('file0.txt').replyTo(1).body('reply to OG comment')) - .build(); + describe('grouping and ordering comments', function() { + it('groups the comments into threads based on replyId', function() { + const review1 = reviewBuilder() + .id(0) + .submittedAt('2018-12-27T20:40:55Z') + .addComment(c => c.id(1).path('file0.txt').body('OG comment')) + .build(); - const reviewSpecs = [review1, review2]; + const review2 = reviewBuilder() + .id(1) + .submittedAt('2018-12-28T20:40:55Z') + .addComment(c => c.id(2).path('file0.txt').replyTo(1).body('reply to OG comment')) + .build(); - const wrapper = shallow(buildApp({reviewSpecs})); + const reviewSpecs = [review1, review2]; - // adding this manually to reviewsById because the last time you call collectComments - wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); + const wrapper = shallow(buildApp({reviewSpecs})); + + // adding this manually to reviewsById because the last time you call collectComments it groups them, and we don't want to do that just yet. + wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); + + wrapper.instance().collectComments({reviewId: review2.id, submittedAt: review2.submittedAt, comments: review2.comments, fetchingMoreComments: false}); + const threadedComments = wrapper.instance().state[1]; + assert.lengthOf(threadedComments, 2); + assert.strictEqual(threadedComments[0].body, 'OG comment'); + assert.strictEqual(threadedComments[1].body, 'reply to OG comment'); + }); + it('sorts replies based on date', function() { + const review1 = reviewBuilder() + .id(0) + .submittedAt('2018-12-27T20:40:55Z') + .addComment(c => c.id(1).path('file0.txt').body('OG comment')) + .build(); + + const review2 = reviewBuilder() + .id(1) + .submittedAt('2018-12-28T20:40:55Z') + .addComment(c => c.id(2).path('file0.txt').replyTo(1).body('reply to OG comment')) + .build(); + + const reviewSpecs = [review1, review2]; + + const wrapper = shallow(buildApp({reviewSpecs})); + + // adding this manually to reviewsById because the last time you call collectComments it groups them, and we don't want to do that just yet. + wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); + + wrapper.instance().collectComments({reviewId: review2.id, submittedAt: review2.submittedAt, comments: review2.comments, fetchingMoreComments: false}); + const threadedComments = wrapper.instance().state[1]; + assert.lengthOf(threadedComments, 2); + assert.strictEqual(threadedComments[0].body, 'OG comment'); + assert.strictEqual(threadedComments[1].body, 'reply to OG comment'); + }); - wrapper.instance().collectComments({reviewId: review2.id, submittedAt: review2.submittedAt, comments: review2.comments, fetchingMoreComments: false}); - const threadedComments = wrapper.instance().state[1]; - assert.lengthOf(threadedComments, 2); - assert.strictEqual(threadedComments[0].body, 'OG comment'); - assert.strictEqual(threadedComments[1].body, 'reply to OG comment'); }); }); From 24e00fc0beb736ec686b3fb94632a286b0771498 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 11:22:32 -0800 Subject: [PATCH 102/120] yummy copypasta --- .../controllers/pr-reviews-controller.test.js | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 6a9d13ed34..682550dc2b 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -4,7 +4,7 @@ import {reviewBuilder} from '../builder/pr'; import PullRequestReviewsController from '../../lib/controllers/pr-reviews-controller'; -import {PAGE_SIZE} from '../../lib/helpers'; +import {PAGE_SIZE, PAGINATION_WAIT_TIME_MS} from '../../lib/helpers'; describe('PullRequestReviewsController', function() { function buildApp(opts, overrideProps = {}) { @@ -107,6 +107,55 @@ describe('PullRequestReviewsController', function() { }); }); + describe('attemptToLoadMoreReviews', function() { + let clock; + beforeEach(function() { + clock = sinon.useFakeTimers(); + }); + + afterEach(function() { + clock = sinon.restore(); + }); + + it('does not call loadMore if hasMore is false', function() { + const relayLoadMoreStub = sinon.stub(); + const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); + relayLoadMoreStub.reset(); + + wrapper.instance()._attemptToLoadMoreReviews(); + assert.strictEqual(relayLoadMoreStub.callCount, 0); + }); + + it('calls loadMore immediately if hasMore is true and isLoading is false', function() { + const relayLoadMoreStub = sinon.stub(); + const relayHasMore = () => { return true; }; + const wrapper = shallow(buildApp({relayHasMore, relayLoadMore: relayLoadMoreStub})); + relayLoadMoreStub.reset(); + + wrapper.instance()._attemptToLoadMoreReviews(); + assert.strictEqual(relayLoadMoreStub.callCount, 1); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleError]); + }); + + it('calls loadMore after a timeout if hasMore is true and isLoading is true', function() { + const relayLoadMoreStub = sinon.stub(); + const relayHasMore = () => { return true; }; + const relayIsLoading = () => { return true; }; + const wrapper = shallow(buildApp({relayHasMore, relayIsLoading, relayLoadMore: relayLoadMoreStub})); + // advancing the timer and resetting the stub to clear the initial calls of + // _attemptToLoadMoreReviews when the component is initially mounted. + clock.tick(PAGINATION_WAIT_TIME_MS); + relayLoadMoreStub.reset(); + + wrapper.instance()._attemptToLoadMoreReviews(); + assert.strictEqual(relayLoadMoreStub.callCount, 0); + + clock.tick(PAGINATION_WAIT_TIME_MS); + assert.strictEqual(relayLoadMoreStub.callCount, 1); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleError]); + }); + }); + describe('_loadMoreReviews', function() { it('calls this.props.relay.loadMore with correct args', function() { const relayLoadMoreStub = sinon.stub(); From 313363ca77f93d3bb408d6f2a9b7f344cbb49189 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 12:33:57 -0800 Subject: [PATCH 103/120] test for replying to an outdated comment --- test/controllers/pr-reviews-controller.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 682550dc2b..eee6efb1e6 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -220,5 +220,22 @@ describe('PullRequestReviewsController', function() { assert.strictEqual(threadedComments[1].body, 'reply to OG comment'); }); + it('comments with a replyTo id that does not point to an existing comment are threaded separately', function() { + const outdatedCommentId = 1; + const replyToOutdatedCommentId = 2; + const review = reviewBuilder() + .id(2) + .submittedAt('2018-12-28T20:40:55Z') + .addComment(c => c.id(replyToOutdatedCommentId).path('file0.txt').replyTo(outdatedCommentId).body('reply to outdated comment')) + .build(); + + const wrapper = shallow(buildApp({reviewSpecs: [review]})); + wrapper.instance().collectComments({reviewId: review.id, submittedAt: review.submittedAt, comments: review.comments, fetchingMoreComments: false}); + + const comments = wrapper.instance().state[replyToOutdatedCommentId]; + assert.lengthOf(comments, 1); + assert.strictEqual(comments[0].body, 'reply to outdated comment'); + }); + }); }); From f07d2511f48569b1ce25b4462114668025670e41 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 12:35:56 -0800 Subject: [PATCH 104/120] add a const for originalCommentId hopefully this makes the tests easier to understand? IDK. YOLO. --- test/controllers/pr-reviews-controller.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index eee6efb1e6..e3eceb8df3 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -168,16 +168,17 @@ describe('PullRequestReviewsController', function() { describe('grouping and ordering comments', function() { it('groups the comments into threads based on replyId', function() { + const originalCommentId = 1; const review1 = reviewBuilder() .id(0) .submittedAt('2018-12-27T20:40:55Z') - .addComment(c => c.id(1).path('file0.txt').body('OG comment')) + .addComment(c => c.id(originalCommentId).path('file0.txt').body('OG comment')) .build(); const review2 = reviewBuilder() .id(1) .submittedAt('2018-12-28T20:40:55Z') - .addComment(c => c.id(2).path('file0.txt').replyTo(1).body('reply to OG comment')) + .addComment(c => c.id(2).path('file0.txt').replyTo(originalCommentId).body('reply to OG comment')) .build(); const reviewSpecs = [review1, review2]; From 86e8f2badc5b4c971159a0fd8b441094e9d64070 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 12:56:31 -0800 Subject: [PATCH 105/120] :art: extra pedantic comment update --- lib/controllers/pr-reviews-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 140586d79f..428bb38b7b 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -74,8 +74,8 @@ export default class PullRequestReviewsController extends React.Component { * Threads can have comments belonging to multiple reviews. * We need a nested pagination container to fetch comment pages. * Upon fetching new comments, the `collectComments` method is called with all comments fetched for that review. - * Ultimately we want to organize comments based on the root comment they are replies to. - * So `renderCommentFetchingContainers` simply fetches data and doesn't render any DOM elements. + * Ultimately we want to group comments based on the root comment they are replies to. + * `renderCommentFetchingContainers` only fetches data and doesn't render any user visible DOM elements. * `PullRequestReviewCommentsView` renders the aggregated comment thread data. * */ return ( From db38949196b79531f19ad0fd2209575159b24f5c Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 13:01:44 -0800 Subject: [PATCH 106/120] don't test sorting comments by date we don't actually sort the comments by date. They come in in order and then we reverse them for some reason. --- .../controllers/pr-reviews-controller.test.js | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index e3eceb8df3..d99ded32b1 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -167,8 +167,9 @@ describe('PullRequestReviewsController', function() { }); describe('grouping and ordering comments', function() { - it('groups the comments into threads based on replyId', function() { + it.only('groups the comments into threads based on replyId', function() { const originalCommentId = 1; + const singleCommentId = 5; const review1 = reviewBuilder() .id(0) .submittedAt('2018-12-27T20:40:55Z') @@ -179,6 +180,7 @@ describe('PullRequestReviewsController', function() { .id(1) .submittedAt('2018-12-28T20:40:55Z') .addComment(c => c.id(2).path('file0.txt').replyTo(originalCommentId).body('reply to OG comment')) + .addComment(c => c.id(singleCommentId).path('file0.txt').body('I am single and free')) .build(); const reviewSpecs = [review1, review2]; @@ -189,36 +191,13 @@ describe('PullRequestReviewsController', function() { wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); wrapper.instance().collectComments({reviewId: review2.id, submittedAt: review2.submittedAt, comments: review2.comments, fetchingMoreComments: false}); - const threadedComments = wrapper.instance().state[1]; + const threadedComments = wrapper.instance().state[originalCommentId]; assert.lengthOf(threadedComments, 2); assert.strictEqual(threadedComments[0].body, 'OG comment'); assert.strictEqual(threadedComments[1].body, 'reply to OG comment'); - }); - it('sorts replies based on date', function() { - const review1 = reviewBuilder() - .id(0) - .submittedAt('2018-12-27T20:40:55Z') - .addComment(c => c.id(1).path('file0.txt').body('OG comment')) - .build(); - const review2 = reviewBuilder() - .id(1) - .submittedAt('2018-12-28T20:40:55Z') - .addComment(c => c.id(2).path('file0.txt').replyTo(1).body('reply to OG comment')) - .build(); - - const reviewSpecs = [review1, review2]; - - const wrapper = shallow(buildApp({reviewSpecs})); - - // adding this manually to reviewsById because the last time you call collectComments it groups them, and we don't want to do that just yet. - wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); - - wrapper.instance().collectComments({reviewId: review2.id, submittedAt: review2.submittedAt, comments: review2.comments, fetchingMoreComments: false}); - const threadedComments = wrapper.instance().state[1]; - assert.lengthOf(threadedComments, 2); - assert.strictEqual(threadedComments[0].body, 'OG comment'); - assert.strictEqual(threadedComments[1].body, 'reply to OG comment'); + const singleComment = wrapper.instance().state[singleCommentId]; + assert.strictEqual(singleComment[0].body, 'I am single and free'); }); it('comments with a replyTo id that does not point to an existing comment are threaded separately', function() { @@ -227,7 +206,7 @@ describe('PullRequestReviewsController', function() { const review = reviewBuilder() .id(2) .submittedAt('2018-12-28T20:40:55Z') - .addComment(c => c.id(replyToOutdatedCommentId).path('file0.txt').replyTo(outdatedCommentId).body('reply to outdated comment')) + .addComment(c => c.id(replyToOutdatedCommentId).path('file0.txt').replyTo(outdatedCommentId).body('reply to outdated comment')) .build(); const wrapper = shallow(buildApp({reviewSpecs: [review]})); From f1557b71a444626829f526e44d848381c686199d Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 13:15:51 -0800 Subject: [PATCH 107/120] make review builder actually return `submittedAt` --- test/builder/pr.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/builder/pr.js b/test/builder/pr.js index e7b78ba2db..3616872b77 100644 --- a/test/builder/pr.js +++ b/test/builder/pr.js @@ -108,6 +108,7 @@ class ReviewBuilder { }); return { id: this._id, + submittedAt: this._submittedAt, comments: {edges: comments}, }; } From 26fa6126b20298a99af74b70cdb1f9a72ce7b1d9 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 13:22:05 -0800 Subject: [PATCH 108/120] test that comments show up grouped by review submittedAt date --- .../controllers/pr-reviews-controller.test.js | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index d99ded32b1..8392258ad7 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -167,7 +167,7 @@ describe('PullRequestReviewsController', function() { }); describe('grouping and ordering comments', function() { - it.only('groups the comments into threads based on replyId', function() { + it('groups the comments into threads based on replyId', function() { const originalCommentId = 1; const singleCommentId = 5; const review1 = reviewBuilder() @@ -183,9 +183,7 @@ describe('PullRequestReviewsController', function() { .addComment(c => c.id(singleCommentId).path('file0.txt').body('I am single and free')) .build(); - const reviewSpecs = [review1, review2]; - - const wrapper = shallow(buildApp({reviewSpecs})); + const wrapper = shallow(buildApp({reviewSpecs: [review1, review2]})); // adding this manually to reviewsById because the last time you call collectComments it groups them, and we don't want to do that just yet. wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); @@ -200,6 +198,42 @@ describe('PullRequestReviewsController', function() { assert.strictEqual(singleComment[0].body, 'I am single and free'); }); + it('comments are ordered based on the order in which their reviews were submitted', function() { + const originalCommentId = 1; + const review1 = reviewBuilder() + .id(0) + .submittedAt('2018-12-20T20:40:55Z') + .addComment(c => c.id(originalCommentId).path('file0.txt').body('OG comment')) + .build(); + + const review2 = reviewBuilder() + .id(1) + .submittedAt('2018-12-22T20:40:55Z') + .addComment(c => c.id(2).path('file0.txt').replyTo(originalCommentId).body('first reply to OG comment')) + .build(); + + const review3 = reviewBuilder() + .id(2) + .submittedAt('2018-12-25T20:40:55Z') + .addComment(c => c.id(3).path('file0.txt').replyTo(originalCommentId).body('second reply to OG comment')) + .build(); + + const wrapper = shallow(buildApp({reviewSpecs: [review1, review2, review3]})); + + // adding this manually to reviewsById because the last time you call collectComments it groups them, and we don't want to do that just yet. + wrapper.instance().reviewsById.set(review2.id, {submittedAt: review2.submittedAt, comments: review2.comments, fetchingMoreComments: false}); + wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); + + wrapper.instance().collectComments({reviewId: review3.id, submittedAt: review3.submittedAt, comments: review3.comments, fetchingMoreComments: false}); + const threadedComments = wrapper.instance().state[originalCommentId]; + assert.lengthOf(threadedComments, 3); + + assert.strictEqual(threadedComments[0].body, 'OG comment'); + assert.strictEqual(threadedComments[1].body, 'first reply to OG comment'); + assert.strictEqual(threadedComments[2].body, 'second reply to OG comment'); + }); + + it('comments with a replyTo id that does not point to an existing comment are threaded separately', function() { const outdatedCommentId = 1; const replyToOutdatedCommentId = 2; From bc87b98247c4d70867143e3a4173eec267ceaf53 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Tue, 8 Jan 2019 18:03:26 -0800 Subject: [PATCH 109/120] update react component atlas --- docs/react-component-atlas.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/react-component-atlas.md b/docs/react-component-atlas.md index 383e3b78eb..596b3acbb4 100644 --- a/docs/react-component-atlas.md +++ b/docs/react-component-atlas.md @@ -124,6 +124,13 @@ This is a high-level overview of the structure of the React component tree that > > > > > [``](/lib/containers/pr-changed-files-container.js) > > > +> > > Fetch all reviews and comments for a pull request, group comments, and render them. +> > > [``](/lib/containers/pr-reviews-container.js) +> > > [``](/lib/containers/pr-review-comments-container.js) +> > > [``](lib/controllers/pr-reviews-controller.js) +> > > [``](lib/views/pr-review-comments-view.js) +> > > [``](lib/views/pr-review-comments-view.js) +> > > > > > Show all the changes, separated by files, introduced in a pull request. > > > > > > > [``](/lib/controllers/multi-file-patch-controller.js) From 95c7d6715aeed2d787fed6b8abec7dec1aea6625 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 9 Jan 2019 09:30:21 -0800 Subject: [PATCH 110/120] fussing with the test formatting --- test/controllers/pr-reviews-controller.test.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 8392258ad7..1fef175c8d 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -220,7 +220,7 @@ describe('PullRequestReviewsController', function() { const wrapper = shallow(buildApp({reviewSpecs: [review1, review2, review3]})); - // adding this manually to reviewsById because the last time you call collectComments it groups them, and we don't want to do that just yet. + // adding these manually to reviewsById because the last time you call collectComments it groups them, and we don't want to do that just yet. wrapper.instance().reviewsById.set(review2.id, {submittedAt: review2.submittedAt, comments: review2.comments, fetchingMoreComments: false}); wrapper.instance().reviewsById.set(review1.id, {submittedAt: review1.submittedAt, comments: review1.comments, fetchingMoreComments: false}); @@ -233,7 +233,6 @@ describe('PullRequestReviewsController', function() { assert.strictEqual(threadedComments[2].body, 'second reply to OG comment'); }); - it('comments with a replyTo id that does not point to an existing comment are threaded separately', function() { const outdatedCommentId = 1; const replyToOutdatedCommentId = 2; @@ -250,6 +249,5 @@ describe('PullRequestReviewsController', function() { assert.lengthOf(comments, 1); assert.strictEqual(comments[0].body, 'reply to outdated comment'); }); - }); }); From 56f0eae8e422f6a32086cb04d4b0087af5ea408e Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 9 Jan 2019 13:06:30 -0800 Subject: [PATCH 111/120] explicitly test date comparator --- .../controllers/pr-reviews-controller.test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 1fef175c8d..4edf917316 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -250,4 +250,23 @@ describe('PullRequestReviewsController', function() { assert.strictEqual(comments[0].body, 'reply to outdated comment'); }); }); + describe('compareReviewsByDate', function() { + let wrapper; + const reviewA = reviewBuilder().submittedAt('2018-12-28T20:40:55Z').build(); + const reviewB = reviewBuilder().submittedAt('2018-12-27T20:40:55Z').build(); + + beforeEach(function() { + wrapper = shallow(buildApp()); + }); + + it('returns 1 if reviewA is older', function() { + assert.strictEqual(wrapper.instance().compareReviewsByDate(reviewA, reviewB), 1); + }); + it('return -1 if reviewB is older', function() { + assert.strictEqual(wrapper.instance().compareReviewsByDate(reviewB, reviewA), -1); + }); + it('returns 0 if reviews have the same date', function() { + assert.strictEqual(wrapper.instance().compareReviewsByDate(reviewA, reviewA), 0); + }); + }); }); From 7ff898fc09625abb84bd0d70fb5176379e6e582a Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 9 Jan 2019 13:49:17 -0800 Subject: [PATCH 112/120] t e s t c o v e r a g e --- test/controllers/pr-reviews-controller.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 4edf917316..11a1ff9729 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -250,6 +250,18 @@ describe('PullRequestReviewsController', function() { assert.strictEqual(comments[0].body, 'reply to outdated comment'); }); }); + + describe('handleError', function() { + it('attempts to load more reviews', function() { + const wrapper = shallow(buildApp()); + + const loadMoreStub = sinon.stub(wrapper.instance(), '_attemptToLoadMoreReviews'); + wrapper.instance().handleError(); + + assert.strictEqual(loadMoreStub.callCount, 1); + }); + }); + describe('compareReviewsByDate', function() { let wrapper; const reviewA = reviewBuilder().submittedAt('2018-12-28T20:40:55Z').build(); From f805399bf505e5b304fead82cc5a26202a9325da Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Wed, 9 Jan 2019 16:27:30 -0800 Subject: [PATCH 113/120] add ugly ForwardRef thing to fix tests --- test/controllers/pr-reviews-controller.test.js | 2 +- test/views/multi-file-patch-view.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index 11a1ff9729..d6210d07bc 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -64,7 +64,7 @@ describe('PullRequestReviewsController', function() { const reviewSpecs = [review1, review2]; const wrapper = shallow(buildApp({reviewSpecs})); - const containers = wrapper.find('Relay(BarePullRequestReviewCommentsContainer)'); + const containers = wrapper.find('ForwardRef(Relay(BarePullRequestReviewCommentsContainer))'); assert.strictEqual(containers.length, 2); assert.strictEqual(containers.at(0).prop('review').id, review1.id); diff --git a/test/views/multi-file-patch-view.test.js b/test/views/multi-file-patch-view.test.js index 813c206af9..d3436debf5 100644 --- a/test/views/multi-file-patch-view.test.js +++ b/test/views/multi-file-patch-view.test.js @@ -137,7 +137,7 @@ describe('MultiFilePatchView', function() { it('renders a PullRequestsReviewsContainer if itemType is IssueishDetailItem', function() { const wrapper = shallow(buildApp({itemType: IssueishDetailItem})); - assert.lengthOf(wrapper.find('Relay(PullRequestReviewsController)'), 1); + assert.lengthOf(wrapper.find('ForwardRef(Relay(PullRequestReviewsController))'), 1); }); it('renders the file patch within an editor', function() { From a9a7ecd6c347d205f59318c03f99d3c031a5b7b7 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 10 Jan 2019 14:50:07 -0800 Subject: [PATCH 114/120] move clock inside the only test that needs it it's cleaner, and the tests were stalling when run all together (the individual tests worked fine) --- test/controllers/pr-reviews-controller.test.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index d6210d07bc..eaba38f15c 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -108,15 +108,6 @@ describe('PullRequestReviewsController', function() { }); describe('attemptToLoadMoreReviews', function() { - let clock; - beforeEach(function() { - clock = sinon.useFakeTimers(); - }); - - afterEach(function() { - clock = sinon.restore(); - }); - it('does not call loadMore if hasMore is false', function() { const relayLoadMoreStub = sinon.stub(); const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); @@ -138,6 +129,7 @@ describe('PullRequestReviewsController', function() { }); it('calls loadMore after a timeout if hasMore is true and isLoading is true', function() { + const clock = sinon.useFakeTimers(); const relayLoadMoreStub = sinon.stub(); const relayHasMore = () => { return true; }; const relayIsLoading = () => { return true; }; @@ -153,6 +145,7 @@ describe('PullRequestReviewsController', function() { clock.tick(PAGINATION_WAIT_TIME_MS); assert.strictEqual(relayLoadMoreStub.callCount, 1); assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleError]); + sinon.restore(); }); }); From 888979372d6c6e27026d29caf2e4405bec6f6a73 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 10 Jan 2019 14:51:18 -0800 Subject: [PATCH 115/120] `accumulate` is totes a better name for those functions Co-Authored-By: Ash Wilson --- lib/containers/pr-review-comments-container.js | 6 +++--- lib/controllers/pr-reviews-controller.js | 4 ++-- test/containers/pr-review-comments-container.test.js | 10 +++++----- test/controllers/pr-reviews-controller.test.js | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index c514c9f313..9ab65f7e10 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -21,10 +21,10 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { } componentDidMount() { - this.handleComments(); + this.accumulateComments(); } - handleComments = error => { + accumulateComments = error => { /* istanbul ignore if */ if (error) { // eslint-disable-next-line no-console @@ -58,7 +58,7 @@ export class BarePullRequestReviewCommentsContainer extends React.Component { _loadMoreComments = () => { this.props.relay.loadMore( PAGE_SIZE, - this.handleComments, + this.accumulateComments, ); } diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index 428bb38b7b..d7c3acd62c 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -43,7 +43,7 @@ export default class PullRequestReviewsController extends React.Component { } } - handleError = error => { + accumulateReviews = error => { /* istanbul ignore if */ if (error) { // eslint-disable-next-line no-console @@ -54,7 +54,7 @@ export default class PullRequestReviewsController extends React.Component { } _loadMoreReviews = () => { - this.props.relay.loadMore(PAGE_SIZE, this.handleError); + this.props.relay.loadMore(PAGE_SIZE, this.accumulateReviews); } render() { diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index 8eb7916221..164124640b 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -60,18 +60,18 @@ describe('PullRequestReviewCommentsContainer', function() { const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); wrapper.instance()._loadMoreComments(); - assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleComments]); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().accumulateComments]); }); }); - describe('handleComments', function() { + describe('accumulateComments', function() { it('collects comments and attempts to load more comments', function() { const collectCommentsStub = sinon.stub(); const wrapper = shallow(buildApp({}, {collectComments: collectCommentsStub})); // collect comments is called when mounted, we don't care about that in this test so reset the count collectCommentsStub.reset(); sinon.stub(wrapper.instance(), '_attemptToLoadMoreComments'); - wrapper.instance().handleComments(); + wrapper.instance().accumulateComments(); assert.strictEqual(collectCommentsStub.callCount, 1); @@ -112,7 +112,7 @@ describe('PullRequestReviewCommentsContainer', function() { wrapper.instance()._attemptToLoadMoreComments(); assert.strictEqual(relayLoadMoreStub.callCount, 1); - assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleComments]); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().accumulateComments]); }); it('calls loadMore after a timeout if hasMore is true and isLoading is true', function() { @@ -130,7 +130,7 @@ describe('PullRequestReviewCommentsContainer', function() { clock.tick(PAGINATION_WAIT_TIME_MS); assert.strictEqual(relayLoadMoreStub.callCount, 1); - assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleComments]); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().accumulateComments]); }); }); }); diff --git a/test/controllers/pr-reviews-controller.test.js b/test/controllers/pr-reviews-controller.test.js index eaba38f15c..83cfa8eadd 100644 --- a/test/controllers/pr-reviews-controller.test.js +++ b/test/controllers/pr-reviews-controller.test.js @@ -125,7 +125,7 @@ describe('PullRequestReviewsController', function() { wrapper.instance()._attemptToLoadMoreReviews(); assert.strictEqual(relayLoadMoreStub.callCount, 1); - assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleError]); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().accumulateReviews]); }); it('calls loadMore after a timeout if hasMore is true and isLoading is true', function() { @@ -144,7 +144,7 @@ describe('PullRequestReviewsController', function() { clock.tick(PAGINATION_WAIT_TIME_MS); assert.strictEqual(relayLoadMoreStub.callCount, 1); - assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleError]); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().accumulateReviews]); sinon.restore(); }); }); @@ -155,7 +155,7 @@ describe('PullRequestReviewsController', function() { const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); wrapper.instance()._loadMoreReviews(); - assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().handleError]); + assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().accumulateReviews]); }); }); @@ -244,12 +244,12 @@ describe('PullRequestReviewsController', function() { }); }); - describe('handleError', function() { + describe('accumulateReviews', function() { it('attempts to load more reviews', function() { const wrapper = shallow(buildApp()); const loadMoreStub = sinon.stub(wrapper.instance(), '_attemptToLoadMoreReviews'); - wrapper.instance().handleError(); + wrapper.instance().accumulateReviews(); assert.strictEqual(loadMoreStub.callCount, 1); }); From 7155d25a71f0523c2bb26891ab753447f3089a84 Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 10 Jan 2019 14:53:35 -0800 Subject: [PATCH 116/120] move other fake :clock: inside test too --- .../containers/pr-review-comments-container.test.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test/containers/pr-review-comments-container.test.js b/test/containers/pr-review-comments-container.test.js index 164124640b..df3d9ea318 100644 --- a/test/containers/pr-review-comments-container.test.js +++ b/test/containers/pr-review-comments-container.test.js @@ -86,15 +86,6 @@ describe('PullRequestReviewCommentsContainer', function() { }); describe('attemptToLoadMoreComments', function() { - let clock; - beforeEach(function() { - clock = sinon.useFakeTimers(); - }); - - afterEach(function() { - clock = sinon.restore(); - }); - it('does not call loadMore if hasMore is false', function() { const relayLoadMoreStub = sinon.stub(); const wrapper = shallow(buildApp({relayLoadMore: relayLoadMoreStub})); @@ -116,6 +107,7 @@ describe('PullRequestReviewCommentsContainer', function() { }); it('calls loadMore after a timeout if hasMore is true and isLoading is true', function() { + const clock = sinon.useFakeTimers(); const relayLoadMoreStub = sinon.stub(); const relayHasMore = () => { return true; }; const relayIsLoading = () => { return true; }; @@ -131,6 +123,9 @@ describe('PullRequestReviewCommentsContainer', function() { clock.tick(PAGINATION_WAIT_TIME_MS); assert.strictEqual(relayLoadMoreStub.callCount, 1); assert.deepEqual(relayLoadMoreStub.lastCall.args, [PAGE_SIZE, wrapper.instance().accumulateComments]); + + // buybye fake timer it was nice knowing you + sinon.restore(); }); }); }); From 615df63c31fd0432b5245e95f48ae4c6cd40451d Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Thu, 10 Jan 2019 16:50:02 -0800 Subject: [PATCH 117/120] deal with minimized comments you can mark comments as spammy, or even abusive, so I'm really glad we caught this before shipping. --- .../issueishDetailContainerQuery.graphql.js | 12 ++++- .../prReviewCommentsContainerQuery.graphql.js | 12 ++++- ...rReviewCommentsContainer_review.graphql.js | 10 +++- .../prReviewsContainerQuery.graphql.js | 12 ++++- .../pr-review-comments-container.js | 1 + .../prDetailViewRefetchQuery.graphql.js | 12 ++++- lib/views/pr-review-comments-view.js | 46 ++++++++++++------- styles/pr-comment.less | 8 ++++ 8 files changed, 88 insertions(+), 25 deletions(-) diff --git a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js index 08c8d4132a..2ec6a9595d 100644 --- a/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js +++ b/lib/containers/__generated__/issueishDetailContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash b2844afc76c2e9c390039931a9af7d40 + * @relayHash aa9982b03c50cc4fd52b07a4206b1eb0 */ /* eslint-disable */ @@ -559,6 +559,7 @@ fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { } } bodyHTML + isMinimized path position replyTo { @@ -1207,7 +1208,7 @@ return { "operationKind": "query", "name": "issueishDetailContainerQuery", "id": null, - "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_3D8CP9\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_3D8CP9 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", + "text": "query issueishDetailContainerQuery(\n $repoOwner: String!\n $repoName: String!\n $issueishNumber: Int!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository(owner: $repoOwner, name: $repoName) {\n ...issueishDetailController_repository_y3nHF\n id\n }\n}\n\nfragment issueishDetailController_repository_y3nHF on Repository {\n ...issueDetailView_repository\n ...prDetailView_repository\n name\n owner {\n __typename\n login\n id\n }\n issue: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on Issue {\n title\n number\n ...issueDetailView_issue_3D8CP9\n }\n ... on Node {\n id\n }\n }\n pullRequest: issueOrPullRequest(number: $issueishNumber) {\n __typename\n ... on PullRequest {\n title\n number\n headRefName\n headRepository {\n name\n owner {\n __typename\n login\n id\n }\n url\n sshUrl\n id\n }\n ...prDetailView_pullRequest_2qM2KL\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment issueDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_repository on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment issueDetailView_issue_3D8CP9 on Issue {\n __typename\n ... on Node {\n id\n }\n state\n number\n title\n bodyHTML\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...issueTimelineController_issue_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n isMinimized\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n\nfragment issueTimelineController_issue_3D8CP9 on Issue {\n url\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1647,6 +1648,13 @@ return { v2, v26, v12, + { + "kind": "ScalarField", + "alias": null, + "name": "isMinimized", + "args": null, + "storageKey": null + }, v39, v40, { diff --git a/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js index 0904ea42ba..6fa92aa46b 100644 --- a/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewCommentsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 5e0b465f16f55322d70100cd893a1c04 + * @relayHash d372fbac67c0b387985686b68db27130 */ /* eslint-disable */ @@ -63,6 +63,7 @@ fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { } } bodyHTML + isMinimized path position replyTo { @@ -139,7 +140,7 @@ return { "operationKind": "query", "name": "prReviewCommentsContainerQuery", "id": null, - "text": "query prReviewCommentsContainerQuery(\n $commentCount: Int!\n $commentCursor: String\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on PullRequestReview {\n ...prReviewCommentsContainer_review_1VbUmL\n }\n id\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewCommentsContainerQuery(\n $commentCount: Int!\n $commentCursor: String\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ... on PullRequestReview {\n ...prReviewCommentsContainer_review_1VbUmL\n }\n id\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n isMinimized\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -306,6 +307,13 @@ return { "args": null, "storageKey": null }, + { + "kind": "ScalarField", + "alias": null, + "name": "isMinimized", + "args": null, + "storageKey": null + }, { "kind": "ScalarField", "alias": null, diff --git a/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js b/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js index aec8134452..ebe2215fea 100644 --- a/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js +++ b/lib/containers/__generated__/prReviewCommentsContainer_review.graphql.js @@ -27,6 +27,7 @@ export type prReviewCommentsContainer_review = {| +login: string, |}, +bodyHTML: any, + +isMinimized: boolean, +path: string, +position: ?number, +replyTo: ?{| @@ -181,6 +182,13 @@ return { "args": null, "storageKey": null }, + { + "kind": "ScalarField", + "alias": null, + "name": "isMinimized", + "args": null, + "storageKey": null + }, { "kind": "ScalarField", "alias": null, @@ -238,5 +246,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '63492273ddd049ed59809581c7795811'; +(node/*: any*/).hash = 'ccea6475d7b22690b4aa61757b705968'; module.exports = node; diff --git a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js index 7e64650ea5..19537cca71 100644 --- a/lib/containers/__generated__/prReviewsContainerQuery.graphql.js +++ b/lib/containers/__generated__/prReviewsContainerQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 455845bc2fe2987a2c32d72dbc9247b6 + * @relayHash a3845eb13d831f5f140cc6adc98de1df */ /* eslint-disable */ @@ -108,6 +108,7 @@ fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { } } bodyHTML + isMinimized path position replyTo { @@ -263,7 +264,7 @@ return { "operationKind": "query", "name": "prReviewsContainerQuery", "id": null, - "text": "query prReviewsContainerQuery(\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_y4qc0\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prReviewsContainerQuery(\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n $url: URI!\n) {\n resource(url: $url) {\n __typename\n ... on PullRequest {\n ...prReviewsContainer_pullRequest_y4qc0\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n isMinimized\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -492,6 +493,13 @@ return { "args": null, "storageKey": null }, + { + "kind": "ScalarField", + "alias": null, + "name": "isMinimized", + "args": null, + "storageKey": null + }, { "kind": "ScalarField", "alias": null, diff --git a/lib/containers/pr-review-comments-container.js b/lib/containers/pr-review-comments-container.js index 9ab65f7e10..16051026bd 100644 --- a/lib/containers/pr-review-comments-container.js +++ b/lib/containers/pr-review-comments-container.js @@ -94,6 +94,7 @@ export default createPaginationContainer(BarePullRequestReviewCommentsContainer, login } bodyHTML + isMinimized path position replyTo { diff --git a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js index 8b5d424baa..42e336a55a 100644 --- a/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js +++ b/lib/views/__generated__/prDetailViewRefetchQuery.graphql.js @@ -1,6 +1,6 @@ /** * @flow - * @relayHash 631a28049723f0b6b8a3f8eb25a4f955 + * @relayHash c9c759b66c17ed333ce2946f8675ee19 */ /* eslint-disable */ @@ -475,6 +475,7 @@ fragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview { } } bodyHTML + isMinimized path position replyTo { @@ -885,7 +886,7 @@ return { "operationKind": "query", "name": "prDetailViewRefetchQuery", "id": null, - "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", + "text": "query prDetailViewRefetchQuery(\n $repoId: ID!\n $issueishId: ID!\n $timelineCount: Int!\n $timelineCursor: String\n $commitCount: Int!\n $commitCursor: String\n $reviewCount: Int!\n $reviewCursor: String\n $commentCount: Int!\n $commentCursor: String\n) {\n repository: node(id: $repoId) {\n __typename\n ...prDetailView_repository_3D8CP9\n id\n }\n pullRequest: node(id: $issueishId) {\n __typename\n ...prDetailView_pullRequest_2qM2KL\n id\n }\n}\n\nfragment prDetailView_repository_3D8CP9 on Repository {\n id\n name\n owner {\n __typename\n login\n id\n }\n}\n\nfragment prDetailView_pullRequest_2qM2KL on PullRequest {\n __typename\n ... on Node {\n id\n }\n isCrossRepository\n changedFiles\n ...prReviewsContainer_pullRequest_y4qc0\n ...prCommitsView_pullRequest_38TpXw\n countedCommits: commits {\n totalCount\n }\n ...prStatusesView_pullRequest\n state\n number\n title\n bodyHTML\n baseRefName\n headRefName\n author {\n __typename\n login\n avatarUrl\n ... on User {\n url\n }\n ... on Bot {\n url\n }\n ... on Node {\n id\n }\n }\n ...prTimelineController_pullRequest_3D8CP9\n ... on UniformResourceLocatable {\n url\n }\n ... on Reactable {\n reactionGroups {\n content\n users {\n totalCount\n }\n }\n }\n}\n\nfragment prReviewsContainer_pullRequest_y4qc0 on PullRequest {\n url\n reviews(first: $reviewCount, after: $reviewCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n body\n commitId: commit {\n oid\n id\n }\n state\n submittedAt\n login: author {\n __typename\n login\n ... on Node {\n id\n }\n }\n author {\n __typename\n avatarUrl\n ... on Node {\n id\n }\n }\n ...prReviewCommentsContainer_review_1VbUmL\n __typename\n }\n }\n }\n}\n\nfragment prCommitsView_pullRequest_38TpXw on PullRequest {\n url\n commits(first: $commitCount, after: $commitCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n commit {\n id\n ...prCommitView_item\n }\n id\n __typename\n }\n }\n }\n}\n\nfragment prStatusesView_pullRequest on PullRequest {\n id\n recentCommits: commits(last: 1) {\n edges {\n node {\n commit {\n status {\n state\n contexts {\n id\n state\n ...prStatusContextView_context\n }\n id\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment prTimelineController_pullRequest_3D8CP9 on PullRequest {\n url\n ...headRefForcePushedEventView_issueish\n timeline(first: $timelineCount, after: $timelineCursor) {\n pageInfo {\n endCursor\n hasNextPage\n }\n edges {\n cursor\n node {\n __typename\n ...commitsView_nodes\n ...issueCommentView_item\n ...mergedEventView_item\n ...headRefForcePushedEventView_item\n ...commitCommentThreadView_item\n ...crossReferencedEventsView_nodes\n ... on Node {\n id\n }\n }\n }\n }\n}\n\nfragment headRefForcePushedEventView_issueish on PullRequest {\n headRefName\n headRepositoryOwner {\n __typename\n login\n id\n }\n repository {\n owner {\n __typename\n login\n id\n }\n id\n }\n}\n\nfragment commitsView_nodes on Commit {\n id\n author {\n name\n user {\n login\n id\n }\n }\n ...commitView_commit\n}\n\nfragment issueCommentView_item on IssueComment {\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n createdAt\n url\n}\n\nfragment mergedEventView_item on MergedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n mergeRefName\n createdAt\n}\n\nfragment headRefForcePushedEventView_item on HeadRefForcePushedEvent {\n actor {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n beforeCommit {\n oid\n id\n }\n afterCommit {\n oid\n id\n }\n createdAt\n}\n\nfragment commitCommentThreadView_item on CommitCommentThread {\n commit {\n oid\n id\n }\n comments(first: 100) {\n edges {\n node {\n id\n ...commitCommentView_item\n }\n }\n }\n}\n\nfragment crossReferencedEventsView_nodes on CrossReferencedEvent {\n id\n referencedAt\n isCrossRepository\n actor {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n source {\n __typename\n ... on RepositoryNode {\n repository {\n name\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n ...crossReferencedEventView_item\n}\n\nfragment crossReferencedEventView_item on CrossReferencedEvent {\n id\n isCrossRepository\n source {\n __typename\n ... on Issue {\n number\n title\n url\n issueState: state\n }\n ... on PullRequest {\n number\n title\n url\n prState: state\n }\n ... on RepositoryNode {\n repository {\n name\n isPrivate\n owner {\n __typename\n login\n id\n }\n id\n }\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment commitCommentView_item on CommitComment {\n author {\n __typename\n login\n avatarUrl\n ... on Node {\n id\n }\n }\n commit {\n oid\n id\n }\n bodyHTML\n createdAt\n path\n position\n}\n\nfragment commitView_commit on Commit {\n author {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n committer {\n name\n avatarUrl\n user {\n login\n id\n }\n }\n authoredByCommitter\n sha: oid\n message\n messageHeadlineHTML\n commitUrl\n}\n\nfragment prStatusContextView_context on StatusContext {\n context\n description\n state\n targetUrl\n}\n\nfragment prCommitView_item on Commit {\n committer {\n avatarUrl\n name\n date\n }\n messageHeadline\n messageBody\n shortSha: abbreviatedOid\n sha: oid\n url\n}\n\nfragment prReviewCommentsContainer_review_1VbUmL on PullRequestReview {\n id\n submittedAt\n comments(first: $commentCount, after: $commentCursor) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n id\n author {\n __typename\n avatarUrl\n login\n ... on Node {\n id\n }\n }\n bodyHTML\n isMinimized\n path\n position\n replyTo {\n id\n }\n createdAt\n url\n __typename\n }\n }\n }\n}\n", "metadata": {}, "fragment": { "kind": "Fragment", @@ -1133,6 +1134,13 @@ return { v6, v24, v25, + { + "kind": "ScalarField", + "alias": null, + "name": "isMinimized", + "args": null, + "storageKey": null + }, v26, v27, { diff --git a/lib/views/pr-review-comments-view.js b/lib/views/pr-review-comments-view.js index 09f8bc9bf9..80e89af272 100644 --- a/lib/views/pr-review-comments-view.js +++ b/lib/views/pr-review-comments-view.js @@ -5,6 +5,8 @@ import {Point, Range} from 'atom'; import {toNativePathSep} from '../helpers'; import Marker from '../atom/marker'; import Decoration from '../atom/decoration'; +import Octicon from '../atom/octicon'; + import GithubDotcomMarkdown from './github-dotcom-markdown'; import Timeago from './timeago'; @@ -65,25 +67,37 @@ export class PullRequestCommentView extends React.Component { bodyHTML: PropTypes.string, url: PropTypes.string, createdAt: PropTypes.string.isRequired, + isMinimized: PropTypes.bool.isRequired, }).isRequired, } render() { - const author = this.props.comment.author; - const login = author ? author.login : 'someone'; - return ( -
-
- {login} - {login} commented{' '} - - - -
-
- -
-
- ); + if (this.props.comment.isMinimized) { + return ( +
+ + + This comment was hidden + +
+ ); + } else { + const author = this.props.comment.author; + const login = author ? author.login : 'someone'; + return ( +
+
+ {login} + {login} commented{' '} + + + +
+
+ +
+
+ ); + } } } diff --git a/styles/pr-comment.less b/styles/pr-comment.less index f2ff654985..f71f9f097f 100644 --- a/styles/pr-comment.less +++ b/styles/pr-comment.less @@ -50,4 +50,12 @@ margin-left: @avatar-size + @avatar-spacing; // avatar + margin } + &-hidden { + font-size: 14px; + } + + &-icon { + vertical-align: middle; + } + } From adf996ec3bae29e53253b1f540d1e311e1cebf0d Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 11 Jan 2019 09:37:21 -0500 Subject: [PATCH 118/120] Handle path separator normalization on Windows --- lib/containers/pr-changed-files-container.js | 9 +++++---- lib/models/patch/multi-file-patch.js | 1 - test/containers/pr-changed-files-container.test.js | 8 ++++++++ test/fixtures/diffs/raw-diff.js | 6 +++--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/containers/pr-changed-files-container.js b/lib/containers/pr-changed-files-container.js index beb3c5d38b..539c7a3b82 100644 --- a/lib/containers/pr-changed-files-container.js +++ b/lib/containers/pr-changed-files-container.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import {parse as parseDiff} from 'what-the-diff'; import {ItemTypePropType, EndpointPropType} from '../prop-types'; +import {toNativePathSep} from '../helpers'; import MultiFilePatchController from '../controllers/multi-file-patch-controller'; import LoadingView from '../views/loading-view'; import ErrorView from '../views/error-view'; @@ -60,13 +61,13 @@ export default class PullRequestChangedFilesContainer extends React.Component { buildPatch(rawDiff) { const diffs = parseDiff(rawDiff).map(diff => { - // diff coming from API will have the defaul git diff prefixes a/ and b/ - // e.g. a/file1.js and b/file2.js + // diff coming from API will have the defaul git diff prefixes a/ and b/ and use *nix-style / path separators. + // e.g. a/dir/file1.js and b/dir/file2.js // see https://git-scm.com/docs/git-diff#_generating_patches_with_p return { ...diff, - newPath: diff.newPath ? diff.newPath.replace(/^[a|b]\//, '') : diff.newPath, - oldPath: diff.oldPath ? diff.oldPath.replace(/^[a|b]\//, '') : diff.oldPath, + newPath: diff.newPath ? toNativePathSep(diff.newPath.replace(/^[a|b]\//, '')) : diff.newPath, + oldPath: diff.oldPath ? toNativePathSep(diff.oldPath.replace(/^[a|b]\//, '')) : diff.oldPath, }; }); return buildMultiFilePatch(diffs); diff --git a/lib/models/patch/multi-file-patch.js b/lib/models/patch/multi-file-patch.js index e04a498416..e21ae6158f 100644 --- a/lib/models/patch/multi-file-patch.js +++ b/lib/models/patch/multi-file-patch.js @@ -340,7 +340,6 @@ export default class MultiFilePatch { } getBufferRowForDiffPosition = (fileName, diffRow) => { - // TODO verify that this works on Windows const {startBufferRow, index} = this.diffRowOffsetIndices.get(fileName); const {offset} = index.lowerBound({diffRow}).data(); return startBufferRow + diffRow - offset; diff --git a/test/containers/pr-changed-files-container.test.js b/test/containers/pr-changed-files-container.test.js index af252cb56c..47896dcfb4 100644 --- a/test/containers/pr-changed-files-container.test.js +++ b/test/containers/pr-changed-files-container.test.js @@ -1,6 +1,7 @@ import React from 'react'; import {shallow} from 'enzyme'; import {parse as parseDiff} from 'what-the-diff'; +import path from 'path'; import {rawDiff, rawDiffWithPathPrefix} from '../fixtures/diffs/raw-diff'; import {buildMultiFilePatch} from '../../lib/models/patch'; @@ -79,6 +80,13 @@ describe('PullRequestChangedFilesContainer', function() { assert.notMatch(filePatches[0].oldFile.path, /^[a|b]\//); }); + it('converts file paths to use native path separators', function() { + const wrapper = shallow(buildApp()); + const {filePatches} = wrapper.instance().buildPatch(rawDiffWithPathPrefix); + assert.strictEqual(filePatches[0].newFile.path, path.join('bad/path.txt')); + assert.strictEqual(filePatches[0].oldFile.path, path.join('bad/path.txt')); + }); + it('passes loaded diff data through to the controller', async function() { const wrapper = shallow(buildApp({ token: '4321', diff --git a/test/fixtures/diffs/raw-diff.js b/test/fixtures/diffs/raw-diff.js index 0d57194fec..473df75cb5 100644 --- a/test/fixtures/diffs/raw-diff.js +++ b/test/fixtures/diffs/raw-diff.js @@ -12,10 +12,10 @@ const rawDiff = dedent` line3 `; const rawDiffWithPathPrefix = dedent` - diff --git a/badpath.txt b/badpath.txt + diff --git a/bad/path.txt b/bad/path.txt index af607bb..cfac420 100644 - --- a/badpath.txt - +++ b/badpath.txt + --- a/bad/path.txt + +++ b/bad/path.txt @@ -1,2 +1,3 @@ line0 -line1 From 00ff5d0838b38a549f81761e05b56f301e10ff27 Mon Sep 17 00:00:00 2001 From: Vanessa Yuen Date: Fri, 11 Jan 2019 16:36:12 +0100 Subject: [PATCH 119/120] add hidden comment test --- test/views/pr-comments-view.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/views/pr-comments-view.test.js b/test/views/pr-comments-view.test.js index 3a87f20737..15e2562626 100644 --- a/test/views/pr-comments-view.test.js +++ b/test/views/pr-comments-view.test.js @@ -118,4 +118,10 @@ describe('PullRequestCommentView', function() { const wrapper = shallow(buildApp({author: null})); assert.isTrue(wrapper.text().includes('someone commented')); }); + + it('hides minimized comment', function() { + const wrapper = shallow(buildApp({isMinimized: true})); + assert.isTrue(wrapper.find('.github-PrComment-hidden').exists()); + assert.isFalse(wrapper.find('.github-PrComment-header').exists()); + }); }); From 9f5c577d57b9bac3b0f61af7b205653241a4eedf Mon Sep 17 00:00:00 2001 From: Tilde Ann Thurium Date: Fri, 11 Jan 2019 11:50:59 -0800 Subject: [PATCH 120/120] :art: comment. --- lib/controllers/pr-reviews-controller.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/controllers/pr-reviews-controller.js b/lib/controllers/pr-reviews-controller.js index d7c3acd62c..d10839eb69 100644 --- a/lib/controllers/pr-reviews-controller.js +++ b/lib/controllers/pr-reviews-controller.js @@ -122,12 +122,15 @@ export default class PullRequestReviewsController extends React.Component { if (!comment.replyTo) { state[comment.id] = [comment]; } else { - // TODO: look at this more closely... - // When comment being replied to is outdated...?? Not 100% sure... - // Why would we even get an outdated comment or a response to one here? // Ran into this error when viewing files for https://github.com/numpy/numpy/pull/9998 // for comment MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MzA1NTUzMw, - // who's replyTo comment is an outdated comment + // who's replyTo comment does not exist. + // Not sure how we'd get into this state -- tried replying to outdated, + // hidden, deleted, and resolved comments but none of those conditions + // got us here. + // It may be that this only affects older pull requests, before something + // changed with oudated comment behavior. + // anyhow, do this check and move on with our lives. if (!state[comment.replyTo.id]) { state[comment.id] = [comment]; } else {