Skip to content

Commit abbb4e6

Browse files
authored
refactor: remove legacy account model and migration util (#1787)
Signed-off-by: Adam Setch <[email protected]>
1 parent 57c5d07 commit abbb4e6

File tree

8 files changed

+2
-313
lines changed

8 files changed

+2
-313
lines changed

src/renderer/__mocks__/state-mocks.ts

-8
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,8 @@ import {
1515
Theme,
1616
type Token,
1717
} from '../types';
18-
import type { EnterpriseAccount } from '../utils/auth/types';
1918
import { Constants } from '../utils/constants';
2019

21-
export const mockEnterpriseAccounts: EnterpriseAccount[] = [
22-
{
23-
hostname: 'github.gitify.io' as Hostname,
24-
token: '1234568790' as Token,
25-
},
26-
];
27-
2820
export const mockGitifyUser: GitifyUser = {
2921
login: 'octocat',
3022
name: 'Mona Lisa Octocat',

src/renderer/context/App.test.tsx

+1-13
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('renderer/context/App.tsx', () => {
4848
const unsubscribeNotificationMock = jest.fn();
4949

5050
const mockDefaultState = {
51-
auth: { accounts: [], enterpriseAccounts: [], token: null, user: null },
51+
auth: { accounts: [] },
5252
settings: mockSettings,
5353
};
5454

@@ -278,9 +278,6 @@ describe('renderer/context/App.tsx', () => {
278278
expect(saveStateMock).toHaveBeenCalledWith({
279279
auth: {
280280
accounts: [],
281-
enterpriseAccounts: [],
282-
token: null,
283-
user: null,
284281
} as AuthState,
285282
settings: {
286283
...defaultSettings,
@@ -319,9 +316,6 @@ describe('renderer/context/App.tsx', () => {
319316
expect(saveStateMock).toHaveBeenCalledWith({
320317
auth: {
321318
accounts: [],
322-
enterpriseAccounts: [],
323-
token: null,
324-
user: null,
325319
} as AuthState,
326320
settings: {
327321
...defaultSettings,
@@ -354,9 +348,6 @@ describe('renderer/context/App.tsx', () => {
354348
expect(saveStateMock).toHaveBeenCalledWith({
355349
auth: {
356350
accounts: [],
357-
enterpriseAccounts: [],
358-
token: null,
359-
user: null,
360351
} as AuthState,
361352
settings: {
362353
...mockSettings,
@@ -390,9 +381,6 @@ describe('renderer/context/App.tsx', () => {
390381
expect(saveStateMock).toHaveBeenCalledWith({
391382
auth: {
392383
accounts: [],
393-
enterpriseAccounts: [],
394-
token: null,
395-
user: null,
396384
} as AuthState,
397385
settings: defaultSettings,
398386
});

src/renderer/context/App.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
} from '../types';
3232
import type { Notification } from '../typesGitHub';
3333
import { headNotifications } from '../utils/api/client';
34-
import { migrateAuthenticatedAccounts } from '../utils/auth/migration';
3534
import type {
3635
LoginOAuthAppOptions,
3736
LoginPersonalAccessTokenOptions,
@@ -63,9 +62,6 @@ import { zoomPercentageToLevel } from '../utils/zoom';
6362

6463
export const defaultAuth: AuthState = {
6564
accounts: [],
66-
token: null,
67-
enterpriseAccounts: [],
68-
user: null,
6965
};
7066

7167
const defaultAppearanceSettings: AppearanceSettingsState = {
@@ -279,7 +275,6 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
279275
);
280276

281277
const restoreSettings = useCallback(async () => {
282-
await migrateAuthenticatedAccounts();
283278
const existing = loadState();
284279

285280
// Restore settings before accounts to ensure filters are available before fetching notifications

src/renderer/types.ts

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
11
import type { OcticonProps } from '@primer/octicons-react';
22
import type { FC } from 'react';
33
import type { Notification, Reason } from './typesGitHub';
4-
import type {
5-
AuthMethod,
6-
EnterpriseAccount,
7-
PlatformType,
8-
} from './utils/auth/types';
4+
import type { AuthMethod, PlatformType } from './utils/auth/types';
95

106
declare const __brand: unique symbol;
117

128
type Brand<B> = { [__brand]: B };
139

1410
export interface AuthState {
1511
accounts: Account[];
16-
/**
17-
* @deprecated This attribute is deprecated and will be removed in a future release.
18-
*/
19-
token?: Token;
20-
/**
21-
* @deprecated This attribute is deprecated and will be removed in a future release.
22-
*/
23-
enterpriseAccounts?: EnterpriseAccount[];
24-
/**
25-
* @deprecated This attribute is deprecated and will be removed in a future release.
26-
*/
27-
user?: GitifyUser | null;
2812
}
2913

3014
export type Branded<T, B> = T & Brand<B>;

src/renderer/utils/auth/migration.test.ts

-164
This file was deleted.

src/renderer/utils/auth/migration.ts

-95
This file was deleted.

src/renderer/utils/auth/types.ts

-8
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,3 @@ export interface AuthTokenResponse {
3131
hostname: Hostname;
3232
token: Token;
3333
}
34-
35-
/**
36-
* @deprecated This type is deprecated and will be removed in a future release.
37-
*/
38-
export interface EnterpriseAccount {
39-
hostname: Hostname;
40-
token: Token;
41-
}

0 commit comments

Comments
 (0)