diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index c2fc9674..f247b28d 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -17387,14 +17387,9 @@ exports[`Storyshots Message list message 1`] = ` - - Message removed + + + diego.mello + + + + Message removed + @@ -42139,14 +42082,9 @@ exports[`Storyshots Message list message 1`] = ` > - - Has joined the channel + + + diego.mello + + + + has joined the channel + @@ -42306,14 +42267,9 @@ exports[`Storyshots Message list message 1`] = ` > - - Message pinned + + + diego.mello + + + + Message pinned + @@ -42640,14 +42614,9 @@ exports[`Storyshots Message list message 1`] = ` > - - Has left the channel + + + diego.mello + + + + has left the channel + @@ -42807,14 +42799,9 @@ exports[`Storyshots Message list message 1`] = ` > { if (props.isInfo) { const infoMessage = getInfoMessage({ ...props }); - return ( + + const renderMessageContent = ( {infoMessage} + > + {infoMessage} ); + + if (SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME.includes(props.type)) { + return ( + + {renderMessageContent} + + ); + } + + return renderMessageContent; } const isPreview = props.tmid && !props.isThreadRoom; diff --git a/app/containers/message/Message.js b/app/containers/message/Message.js index c3405cf7..bb59dbee 100644 --- a/app/containers/message/Message.js +++ b/app/containers/message/Message.js @@ -68,7 +68,7 @@ const Message = React.memo((props) => { return ( {thread} - + { if (isHeader || hasError) { const navParam = { @@ -47,17 +52,37 @@ const User = React.memo(({ const username = (useRealName && author.name) || author.username; const aliasUsername = alias ? ( @{username}) : null; const time = moment(ts).format(timeFormat); + const onUserPress = () => navToRoomInfo(navParam); + const isDisabled = author._id === user.id; + + const textContent = ( + <> + {alias || username} + {aliasUsername} + + ); + + if (SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME.includes(type)) { + return ( + + {textContent} + + ); + } return ( navToRoomInfo(navParam)} - disabled={author._id === user.id} + onPress={onUserPress} + disabled={isDisabled} > - {alias || username} - {aliasUsername} + {textContent} {time} @@ -77,7 +102,8 @@ User.propTypes = { ts: PropTypes.instanceOf(Date), timeFormat: PropTypes.string, theme: PropTypes.string, - navToRoomInfo: PropTypes.func + navToRoomInfo: PropTypes.func, + type: PropTypes.string }; User.displayName = 'MessageUser'; diff --git a/app/containers/message/styles.js b/app/containers/message/styles.js index 8510f90b..74e2b000 100644 --- a/app/containers/message/styles.js +++ b/app/containers/message/styles.js @@ -26,9 +26,6 @@ export default StyleSheet.create({ messageContentWithError: { marginLeft: 0 }, - center: { - alignItems: 'center' - }, flex: { flexDirection: 'row' // flex: 1 diff --git a/app/containers/message/utils.js b/app/containers/message/utils.js index 87b20fc5..325d3d76 100644 --- a/app/containers/message/utils.js +++ b/app/containers/message/utils.js @@ -40,6 +40,24 @@ export const SYSTEM_MESSAGES = [ 'thread-created' ]; +export const SYSTEM_MESSAGE_TYPES = { + MESSAGE_REMOVED: 'rm', + MESSAGE_PINNED: 'message_pinned', + MESSAGE_SNIPPETED: 'message_snippeted', + USER_JOINED_CHANNEL: 'uj', + USER_JOINED_DISCUSSION: 'ut', + USER_LEFT_CHANNEL: 'ul' +}; + +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_DISCUSSION, + SYSTEM_MESSAGE_TYPES.USER_LEFT_CHANNEL +]; + export const getInfoMessage = ({ type, role, msg, author }) => { diff --git a/app/i18n/locales/en.js b/app/i18n/locales/en.js index 6feb764f..cbc22609 100644 --- a/app/i18n/locales/en.js +++ b/app/i18n/locales/en.js @@ -167,7 +167,7 @@ export default { Create_Channel: 'Create Channel', Create_Direct_Messages: 'Create Direct Messages', Create_Discussion: 'Create Discussion', - Created_snippet: 'Created a snippet', + Created_snippet: 'created a snippet', Create_a_new_workspace: 'Create a new workspace', Create: 'Create', Custom_Status: 'Custom Status', @@ -247,9 +247,9 @@ export default { Group_by_favorites: 'Group favorites', Group_by_type: 'Group by type', Hide: 'Hide', - Has_joined_the_channel: 'Has joined the channel', - Has_joined_the_conversation: 'Has joined the conversation', - Has_left_the_channel: 'Has left the channel', + Has_joined_the_channel: 'has joined the channel', + Has_joined_the_conversation: 'has joined the conversation', + Has_left_the_channel: 'has left the channel', Hide_System_Messages: 'Hide System Messages', Hide_type_messages: 'Hide "{{type}}" messages', How_It_Works: 'How It Works', diff --git a/app/i18n/locales/es-ES.js b/app/i18n/locales/es-ES.js index 340a705a..2f20da3b 100644 --- a/app/i18n/locales/es-ES.js +++ b/app/i18n/locales/es-ES.js @@ -146,7 +146,7 @@ export default { Whats_the_password_for_your_certificate: '¿Cuál es la contraseña de tu cerficiado?', Create_account: 'Crear una cuenta', Create_Channel: 'Crear Sala', - Created_snippet: 'Crear snippet', + Created_snippet: 'crear snippet', Create_a_new_workspace: 'Crear un Workspace', Create: 'Crear', Dark: 'Óscuro', @@ -192,9 +192,9 @@ export default { Group_by_favorites: 'Agrupar por favoritos', Group_by_type: 'Agrupar por tipo', Hide: 'Ocultar', - Has_joined_the_channel: 'Se ha unido al canal', - Has_joined_the_conversation: 'Se ha unido a la conversación', - Has_left_the_channel: 'Ha dejado el canal', + Has_joined_the_channel: 'se ha unido al canal', + Has_joined_the_conversation: 'se ha unido a la conversación', + Has_left_the_channel: 'ha dejado el canal', In_App_And_Desktop: 'In-app and Desktop', In_App_and_Desktop_Alert_info: 'Muestra un banner en la parte superior de la pantalla cuando la aplicación está abierta y muestra una notificación en el escritorio', Invisible: 'Invisible', diff --git a/app/i18n/locales/fr.js b/app/i18n/locales/fr.js index b76559ad..f2087222 100644 --- a/app/i18n/locales/fr.js +++ b/app/i18n/locales/fr.js @@ -163,7 +163,7 @@ export default { Create_Channel: 'Créer un canal', Create_Direct_Messages: 'Créer un message direct', Create_Discussion: 'Créer une Discussion', - Created_snippet: 'Créé un extrait', + Created_snippet: 'créé un extrait', Create_a_new_workspace: 'Créer un nouvel espace de travail', Create: 'Créer', Custom_Status: 'Statut Personnalisé', @@ -225,9 +225,9 @@ export default { Group_by_favorites: 'Grouper par favoris', Group_by_type: 'Grouper par type', Hide: 'Cacher', - Has_joined_the_channel: 'A rejoint le canal', - Has_joined_the_conversation: 'A rejoint la conversation', - Has_left_the_channel: 'A quitté la chaîne', + Has_joined_the_channel: 'a rejoint le canal', + Has_joined_the_conversation: 'a rejoint la conversation', + Has_left_the_channel: 'a quitté la chaîne', Hide_System_Messages: 'Masquer les messages système', Hide_type_messages: 'Masquer les messages "{{type}}"', Message_HideType_uj: 'L\'utilisateur a rejoint', diff --git a/app/i18n/locales/nl.js b/app/i18n/locales/nl.js index 892c3b35..40a366b4 100644 --- a/app/i18n/locales/nl.js +++ b/app/i18n/locales/nl.js @@ -148,7 +148,7 @@ export default { Whats_the_password_for_your_certificate: 'Wat is het wachtwoord voor je certificate?', Create_account: 'Maak een account', Create_Channel: 'Maak een kanaal', - Created_snippet: 'Snippet gemaakt', + Created_snippet: 'snippet gemaakt', Create_a_new_workspace: 'Een nieuwe workspace maken', Create: 'Maken', Dark: 'Donker', @@ -197,9 +197,9 @@ export default { Group_by_favorites: 'Sorteer op favorieten', Group_by_type: 'Sorteer op type', Hide: 'Verberg', - Has_joined_the_channel: 'Is bij het kanaal gekomen', - Has_joined_the_conversation: 'Neemt deel aan het gesprek', - Has_left_the_channel: 'Heeft het kanaal verlaten', + Has_joined_the_channel: 'is bij het kanaal gekomen', + Has_joined_the_conversation: 'neemt deel aan het gesprek', + Has_left_the_channel: 'heeft het kanaal verlaten', In_App_And_Desktop: 'In-app en Desktop', In_App_and_Desktop_Alert_info: 'Laat een banner bovenaan het scherm zien als de app open is en geeft een notificatie op de desktop', Invisible: 'Onzichtbaar', diff --git a/app/i18n/locales/pt-BR.js b/app/i18n/locales/pt-BR.js index 36251207..e9625e96 100644 --- a/app/i18n/locales/pt-BR.js +++ b/app/i18n/locales/pt-BR.js @@ -167,7 +167,7 @@ export default { Create_Channel: 'Criar Canal', Create_Direct_Messages: 'Criar Mensagens Diretas', Create_Discussion: 'Criar Discussão', - Created_snippet: 'Criou um snippet', + Created_snippet: 'criou um snippet', Create_a_new_workspace: 'Criar nova área de trabalho', Create: 'Criar', Dark: 'Escuro', @@ -241,9 +241,9 @@ export default { Generate_New_Link: 'Gerar novo convite', Group_by_favorites: 'Agrupar favoritos', Group_by_type: 'Agrupar por tipo', - Has_joined_the_channel: 'Entrou no canal', - Has_joined_the_conversation: 'Entrou na conversa', - Has_left_the_channel: 'Saiu da conversa', + Has_joined_the_channel: 'entrou no canal', + Has_joined_the_conversation: 'entrou na conversa', + Has_left_the_channel: 'saiu da conversa', Hide_System_Messages: 'Esconder mensagens do sistema', Hide_type_messages: 'Esconder mensagens de "{{type}}"', Message_HideType_uj: 'Utilizador Entrou', diff --git a/app/i18n/locales/pt-PT.js b/app/i18n/locales/pt-PT.js index b63fcb09..7e9896cc 100644 --- a/app/i18n/locales/pt-PT.js +++ b/app/i18n/locales/pt-PT.js @@ -130,7 +130,7 @@ export default { Permalink: 'Link permanente', Create_account: 'Criar uma conta', Create_Channel: 'Criar Canal', - Created_snippet: 'Criado um extracto', + Created_snippet: 'criado um extracto', Create_a_new_workspace: 'Criar um novo espaço de trabalho', Create: 'Criar', Delete_Room_Warning: 'Apagar uma sala irá remover todas as mensagens contidas nela. Isto não pode ser desfeito.', @@ -163,9 +163,9 @@ export default { Forgot_Password: 'Esquecer Palavra-passe', Group_by_favorites: 'Agrupar por favoritos', Group_by_type: 'Agrupar por tipo', - Has_joined_the_channel: 'Entrou no canal', - Has_joined_the_conversation: 'Entrou na conversa', - Has_left_the_channel: 'Saiu do canal', + Has_joined_the_channel: 'entrou no canal', + Has_joined_the_conversation: 'entrou na conversa', + Has_left_the_channel: 'saiu do canal', Invisible: 'Invisível', Invite: 'Convidar', is_a_valid_RocketChat_instance: 'é uma instância válida do Rocket.Chat', diff --git a/app/i18n/locales/ru.js b/app/i18n/locales/ru.js index 317007a3..6b82d196 100644 --- a/app/i18n/locales/ru.js +++ b/app/i18n/locales/ru.js @@ -167,7 +167,7 @@ export default { Create_Channel: 'Создать канал', Create_Direct_Messages: 'Создать личное сообщение', Create_Discussion: 'Создать обсуждение', - Created_snippet: 'Создать сниппет', + Created_snippet: 'создать сниппет', Create_a_new_workspace: 'Новое рабочее пространство', Create: 'Создать', Custom_Status: 'Персонализированный Статус', @@ -247,9 +247,9 @@ export default { Group_by_favorites: 'По избранным', Group_by_type: 'По типу', Hide: 'Скрыть', - Has_joined_the_channel: 'Присоединился к каналу', - Has_joined_the_conversation: 'Присоединился к беседе', - Has_left_the_channel: 'Покинул канал', + Has_joined_the_channel: 'присоединился к каналу', + Has_joined_the_conversation: 'присоединился к беседе', + Has_left_the_channel: 'покинул канал', Hide_System_Messages: 'Скрыть Системные Сообщения', Hide_type_messages: 'Скрыть "{{type}}" сообщения', How_It_Works: 'Как Это Работает', diff --git a/e2e/tests/room/02-room.spec.js b/e2e/tests/room/02-room.spec.js index ee9f5bd4..a4720ba7 100644 --- a/e2e/tests/room/02-room.spec.js +++ b/e2e/tests/room/02-room.spec.js @@ -135,23 +135,23 @@ describe('Room screen', () => { await expect(element(by.id('action-sheet-handle'))).toBeVisible(); await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5); await element(by.label('Permalink')).tap(); - + // TODO: test clipboard }); - + it('should copy message', async() => { await element(by.label(`${ data.random }message`)).atIndex(0).longPress(); await expect(element(by.id('action-sheet'))).toExist(); await expect(element(by.id('action-sheet-handle'))).toBeVisible(); await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5); await element(by.label('Copy')).tap(); - + // TODO: test clipboard }); - + it('should star message', async() => { await starMessage('message') - + await sleep(1000) //https://github.com/RocketChat/Rocket.Chat.ReactNative/issues/2324 await element(by.label(`${ data.random }message`)).atIndex(0).longPress(); await expect(element(by.id('action-sheet'))).toExist(); @@ -160,7 +160,7 @@ describe('Room screen', () => { await waitFor(element(by.label('Unstar'))).toBeVisible().withTimeout(2000); await element(by.id('action-sheet-backdrop')).tap(); }); - + it('should react to message', async() => { await element(by.label(`${ data.random }message`)).atIndex(0).longPress(); await expect(element(by.id('action-sheet'))).toExist(); @@ -183,7 +183,7 @@ describe('Room screen', () => { await element(by.id('message-actions-emoji-+1')).tap(); await waitFor(element(by.id('message-reaction-:+1:'))).toBeVisible().withTimeout(60000); }); - + it('should show reaction picker on add reaction button pressed and have frequently used emoji', async() => { await element(by.id('message-add-reaction')).tap(); await waitFor(element(by.id('reaction-picker'))).toExist().withTimeout(2000); @@ -197,12 +197,12 @@ describe('Room screen', () => { it('should ask for review', async() => { await dismissReviewNag() //TODO: Create a proper test for this elsewhere. }) - + it('should remove reaction', async() => { await element(by.id('message-reaction-:grinning:')).tap(); await waitFor(element(by.id('message-reaction-:grinning:'))).toBeNotVisible().withTimeout(60000); }); - + it('should edit message', async() => { await mockMessage('edit'); await element(by.label(`${ data.random }edit`)).atIndex(0).longPress(); @@ -214,7 +214,7 @@ describe('Room screen', () => { await element(by.id('messagebox-send-message')).tap(); await waitFor(element(by.label(`${ data.random }edited (edited)`)).atIndex(0)).toExist().withTimeout(60000); }); - + it('should quote message', async() => { await mockMessage('quote'); await element(by.label(`${ data.random }quote`)).atIndex(0).longPress(); @@ -224,16 +224,16 @@ describe('Room screen', () => { await element(by.label('Quote')).tap(); await element(by.id('messagebox-input')).typeText(`${ data.random }quoted`); await element(by.id('messagebox-send-message')).tap(); - + // TODO: test if quote was sent }); - + it('should pin message', async() => { await mockMessage('pin') await pinMessage('pin') - + await waitFor(element(by.label(`${ data.random }pin`)).atIndex(0)).toBeVisible().withTimeout(2000); - await waitFor(element(by.label('Message pinned')).atIndex(0)).toBeVisible().withTimeout(2000); + await waitFor(element(by.label(`${ data.users.regular.username } Message pinned`)).atIndex(0)).toBeVisible().withTimeout(2000); await element(by.label(`${ data.random }pin`)).atIndex(0).longPress(); await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(1000); await expect(element(by.id('action-sheet-handle'))).toBeVisible(); @@ -361,4 +361,4 @@ describe('Room screen', () => { // await expect(element(by.id('rooms-list-view'))).toExist(); // }); }); -}); \ No newline at end of file +});