Skip to content

Commit 996bc3e

Browse files
committed
feat(api): merge query
Signed-off-by: Adam Setch <[email protected]>
1 parent 5bd4cd8 commit 996bc3e

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

src/renderer/utils/notifications/handlers/default.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ export class DefaultHandler implements NotificationTypeHandler {
1616
return null;
1717
}
1818

19-
async enrich(_fetchedData?: unknown): Promise<GitifySubject> {
19+
async fetchAndEnrich(
20+
_notification: Notification,
21+
_settings: SettingsState,
22+
): Promise<GitifySubject> {
2023
return null;
2124
}
2225

23-
async fetchAndEnrich(
24-
notification: Notification,
25-
settings: SettingsState,
26+
async enrich(
27+
_notification: Notification,
28+
_settings: SettingsState,
29+
_fetchedData?: unknown,
2630
): Promise<GitifySubject> {
27-
return this.enrich(notification, settings, undefined);
31+
return null;
2832
}
2933

3034
iconType(_subject: Subject): FC<OcticonProps> | null {

src/renderer/utils/notifications/handlers/issue.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import type {
1616
} from '../../../types';
1717
import { IconColor } from '../../../types';
1818
import type { Notification, Subject } from '../../../typesGitHub';
19-
import { fetchIssueByNumber } from '../../api/client';
2019
import type { IssueDetailsFragment } from '../../api/graphql/generated/graphql';
2120
import { DefaultHandler, defaultHandler } from './default';
2221
import { getNotificationAuthor } from './utils';
@@ -25,7 +24,7 @@ class IssueHandler extends DefaultHandler {
2524
readonly type = 'Issue';
2625

2726
async enrich(
28-
notification: Notification,
27+
_notification: Notification,
2928
_settings: SettingsState,
3029
fetchedData?: IssueDetailsFragment,
3130
): Promise<GitifySubject> {

src/renderer/utils/notifications/handlers/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ export interface NotificationTypeHandler<TFragment = unknown> {
1111
query(notification: Notification): { query; variables } | null;
1212

1313
/**
14-
* Enrich a notification. Settings may be unused for some handlers.
14+
* Fetch remote data (if needed) and enrich a notification.
1515
*/
16-
enrich(
16+
fetchAndEnrich(
1717
notification: Notification,
1818
settings: SettingsState,
19-
fetchedData?: TFragment,
2019
): Promise<GitifySubject>;
2120

2221
/**
23-
* Fetch remote data (if needed) and enrich a notification.
22+
* Enrich a notification. Settings may be unused for some handlers.
2423
*/
25-
fetchAndEnrich(
24+
enrich(
2625
notification: Notification,
27-
settings: SettingsState,
26+
settings?: SettingsState,
27+
fetchedData?: TFragment,
2828
): Promise<GitifySubject>;
2929

3030
/**

0 commit comments

Comments
 (0)