Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Interchange messages to correctly show success message #34289

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/happy-geckos-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

fix an issue where wrong success message dispatches on changing user-roles
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const useChangeLeaderAction = (user: Pick<IUser, '_id' | 'username'>, 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' }),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export const useChangeModeratorAction = (user: Pick<IUser, '_id' | 'username'>,
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 }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const useChangeOwnerAction = (user: Pick<IUser, '_id' | 'username'>, 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 }),
});
Expand Down
Loading