From 49849c38f20d9e8519e99ef253302b22305a99d1 Mon Sep 17 00:00:00 2001 From: dev-737 <73829355+dev-737@users.noreply.github.com> Date: Fri, 24 May 2024 22:31:27 +0530 Subject: [PATCH] fix: update onboarding in progress translation message --- src/commands/slash/Main/hub/browse.ts | 2 +- src/commands/slash/Main/hub/join.ts | 2 +- src/scripts/network/onboarding.ts | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/commands/slash/Main/hub/browse.ts b/src/commands/slash/Main/hub/browse.ts index a63d62fa..c0e3b2aa 100644 --- a/src/commands/slash/Main/hub/browse.ts +++ b/src/commands/slash/Main/hub/browse.ts @@ -363,7 +363,7 @@ export default class Browse extends Hub { } else if (onboardingCompleted === 'in-progress') { await interaction.update({ - content: t({ phrase: 'hub.onboarding.inProgress', locale }, { channel: `${channel}` }), + content: t({ phrase: 'network.onboarding.inProgress', locale }, { channel: `${channel}`, emoji: emojis.dnd_anim }), embeds: [], components: [], }); diff --git a/src/commands/slash/Main/hub/join.ts b/src/commands/slash/Main/hub/join.ts index 80bc1d89..c3154e6f 100644 --- a/src/commands/slash/Main/hub/join.ts +++ b/src/commands/slash/Main/hub/join.ts @@ -141,7 +141,7 @@ export default class JoinSubCommand extends Hub { await interaction.reply({ embeds: [ simpleEmbed( - t({ phrase: 'hub.onboarding.inProgress', locale }, { channel: `${channel}` }), + t({ phrase: 'network.onboarding.inProgress', locale }, { channel: `${channel}`, emoji: emojis.dnd_anim }), ), ], ephemeral: true, diff --git a/src/scripts/network/onboarding.ts b/src/scripts/network/onboarding.ts index a28f20ba..4ff1f8aa 100644 --- a/src/scripts/network/onboarding.ts +++ b/src/scripts/network/onboarding.ts @@ -19,7 +19,7 @@ const processAcceptButton = async ( ) => { await interaction?.deferUpdate(); onboardingInProgress.delete(channelId); // remove in-progress marker as onboarding has either been cancelled or completed - return interaction?.customId === 'onboarding_:accept' ? true : false; + return interaction?.customId === 'onboarding_:accept'; }; const processNextButton = async ( @@ -27,10 +27,7 @@ const processNextButton = async ( channelId: string, locale: supportedLocaleCodes = 'en', ) => { - if (interaction?.customId !== 'onboarding_:next') { - onboardingInProgress.delete(channelId); - return false; - } + if (interaction?.customId !== 'onboarding_:next') return false; const acceptButton = new ActionRowBuilder().addComponents( new ButtonBuilder() @@ -127,5 +124,10 @@ export const showOnboarding = async ( }) .catch(() => null); - return response ? await processNextButton(response, channelId, locale) : false; + const finalResult = response ? await processNextButton(response, channelId, locale) : false; + + // in case user cancels onboarding, remove in-progress marker + if (finalResult === false) onboardingInProgress.delete(channelId); + + return finalResult; };