Skip to content

Commit

Permalink
update @ProtonMail web clients
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimiry committed Jun 10, 2023
1 parent fc11089 commit 33b555d
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 540 deletions.
127 changes: 0 additions & 127 deletions patches/protonmail/common-3.patch

This file was deleted.

24 changes: 0 additions & 24 deletions patches/protonmail/constants-8.patch

This file was deleted.

44 changes: 44 additions & 0 deletions patches/protonmail/drop-circular-dependency-2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/packages/components/hooks/usePendingUserInvitations.ts b/packages/components/hooks/usePendingUserInvitations.ts
index d61e10f07..6cc0d2097 100644
--- a/packages/components/hooks/usePendingUserInvitations.ts
+++ b/packages/components/hooks/usePendingUserInvitations.ts
@@ -1,7 +1,7 @@
import { useCallback } from 'react';

import { PendingInvitation as PendingUserInvitation } from '@proton/shared/lib/interfaces';
-import { UserInvitationModel } from '@proton/shared/lib/models';
+import { UserInvitationModelKey } from '@proton/shared/lib/models/userInvitationModel.key';
import { fetchPendingUserInvitations } from '@proton/shared/lib/models/userInvitationModelApi';

import useApi from './useApi';
@@ -13,7 +13,7 @@ const usePendingUserInvitations = (): [PendingUserInvitation[] | undefined, bool
const cache = useCache();

const miss = useCallback(() => fetchPendingUserInvitations(api), [api]);
- return useCachedModelResult(cache, UserInvitationModel.key, miss);
+ return useCachedModelResult(cache, UserInvitationModelKey, miss);
};

export default usePendingUserInvitations;
diff --git a/packages/shared/lib/models/userInvitationModel.js b/packages/shared/lib/models/userInvitationModel.js
index ec3e45c0e..c8b5672ed 100644
--- a/packages/shared/lib/models/userInvitationModel.js
+++ b/packages/shared/lib/models/userInvitationModel.js
@@ -1,8 +1,9 @@
import updateCollection from '../helpers/updateCollection';
import { fetchPendingUserInvitations } from './userInvitationModelApi';
+import { UserInvitationModelKey as key } from './userInvitationModel.key';

export const UserInvitationModel = {
- key: 'UserInvitations',
+ key,
get: fetchPendingUserInvitations,
update: (model, events) => updateCollection({ model, events, itemKey: 'UserInvitation' }),
};
diff --git a/packages/shared/lib/models/userInvitationModel.key.js b/packages/shared/lib/models/userInvitationModel.key.js
new file mode 100644
index 000000000..c07ff03fa
--- /dev/null
+++ b/packages/shared/lib/models/userInvitationModel.key.js
@@ -0,0 +1 @@
+export const UserInvitationModelKey = 'UserInvitations';
49 changes: 49 additions & 0 deletions patches/protonmail/drop-circular-dependency.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/packages/components/hooks/usePendingUserInvitations.ts b/packages/components/hooks/usePendingUserInvitations.ts
index 6044196e1..b35ae94f5 100644
--- a/packages/components/hooks/usePendingUserInvitations.ts
+++ b/packages/components/hooks/usePendingUserInvitations.ts
@@ -2,11 +2,11 @@ import { useCallback } from 'react';

import { getInvitations } from '@proton/shared/lib/api/user';
import { Api, PendingInvitation as PendingUserInvitation } from '@proton/shared/lib/interfaces';
-import { UserInvitationModel } from '@proton/shared/lib/models';

import useApi from './useApi';
import useCache from './useCache';
import useCachedModelResult from './useCachedModelResult';
+import { UserInvitationModelKey } from '@proton/shared/lib/models/userInvitationModel.key';

export const fetchPendingUserInvitations = (api: Api) =>
api<{ UserInvitations: PendingUserInvitation[] }>(getInvitations()).then(({ UserInvitations }) => {
@@ -18,7 +18,7 @@ const usePendingUserInvitations = (): [PendingUserInvitation[] | undefined, bool
const cache = useCache();

const miss = useCallback(() => fetchPendingUserInvitations(api), [api]);
- return useCachedModelResult(cache, UserInvitationModel.key, miss);
+ return useCachedModelResult(cache, UserInvitationModelKey, miss);
};

export default usePendingUserInvitations;
diff --git a/packages/shared/lib/models/userInvitationModel.js b/packages/shared/lib/models/userInvitationModel.js
index 1fa9690b7..a9035e06d 100644
--- a/packages/shared/lib/models/userInvitationModel.js
+++ b/packages/shared/lib/models/userInvitationModel.js
@@ -1,9 +1,10 @@
import { fetchPendingUserInvitations } from '@proton/components/hooks/usePendingUserInvitations';

import updateCollection from '../helpers/updateCollection';
+import { UserInvitationModelKey as key } from './userInvitationModel.key';

export const UserInvitationModel = {
- key: 'UserInvitations',
+ key,
get: fetchPendingUserInvitations,
update: (model, events) => updateCollection({ model, events, itemKey: 'UserInvitation' }),
};
diff --git a/packages/shared/lib/models/userInvitationModel.key.js b/packages/shared/lib/models/userInvitationModel.key.js
new file mode 100644
index 000000000..c07ff03fa
--- /dev/null
+++ b/packages/shared/lib/models/userInvitationModel.key.js
@@ -0,0 +1 @@
+export const UserInvitationModelKey = 'UserInvitations';
25 changes: 15 additions & 10 deletions patches/protonmail/meta.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"proton-mail": [
"common-3.patch",
"url-3.patch",
"constants-8.patch",
"sentry-11.patch",
"common-4.patch",
"drop-circular-dependency.patch",
"url-4.patch",
"constants-10.patch",
"sentry-12.patch",
"pack-api-arg-4.patch",
"pack-webpack-6.patch",
"session-storage-5.patch",
Expand All @@ -12,9 +13,10 @@
"proton-mail.patch"
],
"proton-account": [
"common-3.patch",
"common-4.patch",
"drop-circular-dependency-2.patch",
"url-4.patch",
"constants-8.patch",
"constants-10.patch",
"sentry-12.patch",
"pack-api-arg-4.patch",
"pack-webpack-6.patch",
Expand All @@ -24,18 +26,20 @@
"proton-account.patch"
],
"proton-calendar": [
"common-3.patch",
"url-3.patch",
"common-4.patch",
"drop-circular-dependency.patch",
"url-4.patch",
"constants-10.patch",
"sentry-11.patch",
"sentry-12.patch",
"pack-api-arg-4.patch",
"pack-webpack-6.patch",
"session-storage-5.patch",
"link-handler-7.patch",
"embedded-verification-3.patch"
],
"proton-drive": [
"common-3.patch",
"common-4.patch",
"drop-circular-dependency.patch",
"url-4.patch",
"constants-10.patch",
"sentry-12.patch",
Expand All @@ -48,6 +52,7 @@
],
"proton-vpn-settings": [
"common-4.patch",
"drop-circular-dependency-2.patch",
"url-4.patch",
"constants-10.patch",
"sentry-12.patch",
Expand Down
Loading

0 comments on commit 33b555d

Please sign in to comment.