Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Ensure confirmation is visible

Manav Rathi33ec855b4050
diff --git a/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx b/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
index 329499f49c..234a02cd4b 100644
--- a/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
+++ b/web/apps/photos/src/components/pages/gallery/PlanSelector.tsx
@@ -746,20 +746,26 @@ const StripeSubscriptionOptions: React.FC<StripeSubscriptionOptionsProps> = ({
}),
continue: {
text: t("REACTIVATE_SUBSCRIPTION"),
- action: reactivate,
+ action: async () => {
+ await activateStripeSubscription();
+ onClose();
+ // [Note: Chained MiniDialogs]
+ //
+ // The MiniDialog will automatically close when we the
+ // action promise resolves, so if we want to show another
+ // dialog, schedule it on the next run loop.
+ setTimeout(() => {
+ showMiniDialog({
+ title: t("success"),
+ message: t("SUBSCRIPTION_ACTIVATE_SUCCESS"),
+ continue: { action: onClose },
+ cancel: false,
+ });
+ }, 0);
+ },
},
});
- const reactivate = async () => {
- await activateStripeSubscription();
- showMiniDialog({
- title: t("success"),
- message: t("SUBSCRIPTION_ACTIVATE_SUCCESS"),
- continue: { action: onClose },
- cancel: false,
- });
- };
-
const confirmCancel = () =>
showMiniDialog({
title: t("CANCEL_SUBSCRIPTION"),
@@ -771,24 +777,21 @@ const StripeSubscriptionOptions: React.FC<StripeSubscriptionOptionsProps> = ({
continue: {
text: t("CANCEL_SUBSCRIPTION"),
color: "critical",
- action: cancel,
+ action: async () => {
+ await cancelStripeSubscription();
+ onClose();
+ // See: [Note: Chained MiniDialogs]
+ setTimeout(() => {
+ showMiniDialog({
+ message: t("SUBSCRIPTION_CANCEL_SUCCESS"),
+ cancel: t("ok"),
+ });
+ }, 0);
+ },
},
cancel: t("NEVERMIND"),
});
- const cancel = async () => {
- await cancelStripeSubscription();
- showMiniDialog({
- title: t("success"),
- message: t("SUBSCRIPTION_CANCEL_SUCCESS"),
- continue: {
- color: "secondary",
- action: onClose,
- },
- cancel: false,
- });
- };
-
const handleManageClick = useWrapAsyncOperation(redirectToCustomerPortal);
return (