Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5d767f3
refactor(api): use graphql api for issue and pull request enrichment
setchy Dec 20, 2025
6932eca
refactor(api): use graphql api for issue and pull request enrichment
setchy Dec 21, 2025
356b06c
refactor(api): use graphql api for issue and pull request enrichment
setchy Dec 21, 2025
cb2b01b
refactor(api): use graphql api for issue and pull request enrichment
setchy Dec 21, 2025
fc37b54
refactor(api): use graphql api for issue and pull request enrichment
setchy Dec 21, 2025
5a198b7
refactor(api): use graphql api for issue and pull request enrichment
setchy Dec 21, 2025
8f3099d
refactor(api): use graphql api for issue and pull request enrichment
setchy Dec 21, 2025
f2d6198
refactor(api): update types
setchy Dec 22, 2025
5f42503
refactor(api): update types
setchy Dec 22, 2025
df570ea
refactor: tests
setchy Dec 22, 2025
7f17bb0
refactor: tests
setchy Dec 22, 2025
6edeb5c
refactor: tests
setchy Dec 22, 2025
a9a11d2
Update issue.test.ts
setchy Dec 22, 2025
ddc2de5
Merge branch 'refactor/fetch-issue-graphql' of https://github.com/git…
setchy Dec 22, 2025
021c22c
refactor: tests
setchy Dec 22, 2025
c4da59a
Merge branch 'main' into refactor/fetch-issue-graphql
setchy Dec 22, 2025
b0ff09b
Merge branch 'main' into refactor/fetch-issue-graphql
setchy Dec 22, 2025
6b35fc2
Merge branch 'main' into refactor/fetch-issue-graphql
setchy Dec 22, 2025
32eb1e0
Merge branch 'main' into refactor/fetch-issue-graphql
setchy Dec 22, 2025
f60b3a6
Merge branch 'main' into refactor/fetch-issue-graphql
setchy Dec 22, 2025
361cdeb
Merge branch 'main' into refactor/fetch-issue-graphql
setchy Dec 22, 2025
4c47945
Merge branch 'main' into refactor/fetch-issue-graphql
setchy Dec 22, 2025
fe5ee69
Merge branch 'main' into refactor/fetch-issue-graphql
setchy Dec 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const config: CodegenConfig = {
},
config: {
documentMode: 'string',
enumsAsTypes: true,
useTypeImports: true,
},
},
Expand Down
21 changes: 16 additions & 5 deletions src/renderer/__mocks__/notifications-mocks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Constants } from '../constants';
import type { AccountNotifications, Hostname } from '../types';
import type {
AccountNotifications,
GitifyNotificationState,
Hostname,
} from '../types';
import type {
Notification,
Repository,
StateType,
Subject,
SubjectType,
} from '../typesGitHub';
Expand Down Expand Up @@ -43,12 +46,12 @@ export const mockSingleAccountNotifications: AccountNotifications[] = [
export function createMockSubject(mocks: {
title?: string;
type?: SubjectType;
state?: StateType;
state?: GitifyNotificationState;
}): Subject {
return {
title: mocks.title ?? 'Mock Subject',
type: mocks.type ?? ('Unknown' as SubjectType),
state: mocks.state ?? ('Unknown' as StateType),
state: mocks.state ?? ('Unknown' as GitifyNotificationState),
url: null,
latest_comment_url: null,
};
Expand All @@ -68,7 +71,15 @@ export function createPartialMockNotification(
hasRequiredScopes: true,
},
subject: subject as Subject,
repository: repository as Repository,
repository: {
name: 'notifications-test',
full_name: 'gitify-app/notifications-test',
html_url: 'https://github.com/gitify-app/notifications-test',
owner: {
login: 'gitify-app',
},
...repository,
} as Repository,
};

return mockNotification as Notification;
Expand Down
10 changes: 5 additions & 5 deletions src/renderer/components/metrics/MetricGroup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { renderWithAppContext } from '../../__helpers__/test-utils';
import { mockSettings } from '../../__mocks__/state-mocks';
import type { Milestone } from '../../typesGitHub';
import { mockSingleNotification } from '../../utils/api/__mocks__/response-mocks';
import type { MilestoneFieldsFragment } from '../../utils/api/graphql/generated/graphql';
import { MetricGroup } from './MetricGroup';

describe('renderer/components/metrics/MetricGroup.tsx', () => {
Expand Down Expand Up @@ -103,8 +103,8 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
const mockNotification = mockSingleNotification;
mockNotification.subject.milestone = {
title: 'Milestone 1',
state: 'open',
} as Milestone;
state: 'OPEN',
} as MilestoneFieldsFragment;

const props = {
notification: mockNotification,
Expand All @@ -118,8 +118,8 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
const mockNotification = mockSingleNotification;
mockNotification.subject.milestone = {
title: 'Milestone 1',
state: 'closed',
} as Milestone;
state: 'CLOSED',
} as MilestoneFieldsFragment;

const props = {
notification: mockNotification,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/metrics/MetricGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const MetricGroup: FC<MetricGroupProps> = ({
{notification.subject.milestone && (
<MetricPill
color={
notification.subject.milestone.state === 'open'
notification.subject.milestone.state === 'OPEN'
? IconColor.GREEN
: IconColor.RED
}
Expand Down
66 changes: 66 additions & 0 deletions src/renderer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import type {
SubjectType,
UserType,
} from './typesGitHub';
import type {
AuthorFieldsFragment,
DiscussionStateReason,
IssueState,
IssueStateReason,
MilestoneFieldsFragment,
PullRequestReviewState,
PullRequestState,
} from './utils/api/graphql/generated/graphql';
import type { AuthMethod, PlatformType } from './utils/auth/types';

declare const __brand: unique symbol;
Expand Down Expand Up @@ -251,3 +260,60 @@ export interface Chevron {
}

export type FilterStateType = 'open' | 'closed' | 'merged' | 'draft' | 'other';

/**
*
* Gitify Notification Types
*
**/

export interface GitifyNotification {
account: Account;
order: number;
}

export interface GitifySubject {
number?: number;
state?: GitifyNotificationState;
user?: GitifyNotificationUser;
reviews?: GitifyPullRequestReview[];
linkedIssues?: string[];
comments?: number;
labels?: string[];
milestone?: MilestoneFieldsFragment;
htmlUrl?: Link;
}

export type GitifyNotificationUser = AuthorFieldsFragment;

export interface GitifyPullRequestReview {
state: PullRequestReviewState;
users: string[];
}

export type GitifyDiscussionState = DiscussionStateReason | 'OPEN' | 'ANSWERED';

export type GitifyPullRequestState = PullRequestState | 'DRAFT';

export type GitifyIssueState = IssueState | IssueStateReason;

export type GitifyNotificationState =
| GitifyCheckSuiteStatus
| GitifyDiscussionState
| GitifyIssueState
| GitifyPullRequestState;

export type GitifyCheckSuiteStatus =
| 'ACTION_REQUIRED'
| 'CANCELLED'
| 'COMPLETED'
| 'FAILURE'
| 'IN_PROGRESS'
| 'PENDING'
| 'QUEUED'
| 'REQUESTED'
| 'SKIPPED'
| 'STALE'
| 'SUCCESS'
| 'TIMED_OUT'
| 'WAITING';
Loading