[IMPROVE] Team system messages feedback (#3771)

* almost there

* Update stories
This commit is contained in:
Diego Mello 2022-02-23 17:31:14 -03:00 committed by GitHub
parent 531ad9b9b4
commit 51ed83a33e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 102 additions and 5 deletions

View File

@ -45,7 +45,14 @@ export const SYSTEM_MESSAGES = [
'message_snippeted',
'thread-created',
'room_e2e_enabled',
'room_e2e_disabled'
'room_e2e_disabled',
'removed-user-from-team',
'added-user-to-team',
'user-added-room-to-team',
'user-converted-to-team',
'user-converted-to-channel',
'user-deleted-room-from-team',
'user-removed-room-from-team'
];
export const SYSTEM_MESSAGE_TYPES = {
@ -56,7 +63,14 @@ export const SYSTEM_MESSAGE_TYPES = {
USER_JOINED_TEAM: 'ujt',
USER_JOINED_DISCUSSION: 'ut',
USER_LEFT_CHANNEL: 'ul',
USER_LEFT_TEAM: 'ult'
USER_LEFT_TEAM: 'ult',
REMOVED_USER_FROM_TEAM: 'removed-user-from-team',
ADDED_USER_TO_TEAM: 'added-user-to-team',
ADDED_ROOM_TO_TEAM: 'user-added-room-to-team',
CONVERTED_TO_TEAM: 'user-converted-to-team',
CONVERTED_TO_CHANNEL: 'user-converted-to-channel',
DELETED_ROOM_FROM_TEAM: 'user-deleted-room-from-team',
REMOVED_ROOM_FROM_TEAM: 'user-removed-room-from-team'
};
export const SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME = [
@ -67,7 +81,14 @@ export const SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME = [
SYSTEM_MESSAGE_TYPES.USER_JOINED_TEAM,
SYSTEM_MESSAGE_TYPES.USER_JOINED_DISCUSSION,
SYSTEM_MESSAGE_TYPES.USER_LEFT_CHANNEL,
SYSTEM_MESSAGE_TYPES.USER_LEFT_TEAM
SYSTEM_MESSAGE_TYPES.USER_LEFT_TEAM,
SYSTEM_MESSAGE_TYPES.REMOVED_USER_FROM_TEAM,
SYSTEM_MESSAGE_TYPES.ADDED_USER_TO_TEAM,
SYSTEM_MESSAGE_TYPES.ADDED_ROOM_TO_TEAM,
SYSTEM_MESSAGE_TYPES.CONVERTED_TO_TEAM,
SYSTEM_MESSAGE_TYPES.CONVERTED_TO_CHANNEL,
SYSTEM_MESSAGE_TYPES.DELETED_ROOM_FROM_TEAM,
SYSTEM_MESSAGE_TYPES.REMOVED_ROOM_FROM_TEAM
];
type TInfoMessage = {
@ -76,6 +97,7 @@ type TInfoMessage = {
msg: string;
author: { username: string };
};
export const getInfoMessage = ({ type, role, msg, author }: TInfoMessage): string => {
const { username } = author;
if (type === 'rm') {
@ -147,6 +169,27 @@ export const getInfoMessage = ({ type, role, msg, author }: TInfoMessage): strin
if (type === 'room_e2e_enabled') {
return I18n.t('This_room_encryption_has_been_enabled_by__username_', { username });
}
if (type === 'removed-user-from-team') {
return I18n.t('Removed__username__from_team', { user_removed: username });
}
if (type === 'added-user-to-team') {
return I18n.t('Added__username__to_team', { user_added: username });
}
if (type === 'user-added-room-to-team') {
return I18n.t('added__roomName__to_team', { roomName: msg });
}
if (type === 'user-converted-to-team') {
return I18n.t('Converted__roomName__to_team', { roomName: msg });
}
if (type === 'user-converted-to-channel') {
return I18n.t('Converted__roomName__to_channel', { roomName: msg });
}
if (type === 'user-deleted-room-from-team') {
return I18n.t('Deleted__roomName__', { roomName: msg });
}
if (type === 'user-removed-room-from-team') {
return I18n.t('Removed__roomName__from_this_team', { roomName: msg });
}
return '';
};

View File

@ -788,5 +788,24 @@
"Enable_Message_Parser": "Enable Message Parser",
"Unsupported_format": "Unsupported format",
"Downloaded_file": "Downloaded file",
"Error_Download_file": "Error while downloading file"
"Error_Download_file": "Error while downloading file",
"added__roomName__to_team": "added #{{roomName}} to this Team",
"Added__username__to_team": "added @{{user_added}} to this Team",
"Converted__roomName__to_team": "converted #{{roomName}} to a Team",
"Converted__roomName__to_channel": "converted #{{roomName}} to a Channel",
"Converting_team_to_channel": "Converting Team to Channel",
"Deleted__roomName__": "deleted #{{roomName}}",
"Message_HideType_added_user_to_team": "Hide \"User Added to Team\" messages",
"Message_HideType_removed_user_from_team": "Hide \"User Removed from Team\" messages",
"Message_HideType_ujt": "Hide \"User Joined Team\" messages",
"Message_HideType_ult": "Hide \"User Left Team\" messages",
"Message_HideType_user_added_room_to_team": "Hide \"User Added Room to Team\" messages",
"Message_HideType_user_converted_to_channel": "Hide \"User converted team to a Channel\" messages",
"Message_HideType_user_converted_to_team": "Hide \"User converted channel to a Team\" messages",
"Message_HideType_user_deleted_room_from_team": "Hide \"User deleted room from Team\" messages",
"Message_HideType_user_removed_room_from_team": "Hide \"User removed room from Team\" messages",
"Removed__roomName__from_this_team": "removed #{{roomName}} from this Team",
"Removed__username__from_team": "removed @{{user_removed}} from this Team",
"User_joined_team": "joined this Team",
"User_left_team": "left this Team"
}

View File

@ -58,5 +58,33 @@ export const MessageTypeValues = [
{
value: 'room_unarchived',
text: 'Message_HideType_room_unarchived'
},
{
value: 'removed-user-from-team',
text: 'Message_HideType_removed_user_from_team'
},
{
value: 'added-user-to-team',
text: 'Message_HideType_added_user_to_team'
},
{
value: 'user-added-room-to-team',
text: 'Message_HideType_user_added_room_to_team'
},
{
value: 'user-converted-to-channel',
text: 'Message_HideType_user_converted_to_channel'
},
{
value: 'user-converted-to-team',
text: 'Message_HideType_user_converted_to_team'
},
{
value: 'user-deleted-room-from-team',
text: 'Message_HideType_user_deleted_room_from_team'
},
{
value: 'user-removed-room-from-team',
text: 'Message_HideType_user_removed_room_from_team'
}
];

View File

@ -797,6 +797,13 @@ stories.add('System messages', () => (
<Message msg='public' type='room_changed_privacy' isInfo />
<Message type='room_e2e_disabled' isInfo />
<Message type='room_e2e_enabled' isInfo />
<Message type='removed-user-from-team' isInfo />
<Message type='added-user-to-team' isInfo />
<Message type='user-added-room-to-team' isInfo msg='channel-name' />
<Message type='user-converted-to-team' isInfo msg='channel-name' />
<Message type='user-converted-to-channel' isInfo msg='channel-name' />
<Message type='user-deleted-room-from-team' isInfo msg='channel-name' />
<Message type='user-removed-room-from-team' isInfo msg='channel-name' />
</>
));

File diff suppressed because one or more lines are too long