π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(photos):show-subscription-error-when-sending-links
Aswin Asok776284417cbd
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 61ecf20760..bf6a3baa45 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -81,6 +81,7 @@ import { useModalVisibility } from "ente-base/components/utils/modal";import { useBaseContext } from "ente-base/context";import { subscribeMainWindowFocus } from "ente-base/electron";import { isNamedError } from "ente-base/error";+import { isHTTPErrorWithStatus } from "ente-base/http";import { hasPendingAlbumToJoin } from "ente-base/join-album";import log from "ente-base/log";import {@@ -1143,6 +1144,22 @@ const Page: React.FC = () => {}};+ const onSendLinkError = useCallback(+ (e: unknown) => {+ if (isHTTPErrorWithStatus(e, 402)) {+ log.error("Could not create share link", e);+ showMiniDialog(+ errorDialogAttributes(+ t("share_link_subscription_required"),+ ),+ );+ } else {+ onGenericError(e);+ }+ },+ [showMiniDialog, onGenericError],+ );+const createFileOpHandler =(op: FileOp, options?: { suppressSelectionBar?: boolean }) => () => {void (async () => {@@ -1250,7 +1267,11 @@ const Page: React.FC = () => {clearSelection();await remotePull({ silent: true, source: `file-op:${op}` });} catch (e) {- onGenericError(e);+ if (op == "sendLink") {+ onSendLinkError(e);+ } else {+ onGenericError(e);+ }} finally {if (options?.suppressSelectionBar) {setSuppressContextSelectionBar(false);@@ -1494,7 +1515,7 @@ const Page: React.FC = () => {setPublicLinkToast({ open: true, url: resolvedURL });await remotePull({ silent: true, source: "viewer-send-link" });} catch (e) {- onGenericError(e);+ onSendLinkError(e);} finally {hideLoadingBar();}@@ -1506,7 +1527,7 @@ const Page: React.FC = () => {customDomain,quickLinkVisibility,remotePull,- onGenericError,+ onSendLinkError,],);diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.jsonindex 0aa8030e09..596ef01b3c 100644--- a/web/packages/base/locales/en-US/translation.json+++ b/web/packages/base/locales/en-US/translation.json@@ -467,6 +467,7 @@"sharing_already_shared": "You're already sharing this with {{email}}","sharing_album_not_allowed": "Sharing album not allowed","sharing_disabled_for_free_accounts": "Sharing is disabled for free accounts",+ "share_link_subscription_required": "An active subscription is required to create this link. Please check your subscription status.","link_edit_disabled_for_free_accounts": "You need a paid subscription to change this link setting","sharing_user_does_not_exist": "Could not find a user with that email","search": "Search",