From bd2777ace315308a4813a3e58982bc2c27f90d3f Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Fri, 7 May 2021 14:54:34 +1000 Subject: [PATCH] ask confirmation before joining opengroup invitation --- _locales/en/messages.json | 3 +++ ts/interactions/message.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 02ffdaa57..833526459 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -292,6 +292,9 @@ "openGroupInvitation": { "message": "Open group invitation" }, + "joinOpenGroupAfterInvitationConfirmation": { + "message": "Do you want to join this open group?" + }, "media": { "message": "Media", "description": "Header of the default pane in the media gallery, showing images and videos", diff --git a/ts/interactions/message.ts b/ts/interactions/message.ts index f3bc37476..105c60d40 100644 --- a/ts/interactions/message.ts +++ b/ts/interactions/message.ts @@ -241,9 +241,12 @@ async function acceptOpenGroupInvitationV1(serverAddress: string) { } } -const acceptOpenGroupInvitationV2 = async (completeUrl: string) => { +const acceptOpenGroupInvitationV2 = (completeUrl: string) => { + window.confirmationDialog({ + message: window.i18n('joinOpenGroupAfterInvitationConfirmation'), + resolve: () => joinOpenGroupV2WithUIEvents(completeUrl, true), + }); // this function does not throw, and will showToasts if anything happens - await joinOpenGroupV2WithUIEvents(completeUrl, true); }; /** @@ -251,7 +254,7 @@ const acceptOpenGroupInvitationV2 = async (completeUrl: string) => { */ export const acceptOpenGroupInvitation = async (completeUrl: string) => { if (completeUrl.match(openGroupV2CompleteURLRegex)) { - await acceptOpenGroupInvitationV2(completeUrl); + acceptOpenGroupInvitationV2(completeUrl); } else { await acceptOpenGroupInvitationV1(completeUrl); }