From 4acf97d66330a57a5b98eaeeda596d24e8ec90dd Mon Sep 17 00:00:00 2001 From: Piyush Bhatt <2023kuec2027@iiitkota.ac.in> Date: Sat, 21 Dec 2024 20:55:39 +0530 Subject: [PATCH] interchangeSuccessMessage --- .changeset/happy-geckos-cough.md | 5 +++++ .../useUserInfoActions/actions/useChangeLeaderAction.ts | 2 +- .../useUserInfoActions/actions/useChangeModeratorAction.tsx | 4 ++-- .../useUserInfoActions/actions/useChangeOwnerAction.tsx | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/happy-geckos-cough.md diff --git a/.changeset/happy-geckos-cough.md b/.changeset/happy-geckos-cough.md new file mode 100644 index 000000000000..efbd629d7fa3 --- /dev/null +++ b/.changeset/happy-geckos-cough.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +fix an issue where wrong success message dispatches on changing user-roles diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeLeaderAction.ts b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeLeaderAction.ts index f97ae7dab10b..f0b9a785cde2 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeLeaderAction.ts +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeLeaderAction.ts @@ -24,7 +24,7 @@ export const useChangeLeaderAction = (user: Pick, rid const endpointPrefix = room.t === 'p' ? '/v1/groups' : '/v1/channels'; const changeLeaderEndpoint = isLeader ? 'removeLeader' : 'addLeader'; - const changeLeaderMessage = isLeader ? 'removed__username__as__role_' : 'set__username__as__role_'; + const changeLeaderMessage = isLeader ? 'set__username__as__role_' : 'removed__username__as__role_'; const changeLeader = useEndpointAction('POST', `${endpointPrefix}.${changeLeaderEndpoint}`, { successMessage: t(changeLeaderMessage, { username: user.username, role: 'leader' }), }); diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx index 095695b160c1..37d1318edc5e 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx @@ -56,8 +56,8 @@ export const useChangeModeratorAction = (user: Pick, const endpointPrefix = room.t === 'p' ? '/v1/groups' : '/v1/channels'; const changeModeratorEndpoint = isModerator ? 'removeModerator' : 'addModerator'; const changeModeratorMessage = isModerator - ? 'User__username__removed_from__room_name__moderators' - : 'User__username__is_now_a_moderator_of__room_name_'; + ? 'User__username__is_now_a_moderator_of__room_name_' + : 'User__username__removed_from__room_name__moderators'; const changeModerator = useEndpointAction('POST', `${endpointPrefix}.${changeModeratorEndpoint}`, { successMessage: t(changeModeratorMessage, { username: user.username, room_name: roomName }), diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx index 5894138d87f4..14ee4f04b672 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx @@ -53,7 +53,7 @@ export const useChangeOwnerAction = (user: Pick, rid: const endpointPrefix = room.t === 'p' ? '/v1/groups' : '/v1/channels'; const changeOwnerEndpoint = isOwner ? 'removeOwner' : 'addOwner'; - const changeOwnerMessage = isOwner ? 'User__username__removed_from__room_name__owners' : 'User__username__is_now_an_owner_of__room_name_'; + const changeOwnerMessage = isOwner ? 'User__username__is_now_an_owner_of__room_name_' : 'User__username__removed_from__room_name__owners'; const changeOwner = useEndpointAction('POST', `${endpointPrefix}.${changeOwnerEndpoint}`, { successMessage: t(changeOwnerMessage, { username: user.username, room_name: roomName }), });