File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
src/renderer/utils/notifications Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,22 @@ export function formatNotificationType(
4949 ] ) ;
5050}
5151
52+ /**
53+ * Return the formatted (issue, pull request, discussion) number for this notification.
54+ */
55+ export function formatGitHubNumber ( num : number ) : string {
56+ return `#${ num } ` ;
57+ }
58+
5259/**
5360 * Return the formatted notification number for this notification.
5461 */
5562export function formatNotificationNumber (
5663 notification : GitifyNotification ,
5764) : string {
58- return notification . subject ?. number ? `#${ notification . subject . number } ` : '' ;
65+ return notification . subject ?. number
66+ ? formatGitHubNumber ( notification . subject . number )
67+ : '' ;
5968}
6069
6170/**
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import type {
2323 PullRequestDetailsFragment ,
2424 PullRequestReviewFieldsFragment ,
2525} from '../../api/graphql/generated/graphql' ;
26+ import { formatGitHubNumber } from '../formatters' ;
2627import { DefaultHandler , defaultHandler } from './default' ;
2728import { getNotificationAuthor } from './utils' ;
2829
@@ -60,8 +61,8 @@ class PullRequestHandler extends DefaultHandler {
6061 reviews : reviews ,
6162 commentCount : pr . comments . totalCount ,
6263 labels : pr . labels ?. nodes . map ( ( label ) => label . name ) ?? [ ] ,
63- linkedIssues : pr . closingIssuesReferences ?. nodes . map (
64- ( issue ) => `# ${ issue . number } ` ,
64+ linkedIssues : pr . closingIssuesReferences ?. nodes . map ( ( issue ) =>
65+ formatGitHubNumber ( issue . number ) ,
6566 ) ,
6667 milestone : pr . milestone ,
6768 htmlUrl : prComment ?. url ?? pr . url ,
Original file line number Diff line number Diff line change @@ -67,6 +67,15 @@ function getNotifications(state: GitifyState) {
6767/**
6868 * Get all notifications for all accounts.
6969 *
70+ * Notifications follow these stages:
71+ * - Fetch / retrieval
72+ * - Transform
73+ * - Base filtering
74+ * - Enrichment
75+ * - Detailed filtering
76+ * - Formatting
77+ * - Ordering
78+ *
7079 * @param state - The Gitify state.
7180 * @returns A promise that resolves to an array of account notifications.
7281 */
You can’t perform that action at this time.
0 commit comments