From 16520f1a98b07c1a6f130db94e3515fd75344187 Mon Sep 17 00:00:00 2001 From: gabriellsh <40830821+gabriellsh@users.noreply.github.com> Date: Sun, 20 Jun 2021 23:44:56 -0300 Subject: [PATCH] [FIX] Cancel button and success toast at Leave Team modal (#22373) Co-authored-by: Tasso Evangelista --- client/views/teams/contextualBar/info/Leave/StepTwo.js | 4 ++-- client/views/teams/contextualBar/info/TeamsInfoWithLogic.js | 1 + packages/rocketchat-i18n/i18n/en.i18n.json | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/views/teams/contextualBar/info/Leave/StepTwo.js b/client/views/teams/contextualBar/info/Leave/StepTwo.js index fe556b5268a..9f1bedf1f1e 100644 --- a/client/views/teams/contextualBar/info/Leave/StepTwo.js +++ b/client/views/teams/contextualBar/info/Leave/StepTwo.js @@ -13,10 +13,10 @@ export const StepTwo = ({ onConfirm, onCancel, onClose }) => { variant='danger' title={t('Confirmation')} onConfirm={onConfirm} - onCancel={onCancel} + onCancel={onCancel || onClose} onClose={onClose} confirmText={t('Leave')} - cancelText={t('Back')} + cancelText={onCancel ? t('Back') : t('Cancel')} > {t('Teams_leaving_team')} diff --git a/client/views/teams/contextualBar/info/TeamsInfoWithLogic.js b/client/views/teams/contextualBar/info/TeamsInfoWithLogic.js index 7b80e34a820..312c680193d 100644 --- a/client/views/teams/contextualBar/info/TeamsInfoWithLogic.js +++ b/client/views/teams/contextualBar/info/TeamsInfoWithLogic.js @@ -87,6 +87,7 @@ function TeamsInfoWithLogic({ room, openEditing }) { try { await leaveTeam({ teamId: room.teamId, rooms }); + dispatchToastMessage({ type: 'success', message: t('Teams_left_team_successfully') }); router.push({}); } catch (error) { dispatchToastMessage({ type: 'error', message: error }); diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index f1c2475be6d..10644277722 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -3914,6 +3914,7 @@ "Teams_kept__username__channels": "You did not select the following Channels so __username__ will be kept on them:", "Teams_leave_channels": "Select the Team’s Channels you would like to leave.", "Teams_leave": "Leave Team", + "Teams_left_team_successfully": "Left the Team successfully", "Teams_members": "Teams Members", "Teams_New_Add_members_Label": "Add Members", "Teams_New_Broadcast_Description": "Only authorized users can write new messages, but the other users will be able to reply",