diff --git a/src/renderer/utils/api/__mocks__/response-mocks.ts b/src/renderer/utils/api/__mocks__/response-mocks.ts index 983d89c24..29de5fd86 100644 --- a/src/renderer/utils/api/__mocks__/response-mocks.ts +++ b/src/renderer/utils/api/__mocks__/response-mocks.ts @@ -81,6 +81,10 @@ export function mockDiscussionResponseNode(mocks: { totalCount: 0, }, labels: null, + reactions: { + totalCount: 0, + }, + reactionGroups: noReactionGroups, } satisfies DiscussionDetailsFragment; } diff --git a/src/renderer/utils/api/graphql/discussion.graphql b/src/renderer/utils/api/graphql/discussion.graphql index e17d20e52..788019024 100644 --- a/src/renderer/utils/api/graphql/discussion.graphql +++ b/src/renderer/utils/api/graphql/discussion.graphql @@ -37,6 +37,12 @@ fragment DiscussionDetails on Discussion { name } } + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment CommentFields on DiscussionComment { @@ -46,6 +52,12 @@ fragment CommentFields on DiscussionComment { ...AuthorFields } url + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment DiscussionCommentFields on DiscussionComment { diff --git a/src/renderer/utils/api/graphql/generated/gql.ts b/src/renderer/utils/api/graphql/generated/gql.ts index 246dcfaef..5d8e406bd 100644 --- a/src/renderer/utils/api/graphql/generated/gql.ts +++ b/src/renderer/utils/api/graphql/generated/gql.ts @@ -16,14 +16,14 @@ import * as types from './graphql'; */ type Documents = { "fragment AuthorFields on Actor {\n login\n htmlUrl: url\n avatarUrl: avatarUrl\n type: __typename\n}\n\nfragment MilestoneFields on Milestone {\n state\n title\n}\n\nfragment ReactionGroupFields on ReactionGroup {\n content\n reactors {\n totalCount\n }\n}": typeof types.AuthorFieldsFragmentDoc, - "query FetchDiscussionByNumber($owner: String!, $name: String!, $number: Int!, $lastThreadedComments: Int, $lastReplies: Int, $firstLabels: Int, $includeIsAnswered: Boolean!) {\n repository(owner: $owner, name: $name) {\n discussion(number: $number) {\n ...DiscussionDetails\n }\n }\n}\n\nfragment DiscussionDetails on Discussion {\n __typename\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastThreadedComments) {\n totalCount\n nodes {\n ...DiscussionCommentFields\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n}\n\nfragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n url\n}\n\nfragment DiscussionCommentFields on DiscussionComment {\n ...CommentFields\n replies(last: $lastReplies) {\n totalCount\n nodes {\n ...CommentFields\n }\n }\n}": typeof types.FetchDiscussionByNumberDocument, + "query FetchDiscussionByNumber($owner: String!, $name: String!, $number: Int!, $lastThreadedComments: Int, $lastReplies: Int, $firstLabels: Int, $includeIsAnswered: Boolean!) {\n repository(owner: $owner, name: $name) {\n discussion(number: $number) {\n ...DiscussionDetails\n }\n }\n}\n\nfragment DiscussionDetails on Discussion {\n __typename\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastThreadedComments) {\n totalCount\n nodes {\n ...DiscussionCommentFields\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}\n\nfragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n url\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}\n\nfragment DiscussionCommentFields on DiscussionComment {\n ...CommentFields\n replies(last: $lastReplies) {\n totalCount\n nodes {\n ...CommentFields\n }\n }\n}": typeof types.FetchDiscussionByNumberDocument, "query FetchIssueByNumber($owner: String!, $name: String!, $number: Int!, $lastComments: Int, $firstLabels: Int) {\n repository(owner: $owner, name: $name) {\n issue(number: $number) {\n ...IssueDetails\n }\n }\n}\n\nfragment IssueDetails on Issue {\n __typename\n number\n title\n url\n state\n stateReason\n milestone {\n ...MilestoneFields\n }\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n url\n author {\n ...AuthorFields\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}": typeof types.FetchIssueByNumberDocument, "query FetchMergedDetailsTemplate($ownerINDEX: String!, $nameINDEX: String!, $numberINDEX: Int!, $isDiscussionNotificationINDEX: Boolean!, $isIssueNotificationINDEX: Boolean!, $isPullRequestNotificationINDEX: Boolean!, $lastComments: Int, $lastThreadedComments: Int, $lastReplies: Int, $lastReviews: Int, $firstLabels: Int, $firstClosingIssues: Int, $includeIsAnswered: Boolean!) {\n ...MergedDetailsQueryTemplate\n}\n\nfragment MergedDetailsQueryTemplate on Query {\n repository(owner: $ownerINDEX, name: $nameINDEX) {\n discussion(number: $numberINDEX) @include(if: $isDiscussionNotificationINDEX) {\n ...DiscussionDetails\n }\n issue(number: $numberINDEX) @include(if: $isIssueNotificationINDEX) {\n ...IssueDetails\n }\n pullRequest(number: $numberINDEX) @include(if: $isPullRequestNotificationINDEX) {\n ...PullRequestDetails\n }\n }\n}": typeof types.FetchMergedDetailsTemplateDocument, "query FetchPullRequestByNumber($owner: String!, $name: String!, $number: Int!, $firstLabels: Int, $lastComments: Int, $lastReviews: Int, $firstClosingIssues: Int) {\n repository(owner: $owner, name: $name) {\n pullRequest(number: $number) {\n ...PullRequestDetails\n }\n }\n}\n\nfragment PullRequestDetails on PullRequest {\n __typename\n number\n title\n url\n state\n merged\n isDraft\n isInMergeQueue\n milestone {\n ...MilestoneFields\n }\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n url\n author {\n ...AuthorFields\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n }\n }\n reviews(last: $lastReviews) {\n totalCount\n nodes {\n ...PullRequestReviewFields\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n closingIssuesReferences(first: $firstClosingIssues) {\n nodes {\n number\n }\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}\n\nfragment PullRequestReviewFields on PullRequestReview {\n state\n author {\n login\n }\n}": typeof types.FetchPullRequestByNumberDocument, }; const documents: Documents = { "fragment AuthorFields on Actor {\n login\n htmlUrl: url\n avatarUrl: avatarUrl\n type: __typename\n}\n\nfragment MilestoneFields on Milestone {\n state\n title\n}\n\nfragment ReactionGroupFields on ReactionGroup {\n content\n reactors {\n totalCount\n }\n}": types.AuthorFieldsFragmentDoc, - "query FetchDiscussionByNumber($owner: String!, $name: String!, $number: Int!, $lastThreadedComments: Int, $lastReplies: Int, $firstLabels: Int, $includeIsAnswered: Boolean!) {\n repository(owner: $owner, name: $name) {\n discussion(number: $number) {\n ...DiscussionDetails\n }\n }\n}\n\nfragment DiscussionDetails on Discussion {\n __typename\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastThreadedComments) {\n totalCount\n nodes {\n ...DiscussionCommentFields\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n}\n\nfragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n url\n}\n\nfragment DiscussionCommentFields on DiscussionComment {\n ...CommentFields\n replies(last: $lastReplies) {\n totalCount\n nodes {\n ...CommentFields\n }\n }\n}": types.FetchDiscussionByNumberDocument, + "query FetchDiscussionByNumber($owner: String!, $name: String!, $number: Int!, $lastThreadedComments: Int, $lastReplies: Int, $firstLabels: Int, $includeIsAnswered: Boolean!) {\n repository(owner: $owner, name: $name) {\n discussion(number: $number) {\n ...DiscussionDetails\n }\n }\n}\n\nfragment DiscussionDetails on Discussion {\n __typename\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastThreadedComments) {\n totalCount\n nodes {\n ...DiscussionCommentFields\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}\n\nfragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n url\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}\n\nfragment DiscussionCommentFields on DiscussionComment {\n ...CommentFields\n replies(last: $lastReplies) {\n totalCount\n nodes {\n ...CommentFields\n }\n }\n}": types.FetchDiscussionByNumberDocument, "query FetchIssueByNumber($owner: String!, $name: String!, $number: Int!, $lastComments: Int, $firstLabels: Int) {\n repository(owner: $owner, name: $name) {\n issue(number: $number) {\n ...IssueDetails\n }\n }\n}\n\nfragment IssueDetails on Issue {\n __typename\n number\n title\n url\n state\n stateReason\n milestone {\n ...MilestoneFields\n }\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n url\n author {\n ...AuthorFields\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}": types.FetchIssueByNumberDocument, "query FetchMergedDetailsTemplate($ownerINDEX: String!, $nameINDEX: String!, $numberINDEX: Int!, $isDiscussionNotificationINDEX: Boolean!, $isIssueNotificationINDEX: Boolean!, $isPullRequestNotificationINDEX: Boolean!, $lastComments: Int, $lastThreadedComments: Int, $lastReplies: Int, $lastReviews: Int, $firstLabels: Int, $firstClosingIssues: Int, $includeIsAnswered: Boolean!) {\n ...MergedDetailsQueryTemplate\n}\n\nfragment MergedDetailsQueryTemplate on Query {\n repository(owner: $ownerINDEX, name: $nameINDEX) {\n discussion(number: $numberINDEX) @include(if: $isDiscussionNotificationINDEX) {\n ...DiscussionDetails\n }\n issue(number: $numberINDEX) @include(if: $isIssueNotificationINDEX) {\n ...IssueDetails\n }\n pullRequest(number: $numberINDEX) @include(if: $isPullRequestNotificationINDEX) {\n ...PullRequestDetails\n }\n }\n}": types.FetchMergedDetailsTemplateDocument, "query FetchPullRequestByNumber($owner: String!, $name: String!, $number: Int!, $firstLabels: Int, $lastComments: Int, $lastReviews: Int, $firstClosingIssues: Int) {\n repository(owner: $owner, name: $name) {\n pullRequest(number: $number) {\n ...PullRequestDetails\n }\n }\n}\n\nfragment PullRequestDetails on PullRequest {\n __typename\n number\n title\n url\n state\n merged\n isDraft\n isInMergeQueue\n milestone {\n ...MilestoneFields\n }\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n url\n author {\n ...AuthorFields\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n }\n }\n reviews(last: $lastReviews) {\n totalCount\n nodes {\n ...PullRequestReviewFields\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n closingIssuesReferences(first: $firstClosingIssues) {\n nodes {\n number\n }\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}\n\nfragment PullRequestReviewFields on PullRequestReview {\n state\n author {\n login\n }\n}": types.FetchPullRequestByNumberDocument, @@ -36,7 +36,7 @@ export function graphql(source: "fragment AuthorFields on Actor {\n login\n ht /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "query FetchDiscussionByNumber($owner: String!, $name: String!, $number: Int!, $lastThreadedComments: Int, $lastReplies: Int, $firstLabels: Int, $includeIsAnswered: Boolean!) {\n repository(owner: $owner, name: $name) {\n discussion(number: $number) {\n ...DiscussionDetails\n }\n }\n}\n\nfragment DiscussionDetails on Discussion {\n __typename\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastThreadedComments) {\n totalCount\n nodes {\n ...DiscussionCommentFields\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n}\n\nfragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n url\n}\n\nfragment DiscussionCommentFields on DiscussionComment {\n ...CommentFields\n replies(last: $lastReplies) {\n totalCount\n nodes {\n ...CommentFields\n }\n }\n}"): typeof import('./graphql').FetchDiscussionByNumberDocument; +export function graphql(source: "query FetchDiscussionByNumber($owner: String!, $name: String!, $number: Int!, $lastThreadedComments: Int, $lastReplies: Int, $firstLabels: Int, $includeIsAnswered: Boolean!) {\n repository(owner: $owner, name: $name) {\n discussion(number: $number) {\n ...DiscussionDetails\n }\n }\n}\n\nfragment DiscussionDetails on Discussion {\n __typename\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastThreadedComments) {\n totalCount\n nodes {\n ...DiscussionCommentFields\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}\n\nfragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n url\n reactions {\n totalCount\n }\n reactionGroups {\n ...ReactionGroupFields\n }\n}\n\nfragment DiscussionCommentFields on DiscussionComment {\n ...CommentFields\n replies(last: $lastReplies) {\n totalCount\n nodes {\n ...CommentFields\n }\n }\n}"): typeof import('./graphql').FetchDiscussionByNumberDocument; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/src/renderer/utils/api/graphql/generated/graphql.ts b/src/renderer/utils/api/graphql/generated/graphql.ts index 7ae278df9..e21b6c025 100644 --- a/src/renderer/utils/api/graphql/generated/graphql.ts +++ b/src/renderer/utils/api/graphql/generated/graphql.ts @@ -35631,13 +35631,13 @@ export type FetchDiscussionByNumberQuery = { __typename?: 'Query', repository?: | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, author?: + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } | { __typename?: 'EnterpriseUserAccount', login: string, htmlUrl: any, avatarUrl: any, type: 'EnterpriseUserAccount' } | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, labels?: { __typename?: 'LabelConnection', nodes?: Array<{ __typename?: 'Label', name: string } | null> | null } | null } | null } | null }; + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, labels?: { __typename?: 'LabelConnection', nodes?: Array<{ __typename?: 'Label', name: string } | null> | null } | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null } | null }; export type DiscussionDetailsFragment = { __typename: 'Discussion', number: number, title: string, stateReason?: DiscussionStateReason | null, isAnswered?: boolean | null, url: any, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } @@ -35651,13 +35651,13 @@ export type DiscussionDetailsFragment = { __typename: 'Discussion', number: numb | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, author?: + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } | { __typename?: 'EnterpriseUserAccount', login: string, htmlUrl: any, avatarUrl: any, type: 'EnterpriseUserAccount' } | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, labels?: { __typename?: 'LabelConnection', nodes?: Array<{ __typename?: 'Label', name: string } | null> | null } | null }; + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, labels?: { __typename?: 'LabelConnection', nodes?: Array<{ __typename?: 'Label', name: string } | null> | null } | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null }; export type CommentFieldsFragment = { __typename?: 'DiscussionComment', databaseId?: number | null, createdAt: any, url: any, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } @@ -35665,7 +35665,7 @@ export type CommentFieldsFragment = { __typename?: 'DiscussionComment', database | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null }; + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null }; export type DiscussionCommentFieldsFragment = { __typename?: 'DiscussionComment', databaseId?: number | null, createdAt: any, url: any, replies: { __typename?: 'DiscussionCommentConnection', totalCount: number, nodes?: Array<{ __typename?: 'DiscussionComment', databaseId?: number | null, createdAt: any, url: any, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } @@ -35673,13 +35673,13 @@ export type DiscussionCommentFieldsFragment = { __typename?: 'DiscussionComment' | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, author?: + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } | { __typename?: 'EnterpriseUserAccount', login: string, htmlUrl: any, avatarUrl: any, type: 'EnterpriseUserAccount' } | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null }; + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null }; export type FetchIssueByNumberQueryVariables = Exact<{ owner: Scalars['String']['input']; @@ -35747,13 +35747,13 @@ export type FetchMergedDetailsTemplateQuery = { __typename?: 'Query', repository | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, author?: + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } | { __typename?: 'EnterpriseUserAccount', login: string, htmlUrl: any, avatarUrl: any, type: 'EnterpriseUserAccount' } | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, labels?: { __typename?: 'LabelConnection', nodes?: Array<{ __typename?: 'Label', name: string } | null> | null } | null } | null, issue?: { __typename: 'Issue', number: number, title: string, url: any, state: IssueState, stateReason?: IssueStateReason | null, milestone?: { __typename?: 'Milestone', state: MilestoneState, title: string } | null, author?: + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, labels?: { __typename?: 'LabelConnection', nodes?: Array<{ __typename?: 'Label', name: string } | null> | null } | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null, issue?: { __typename: 'Issue', number: number, title: string, url: any, state: IssueState, stateReason?: IssueStateReason | null, milestone?: { __typename?: 'Milestone', state: MilestoneState, title: string } | null, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } | { __typename?: 'EnterpriseUserAccount', login: string, htmlUrl: any, avatarUrl: any, type: 'EnterpriseUserAccount' } | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } @@ -35797,13 +35797,13 @@ export type MergedDetailsQueryTemplateFragment = { __typename?: 'Query', reposit | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, author?: + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } | { __typename?: 'EnterpriseUserAccount', login: string, htmlUrl: any, avatarUrl: any, type: 'EnterpriseUserAccount' } | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } | { __typename?: 'Organization', login: string, htmlUrl: any, avatarUrl: any, type: 'Organization' } | { __typename?: 'User', login: string, htmlUrl: any, avatarUrl: any, type: 'User' } - | null } | null> | null }, labels?: { __typename?: 'LabelConnection', nodes?: Array<{ __typename?: 'Label', name: string } | null> | null } | null } | null, issue?: { __typename: 'Issue', number: number, title: string, url: any, state: IssueState, stateReason?: IssueStateReason | null, milestone?: { __typename?: 'Milestone', state: MilestoneState, title: string } | null, author?: + | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null> | null }, labels?: { __typename?: 'LabelConnection', nodes?: Array<{ __typename?: 'Label', name: string } | null> | null } | null, reactions: { __typename?: 'ReactionConnection', totalCount: number }, reactionGroups?: Array<{ __typename?: 'ReactionGroup', content: ReactionContent, reactors: { __typename?: 'ReactorConnection', totalCount: number } }> | null } | null, issue?: { __typename: 'Issue', number: number, title: string, url: any, state: IssueState, stateReason?: IssueStateReason | null, milestone?: { __typename?: 'Milestone', state: MilestoneState, title: string } | null, author?: | { __typename?: 'Bot', login: string, htmlUrl: any, avatarUrl: any, type: 'Bot' } | { __typename?: 'EnterpriseUserAccount', login: string, htmlUrl: any, avatarUrl: any, type: 'EnterpriseUserAccount' } | { __typename?: 'Mannequin', login: string, htmlUrl: any, avatarUrl: any, type: 'Mannequin' } @@ -35920,6 +35920,14 @@ export const AuthorFieldsFragmentDoc = new TypedDocumentString(` type: __typename } `, {"fragmentName":"AuthorFields"}) as unknown as TypedDocumentString; +export const ReactionGroupFieldsFragmentDoc = new TypedDocumentString(` + fragment ReactionGroupFields on ReactionGroup { + content + reactors { + totalCount + } +} + `, {"fragmentName":"ReactionGroupFields"}) as unknown as TypedDocumentString; export const CommentFieldsFragmentDoc = new TypedDocumentString(` fragment CommentFields on DiscussionComment { databaseId @@ -35928,12 +35936,24 @@ export const CommentFieldsFragmentDoc = new TypedDocumentString(` ...AuthorFields } url + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment AuthorFields on Actor { login htmlUrl: url avatarUrl: avatarUrl type: __typename +} +fragment ReactionGroupFields on ReactionGroup { + content + reactors { + totalCount + } }`, {"fragmentName":"CommentFields"}) as unknown as TypedDocumentString; export const DiscussionCommentFieldsFragmentDoc = new TypedDocumentString(` fragment DiscussionCommentFields on DiscussionComment { @@ -35951,6 +35971,12 @@ export const DiscussionCommentFieldsFragmentDoc = new TypedDocumentString(` avatarUrl: avatarUrl type: __typename } +fragment ReactionGroupFields on ReactionGroup { + content + reactors { + totalCount + } +} fragment CommentFields on DiscussionComment { databaseId createdAt @@ -35958,6 +35984,12 @@ fragment CommentFields on DiscussionComment { ...AuthorFields } url + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } }`, {"fragmentName":"DiscussionCommentFields"}) as unknown as TypedDocumentString; export const DiscussionDetailsFragmentDoc = new TypedDocumentString(` fragment DiscussionDetails on Discussion { @@ -35981,6 +36013,12 @@ export const DiscussionDetailsFragmentDoc = new TypedDocumentString(` name } } + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment AuthorFields on Actor { login @@ -35988,6 +36026,12 @@ export const DiscussionDetailsFragmentDoc = new TypedDocumentString(` avatarUrl: avatarUrl type: __typename } +fragment ReactionGroupFields on ReactionGroup { + content + reactors { + totalCount + } +} fragment CommentFields on DiscussionComment { databaseId createdAt @@ -35995,6 +36039,12 @@ fragment CommentFields on DiscussionComment { ...AuthorFields } url + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment DiscussionCommentFields on DiscussionComment { ...CommentFields @@ -36011,14 +36061,6 @@ export const MilestoneFieldsFragmentDoc = new TypedDocumentString(` title } `, {"fragmentName":"MilestoneFields"}) as unknown as TypedDocumentString; -export const ReactionGroupFieldsFragmentDoc = new TypedDocumentString(` - fragment ReactionGroupFields on ReactionGroup { - content - reactors { - totalCount - } -} - `, {"fragmentName":"ReactionGroupFields"}) as unknown as TypedDocumentString; export const IssueDetailsFragmentDoc = new TypedDocumentString(` fragment IssueDetails on Issue { __typename @@ -36211,6 +36253,12 @@ fragment DiscussionDetails on Discussion { name } } + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment CommentFields on DiscussionComment { databaseId @@ -36219,6 +36267,12 @@ fragment CommentFields on DiscussionComment { ...AuthorFields } url + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment DiscussionCommentFields on DiscussionComment { ...CommentFields @@ -36342,6 +36396,12 @@ export const FetchDiscussionByNumberDocument = new TypedDocumentString(` avatarUrl: avatarUrl type: __typename } +fragment ReactionGroupFields on ReactionGroup { + content + reactors { + totalCount + } +} fragment DiscussionDetails on Discussion { __typename number @@ -36363,6 +36423,12 @@ fragment DiscussionDetails on Discussion { name } } + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment CommentFields on DiscussionComment { databaseId @@ -36371,6 +36437,12 @@ fragment CommentFields on DiscussionComment { ...AuthorFields } url + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment DiscussionCommentFields on DiscussionComment { ...CommentFields @@ -36486,6 +36558,12 @@ fragment DiscussionDetails on Discussion { name } } + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment CommentFields on DiscussionComment { databaseId @@ -36494,6 +36572,12 @@ fragment CommentFields on DiscussionComment { ...AuthorFields } url + reactions { + totalCount + } + reactionGroups { + ...ReactionGroupFields + } } fragment DiscussionCommentFields on DiscussionComment { ...CommentFields diff --git a/src/renderer/utils/notifications/handlers/discussion.test.ts b/src/renderer/utils/notifications/handlers/discussion.test.ts index afa316327..969f95c5e 100644 --- a/src/renderer/utils/notifications/handlers/discussion.test.ts +++ b/src/renderer/utils/notifications/handlers/discussion.test.ts @@ -5,6 +5,7 @@ import { mockCommenter, mockDiscussionResponseNode, mockReplier, + noReactionGroups, } from '../../api/__mocks__/response-mocks'; import type { GitifyNotification } from '../../../types'; @@ -71,6 +72,8 @@ describe('renderer/utils/notifications/handlers/discussion.ts', () => { labels: [], htmlUrl: 'https://github.com/gitify-app/notifications-test/discussions/123' as Link, + reactionsCount: 0, + reactionGroups: noReactionGroups, } satisfies Partial); }); @@ -101,6 +104,8 @@ describe('renderer/utils/notifications/handlers/discussion.ts', () => { labels: [], htmlUrl: 'https://github.com/gitify-app/notifications-test/discussions/123' as Link, + reactionsCount: 0, + reactionGroups: noReactionGroups, } satisfies Partial); }); @@ -134,6 +139,8 @@ describe('renderer/utils/notifications/handlers/discussion.ts', () => { labels: [], htmlUrl: 'https://github.com/gitify-app/notifications-test/discussions/123' as Link, + reactionsCount: 0, + reactionGroups: noReactionGroups, } satisfies Partial); }); @@ -171,6 +178,8 @@ describe('renderer/utils/notifications/handlers/discussion.ts', () => { labels: ['enhancement'], htmlUrl: 'https://github.com/gitify-app/notifications-test/discussions/123' as Link, + reactionsCount: 0, + reactionGroups: noReactionGroups, } satisfies Partial); }); @@ -187,6 +196,10 @@ describe('renderer/utils/notifications/handlers/discussion.ts', () => { totalCount: 0, nodes: [], }, + reactions: { + totalCount: 0, + }, + reactionGroups: noReactionGroups, }, ], }; @@ -215,6 +228,8 @@ describe('renderer/utils/notifications/handlers/discussion.ts', () => { labels: [], htmlUrl: 'https://github.com/gitify-app/notifications-test/discussions/123#discussioncomment-1234' as Link, + reactionsCount: 0, + reactionGroups: noReactionGroups, } satisfies Partial); }); @@ -234,9 +249,17 @@ describe('renderer/utils/notifications/handlers/discussion.ts', () => { author: mockReplier, createdAt: '2024-01-01T00:00:00Z', url: 'https://github.com/gitify-app/notifications-test/discussions/123#discussioncomment-6789', + reactions: { + totalCount: 0, + }, + reactionGroups: noReactionGroups, }, ], }, + reactions: { + totalCount: 0, + }, + reactionGroups: noReactionGroups, }, ], }; @@ -265,6 +288,8 @@ describe('renderer/utils/notifications/handlers/discussion.ts', () => { labels: [], htmlUrl: 'https://github.com/gitify-app/notifications-test/discussions/123#discussioncomment-6789' as Link, + reactionsCount: 0, + reactionGroups: noReactionGroups, } satisfies Partial); }); }); diff --git a/src/renderer/utils/notifications/handlers/discussion.ts b/src/renderer/utils/notifications/handlers/discussion.ts index 5f8824a47..0c4c2a919 100644 --- a/src/renderer/utils/notifications/handlers/discussion.ts +++ b/src/renderer/utils/notifications/handlers/discussion.ts @@ -57,6 +57,12 @@ class DiscussionHandler extends DefaultHandler { discussion.comments.nodes, ); + const discussionReactionCount = + latestDiscussionComment?.reactions.totalCount ?? + discussion.reactions.totalCount; + const discussionReactionGroup = + latestDiscussionComment?.reactionGroups ?? discussion.reactionGroups; + return { number: discussion.number, state: discussionState, @@ -67,6 +73,8 @@ class DiscussionHandler extends DefaultHandler { commentCount: discussion.comments.totalCount, labels: discussion.labels?.nodes.map((label) => label.name) ?? [], htmlUrl: latestDiscussionComment?.url ?? discussion.url, + reactionsCount: discussionReactionCount, + reactionGroups: discussionReactionGroup, }; } diff --git a/src/renderer/utils/notifications/handlers/issue.test.ts b/src/renderer/utils/notifications/handlers/issue.test.ts index b40c55de7..35c1249ea 100644 --- a/src/renderer/utils/notifications/handlers/issue.test.ts +++ b/src/renderer/utils/notifications/handlers/issue.test.ts @@ -124,6 +124,7 @@ describe('renderer/utils/notifications/handlers/issue.ts', () => { issue: mockIssue, }, } satisfies FetchIssueByNumberQuery); + const result = await issueHandler.enrich(mockNotification, mockSettings); expect(result).toEqual({