diff --git a/package.json b/package.json index 61f9061b2d..377609848e 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "tokenInformation", "contribShareMenu", "fileComments", + "commentReactor", "contribCommentPeekContext", "contribCommentThreadAdditionalMenu", "codiconDecoration", diff --git a/src/@types/vscode.proposed.commentReactor.d.ts b/src/@types/vscode.proposed.commentReactor.d.ts new file mode 100644 index 0000000000..7356d025dd --- /dev/null +++ b/src/@types/vscode.proposed.commentReactor.d.ts @@ -0,0 +1,10 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +declare module 'vscode' { + export interface CommentReaction { + readonly reactors?: readonly string[]; + } +} diff --git a/src/common/comment.ts b/src/common/comment.ts index 4edd87a252..4bdcfdc6a1 100644 --- a/src/common/comment.ts +++ b/src/common/comment.ts @@ -23,6 +23,7 @@ export interface Reaction { count: number; icon?: vscode.Uri; viewerHasReacted: boolean; + reactors: readonly string[]; } export enum SubjectType { diff --git a/src/github/graphql.ts b/src/github/graphql.ts index 9a142b745d..1bf331f743 100644 --- a/src/github/graphql.ts +++ b/src/github/graphql.ts @@ -70,7 +70,10 @@ export interface IssueComment extends AbbreviatedIssueComment { export interface ReactionGroup { content: string; viewerHasReacted: boolean; - users: { + reactors: { + nodes: { + login: string; + }[] totalCount: number; }; } diff --git a/src/github/queriesShared.gql b/src/github/queriesShared.gql index 854e9b4dcf..23118dbe64 100644 --- a/src/github/queriesShared.gql +++ b/src/github/queriesShared.gql @@ -147,7 +147,12 @@ fragment Reactable on Reactable { reactionGroups { content viewerHasReacted - users { + reactors(first: 10) { + nodes { + ... on User { + login + } + } totalCount } } @@ -399,13 +404,7 @@ fragment ReviewComment on PullRequestReviewComment { originalCommit { oid } - reactionGroups { - content - viewerHasReacted - users { - totalCount - } - } + ...Reactable viewerCanUpdate viewerCanDelete } diff --git a/src/github/utils.ts b/src/github/utils.ts index a80151a957..ced796c928 100644 --- a/src/github/utils.ts +++ b/src/github/utils.ts @@ -217,6 +217,7 @@ export function updateCommentReactions(comment: vscode.Comment, reactions: React authorHasReacted: matchedReaction.viewerHasReacted, count: matchedReaction.count, iconPath: reaction.icon || '', + reactors: matchedReaction.reactors }; } else { newReaction = { label: reaction.label, authorHasReacted: false, count: 0, iconPath: reaction.icon || '' }; @@ -511,13 +512,14 @@ export function parseGraphQLReaction(reactionGroups: GraphQL.ReactionGroup[]): R }, {} as { [key: string]: { title: string; label: string; icon?: vscode.Uri } }); const reactions = reactionGroups - .filter(group => group.users.totalCount > 0) + .filter(group => group.reactors.totalCount > 0) .map(group => { const reaction: Reaction = { label: reactionContentEmojiMapping[group.content].label, - count: group.users.totalCount, + count: group.reactors.totalCount, icon: reactionContentEmojiMapping[group.content].icon, viewerHasReacted: group.viewerHasReacted, + reactors: group.reactors.nodes.map(node => node.login) }; return reaction;