Skip to content

Commit

Permalink
[FIX] Joining and leaving messages in teams (#3591)
Browse files Browse the repository at this point in the history
Co-authored-by: Gleidson Daniel Silva <[email protected]>
Co-authored-by: Diego Mello <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2022
1 parent 9d9553b commit 11af350
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/containers/message/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export const SYSTEM_MESSAGES = [
'au',
'ru',
'ul',
'ult',
'uj',
'ujt',
'ut',
'rm',
'user-muted',
Expand All @@ -50,17 +52,21 @@ export const SYSTEM_MESSAGE_TYPES = {
MESSAGE_PINNED: 'message_pinned',
MESSAGE_SNIPPETED: 'message_snippeted',
USER_JOINED_CHANNEL: 'uj',
USER_JOINED_TEAM: 'ujt',
USER_JOINED_DISCUSSION: 'ut',
USER_LEFT_CHANNEL: 'ul'
USER_LEFT_CHANNEL: 'ul',
USER_LEFT_TEAM: 'ult'
};

export const SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME = [
SYSTEM_MESSAGE_TYPES.MESSAGE_REMOVED,
SYSTEM_MESSAGE_TYPES.MESSAGE_PINNED,
SYSTEM_MESSAGE_TYPES.MESSAGE_SNIPPETED,
SYSTEM_MESSAGE_TYPES.USER_JOINED_CHANNEL,
SYSTEM_MESSAGE_TYPES.USER_JOINED_TEAM,
SYSTEM_MESSAGE_TYPES.USER_JOINED_DISCUSSION,
SYSTEM_MESSAGE_TYPES.USER_LEFT_CHANNEL
SYSTEM_MESSAGE_TYPES.USER_LEFT_CHANNEL,
SYSTEM_MESSAGE_TYPES.USER_LEFT_TEAM
];

type TInfoMessage = {
Expand All @@ -77,6 +83,9 @@ export const getInfoMessage = ({ type, role, msg, author }: TInfoMessage) => {
if (type === 'uj') {
return I18n.t('Has_joined_the_channel');
}
if (type === 'ujt') {
return I18n.t('Has_joined_the_team');
}
if (type === 'ut') {
return I18n.t('Has_joined_the_conversation');
}
Expand All @@ -92,6 +101,9 @@ export const getInfoMessage = ({ type, role, msg, author }: TInfoMessage) => {
if (type === 'ul') {
return I18n.t('Has_left_the_channel');
}
if (type === 'ult') {
return I18n.t('Has_left_the_team');
}
if (type === 'ru') {
return I18n.t('User_removed_by', { userRemoved: msg, userBy: username });
}
Expand Down
2 changes: 2 additions & 0 deletions app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@
"Full_table": "Click to see full table",
"Generate_New_Link": "Generate New Link",
"Has_joined_the_channel": "has joined the channel",
"Has_joined_the_team": "has joined the team",
"Has_joined_the_conversation": "has joined the conversation",
"Has_left_the_channel": "has left the channel",
"Has_left_the_team": "has left the team",
"Hide_System_Messages": "Hide System Messages",
"Hide_type_messages": "Hide \"{{type}}\" messages",
"How_It_Works": "How It Works",
Expand Down
8 changes: 8 additions & 0 deletions app/utils/messageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ export const MessageTypeValues = [
value: 'uj',
text: 'Message_HideType_uj'
},
{
value: 'ujt',
text: 'Message_HideType_ujt'
},
{
value: 'ul',
text: 'Message_HideType_ul'
},
{
value: 'ult',
text: 'Message_HideType_ult'
},
{
value: 'ru',
text: 'Message_HideType_ru'
Expand Down

0 comments on commit 11af350

Please sign in to comment.