From 1f0af922fc554e9b57fa688895bc23eb5c1541ef Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Thu, 10 Nov 2022 16:48:52 -0300 Subject: [PATCH] [IMPROVE] Sync message actions order with web app (#4672) --- app/containers/MessageActions/index.tsx | 80 ++++++++++++------------- app/i18n/locales/ar.json | 1 - app/i18n/locales/de.json | 1 - app/i18n/locales/en.json | 2 +- app/i18n/locales/es-ES.json | 4 +- app/i18n/locales/fr.json | 2 +- app/i18n/locales/it.json | 2 +- app/i18n/locales/ja.json | 1 - app/i18n/locales/nl.json | 2 +- app/i18n/locales/pt-BR.json | 2 +- app/i18n/locales/pt-PT.json | 2 +- app/i18n/locales/ru.json | 1 - app/i18n/locales/sl-SI.json | 1 - app/i18n/locales/tr.json | 2 +- app/i18n/locales/zh-CN.json | 1 - app/i18n/locales/zh-TW.json | 2 +- e2e/tests/room/02-room.spec.ts | 4 +- 17 files changed, 51 insertions(+), 59 deletions(-) diff --git a/app/containers/MessageActions/index.tsx b/app/containers/MessageActions/index.tsx index 9c1b442b1..e19598341 100644 --- a/app/containers/MessageActions/index.tsx +++ b/app/containers/MessageActions/index.tsx @@ -342,18 +342,7 @@ const MessageActions = React.memo( }; const getOptions = (message: TAnyMessageModel) => { - let options: TActionSheetOptionsItem[] = []; - - // Reply - if (!isReadOnly && !tmid) { - options = [ - { - title: I18n.t('Reply_in_Thread'), - icon: 'threads', - onPress: () => handleReply(message) - } - ]; - } + const options: TActionSheetOptionsItem[] = []; // Quote if (!isReadOnly) { @@ -364,6 +353,15 @@ const MessageActions = React.memo( }); } + // Reply + if (!isReadOnly && !tmid) { + options.push({ + title: I18n.t('Reply_in_Thread'), + icon: 'threads', + onPress: () => handleReply(message) + }); + } + // Reply in DM if (room.t !== 'd' && room.t !== 'l' && createDirectMessagePermission) { options.push({ @@ -373,22 +371,6 @@ const MessageActions = React.memo( }); } - // Edit - if (allowEdit(message)) { - options.push({ - title: I18n.t('Edit'), - icon: 'edit', - onPress: () => handleEdit(message) - }); - } - - // Permalink - options.push({ - title: I18n.t('Permalink'), - icon: 'link', - onPress: () => handlePermalink(message) - }); - // Create Discussion options.push({ title: I18n.t('Start_a_Discussion'), @@ -396,14 +378,12 @@ const MessageActions = React.memo( onPress: () => handleCreateDiscussion(message) }); - // Mark as unread - if (message.u && message.u._id !== user.id) { - options.push({ - title: I18n.t('Mark_unread'), - icon: 'flag', - onPress: () => handleUnread(message) - }); - } + // Permalink + options.push({ + title: I18n.t('Get_link'), + icon: 'link', + onPress: () => handlePermalink(message) + }); // Copy options.push({ @@ -419,12 +399,12 @@ const MessageActions = React.memo( onPress: () => handleShare(message) }); - // Star - if (Message_AllowStarring) { + // Edit + if (allowEdit(message)) { options.push({ - title: I18n.t(message.starred ? 'Unstar' : 'Star'), - icon: message.starred ? 'star-filled' : 'star', - onPress: () => handleStar(message) + title: I18n.t('Edit'), + icon: 'edit', + onPress: () => handleEdit(message) }); } @@ -437,6 +417,24 @@ const MessageActions = React.memo( }); } + // Star + if (Message_AllowStarring) { + options.push({ + title: I18n.t(message.starred ? 'Unstar' : 'Star'), + icon: message.starred ? 'star-filled' : 'star', + onPress: () => handleStar(message) + }); + } + + // Mark as unread + if (message.u && message.u._id !== user.id) { + options.push({ + title: I18n.t('Mark_unread'), + icon: 'flag', + onPress: () => handleUnread(message) + }); + } + // Read Receipts if (Message_Read_Receipt_Store_Users) { options.push({ diff --git a/app/i18n/locales/ar.json b/app/i18n/locales/ar.json index 60659b9a1..eed97c85d 100644 --- a/app/i18n/locales/ar.json +++ b/app/i18n/locales/ar.json @@ -157,7 +157,6 @@ "Copied_to_clipboard": "تم النسخ للحافظة!", "Copy": "نسخ", "Conversation": "محادثة", - "Permalink": "رابط ثابت", "Certificate_password": "الرقم السري للشهادة", "Clear_cache": "امسح ذاكرة التخزين المؤقتة للخادم", "Clear_cache_loading": "يتم مسح ذاكرة التخزين", diff --git a/app/i18n/locales/de.json b/app/i18n/locales/de.json index b01bfce24..db4045668 100644 --- a/app/i18n/locales/de.json +++ b/app/i18n/locales/de.json @@ -168,7 +168,6 @@ "Copied_to_clipboard": "In die Zwischenablage kopiert!", "Copy": "Kopieren", "Conversation": "Konversationen", - "Permalink": "Permalink", "Certificate_password": "Zertifikats-Passwort", "Clear_cache": "Lokalen Server-Cache leeren", "Clear_cache_loading": "Leere Cache.", diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index 220a4dc9a..e2f1fca0a 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -168,7 +168,6 @@ "Copied_to_clipboard": "Copied to clipboard!", "Copy": "Copy", "Conversation": "Conversation", - "Permalink": "Permalink", "Certificate_password": "Certificate Password", "Clear_cache": "Clear local server cache", "Clear_cache_loading": "Clearing cache.", @@ -257,6 +256,7 @@ "Forward_to_user": "Forward to user", "Full_table": "Click to see full table", "Generate_New_Link": "Generate New Link", + "Get_link": "Get Link", "User_joined_the_channel": "joined the channel", "User_joined_the_conversation": "joined the conversation", "User_joined_the_team": "joined this team", diff --git a/app/i18n/locales/es-ES.json b/app/i18n/locales/es-ES.json index 7b1fc755e..caff90735 100644 --- a/app/i18n/locales/es-ES.json +++ b/app/i18n/locales/es-ES.json @@ -137,7 +137,6 @@ "Continue_with": "Continuar con", "Copied_to_clipboard": "¡Copiado al portapapeles!", "Copy": "Copiar", - "Permalink": "Enlace permanente", "Certificate_password": "Contraseña del certificado", "Whats_the_password_for_your_certificate": "¿Cuál es la contraseña de tu certificado?", "Create_account": "Crear una cuenta", @@ -424,5 +423,6 @@ "Server_selection_numbers": "Seleccionar servidor 1...9", "Add_server": "Añadir servidor", "New_line": "Nueva línea", - "Broadcast_hint": "Sólo los usuarios autorizados pueden escribir nuevos mensajes, el resto podrán responder sobre los mismos." + "Broadcast_hint": "Sólo los usuarios autorizados pueden escribir nuevos mensajes, el resto podrán responder sobre los mismos.", + "Get_link": "Obtener enlace" } \ No newline at end of file diff --git a/app/i18n/locales/fr.json b/app/i18n/locales/fr.json index 0679fff6d..f2799c75a 100644 --- a/app/i18n/locales/fr.json +++ b/app/i18n/locales/fr.json @@ -161,7 +161,6 @@ "Copied_to_clipboard": "Copié dans le presse-papier !", "Copy": "Copier", "Conversation": "Conversation", - "Permalink": "Lien permanent", "Certificate_password": "Mot de passe du certificat", "Clear_cache": "Effacer le cache du serveur local", "Clear_cache_loading": "Effacement du cache.", @@ -248,6 +247,7 @@ "Forward_to_user": "Transmettre à l'utilisateur", "Full_table": "Cliquez pour voir le tableau complet", "Generate_New_Link": "Générer un nouveau lien", + "Get_link": "Obtenir le lien", "Has_left_the_team": "a quitté l'équipe", "Hide_System_Messages": "Masquer les messages système", "Hide_type_messages": "Masquer les messages \"{{type}}\"", diff --git a/app/i18n/locales/it.json b/app/i18n/locales/it.json index 80c2d1798..150325f5f 100644 --- a/app/i18n/locales/it.json +++ b/app/i18n/locales/it.json @@ -168,7 +168,6 @@ "Copied_to_clipboard": "Copiato negli appunti!", "Copy": "Copia", "Conversation": "Conversazione", - "Permalink": "Permalink", "Certificate_password": "Password certificato", "Clear_cache": "Cancella la cache locale", "Clear_cache_loading": "Cancellando la cache.", @@ -256,6 +255,7 @@ "Forward_to_user": "Inoltra ad udente", "Full_table": "Clicca per la tabella completa", "Generate_New_Link": "Genera nuovo link", + "Get_link": "Ottieni link", "Has_left_the_team": "Ha lasciato il team", "Hide_System_Messages": "Nascondi messaggi di sistema", "Hide_type_messages": "Nascondi messaggi di \"{{type}}\"", diff --git a/app/i18n/locales/ja.json b/app/i18n/locales/ja.json index 07a249826..2e08ab32f 100644 --- a/app/i18n/locales/ja.json +++ b/app/i18n/locales/ja.json @@ -159,7 +159,6 @@ "Copied_to_clipboard": "クリップボードにコピー!", "Copy": "コピー", "Conversation": "会話", - "Permalink": "パーマリンク", "Certificate_password": "パスワード証明書", "Clear_cache": "ローカルのサーバーキャッシュをクリア", "Clear_cache_loading": "キャッシュをクリアしています。", diff --git a/app/i18n/locales/nl.json b/app/i18n/locales/nl.json index 042af4e42..2423e6863 100644 --- a/app/i18n/locales/nl.json +++ b/app/i18n/locales/nl.json @@ -161,7 +161,6 @@ "Copied_to_clipboard": "Gekopieerd naar klembord!", "Copy": "Kopiëren", "Conversation": "Conversatie", - "Permalink": "Permalink", "Certificate_password": "Certificaat wachtwoord", "Clear_cache": "Lokale server cache wissen", "Clear_cache_loading": "Cache wissen.", @@ -248,6 +247,7 @@ "Forward_to_user": "Doorsturen naar gebruiker", "Full_table": "Klik om de volledige tabel te zien", "Generate_New_Link": "Nieuwe link genereren", + "Get_link": "Link krijgen", "Has_left_the_team": "heeft het team verlaten", "Hide_System_Messages": "Verberg systeemberichten", "Hide_type_messages": "Verberg \"{{type}}\" berichten", diff --git a/app/i18n/locales/pt-BR.json b/app/i18n/locales/pt-BR.json index 92cb708b0..22ddea71e 100644 --- a/app/i18n/locales/pt-BR.json +++ b/app/i18n/locales/pt-BR.json @@ -163,7 +163,6 @@ "Copied_to_clipboard": "Copiado para a área de transferência!", "Copy": "Copiar", "Conversation": "Conversação", - "Permalink": "Link-Permanente", "Clear_cache_loading": "Limpando cache.", "Create_account": "Criar conta", "Create_Channel": "Criar Canal", @@ -248,6 +247,7 @@ "Forward_to_user": "Encaminhar para usuário", "Full_table": "Clique para ver a tabela completa", "Generate_New_Link": "Gerar novo convite", + "Get_link": "Obter link", "Has_left_the_team": "saiu da equipe", "Hide_System_Messages": "Esconder mensagens do sistema", "Hide_type_messages": "Esconder mensagens de \"{{type}}\"", diff --git a/app/i18n/locales/pt-PT.json b/app/i18n/locales/pt-PT.json index 82b48dcb9..704dc7081 100644 --- a/app/i18n/locales/pt-PT.json +++ b/app/i18n/locales/pt-PT.json @@ -158,7 +158,6 @@ "Copied_to_clipboard": "Copiado para a área de transferência!", "Copy": "Copiar", "Conversation": "Conversa", - "Permalink": "Link permanente", "Certificate_password": "Senha do Certificado", "Clear_cache": "Limpar a cache do servidor local", "Clear_cache_loading": "A limpar a cache.", @@ -245,6 +244,7 @@ "Forward_to_user": "Reencaminhar para o utilizador", "Full_table": "Clique para ver a tabela completa", "Generate_New_Link": "Gerar Novo Link", + "Get_link": "Obter Ligação", "Hide_System_Messages": "Esconder mensagens do sistema", "Hide_type_messages": "Esconder mensagens \"{{type}}\"", "How_It_Works": "Como Funciona", diff --git a/app/i18n/locales/ru.json b/app/i18n/locales/ru.json index c865abd98..f76fd99d3 100644 --- a/app/i18n/locales/ru.json +++ b/app/i18n/locales/ru.json @@ -168,7 +168,6 @@ "Copied_to_clipboard": "Скопировано в буфер обмена!", "Copy": "Копировать", "Conversation": "Диалог", - "Permalink": "Постоянная ссылка", "Certificate_password": "Пароль сертификата", "Clear_cache": "Очистить локальный кэш сервера", "Clear_cache_loading": "Очистка кэша.", diff --git a/app/i18n/locales/sl-SI.json b/app/i18n/locales/sl-SI.json index 478bf7aa0..09fb9aafc 100644 --- a/app/i18n/locales/sl-SI.json +++ b/app/i18n/locales/sl-SI.json @@ -170,7 +170,6 @@ "Copied_to_clipboard": "Kopirano v odložišče!", "Copy": "Kopiraj", "Conversation": "Pogovor", - "Permalink": "Permalink", "Certificate_password": "Geslo potrdila", "Clear_cache": "Počistite predpomnilnik lokalnega strežnika", "Clear_cache_loading": "Čiščenje predpomnilnika.", diff --git a/app/i18n/locales/tr.json b/app/i18n/locales/tr.json index e4638e8f1..feab78458 100644 --- a/app/i18n/locales/tr.json +++ b/app/i18n/locales/tr.json @@ -155,7 +155,6 @@ "Copied_to_clipboard": "Panoya kopyalandı!", "Copy": "Kopyala", "Conversation": "Sohbet", - "Permalink": "Kalıcı bağlantı", "Certificate_password": "Sertifika Şifresi", "Clear_cache": "Yerel sunucu önbelleğini temizleyin", "Clear_cache_loading": "Önbellek temizleniyor.", @@ -240,6 +239,7 @@ "Forward_to_user": "Kullanıcıya İlet", "Full_table": "Tam tabloyu görmek için tıklayın", "Generate_New_Link": "Yeni Bağlantı Oluştur", + "Get_link": "Bağlantıyı Al", "Hide_System_Messages": "Sistem İletilerını Gizle", "Hide_type_messages": "\"{{type}}\" iletilerini gizle", "How_It_Works": "Nasıl Çalışır", diff --git a/app/i18n/locales/zh-CN.json b/app/i18n/locales/zh-CN.json index 053210a1e..d92e61be3 100644 --- a/app/i18n/locales/zh-CN.json +++ b/app/i18n/locales/zh-CN.json @@ -155,7 +155,6 @@ "Copied_to_clipboard": "复制到剪贴板", "Copy": "复制", "Conversation": "对话", - "Permalink": "永久链接", "Certificate_password": "凭证密码", "Clear_cache": "清除本机资料", "Clear_cache_loading": "清除快取", diff --git a/app/i18n/locales/zh-TW.json b/app/i18n/locales/zh-TW.json index f904f2f28..cb56e1b88 100644 --- a/app/i18n/locales/zh-TW.json +++ b/app/i18n/locales/zh-TW.json @@ -156,7 +156,6 @@ "Copied_to_clipboard": "複製到剪貼簿", "Copy": "複製", "Conversation": "對話", - "Permalink": "永久連結", "Certificate_password": "憑證密碼", "Clear_cache": "清除本機資料", "Clear_cache_loading": "清除快取", @@ -241,6 +240,7 @@ "Forward_to_user": "轉發給使用者", "Full_table": "點擊以查看完整表格", "Generate_New_Link": "產生新的連結", + "Get_link": "取得連結", "Hide_System_Messages": "隱藏系統訊息", "Hide_type_messages": "隱藏 '{{type}}' 訊息", "How_It_Works": "運作方式", diff --git a/e2e/tests/room/02-room.spec.ts b/e2e/tests/room/02-room.spec.ts index 547f4600f..e037b81e1 100644 --- a/e2e/tests/room/02-room.spec.ts +++ b/e2e/tests/room/02-room.spec.ts @@ -298,7 +298,7 @@ describe('Room screen', () => { }); describe('Message', () => { - it('should copy permalink', async () => { + it('should copy link', async () => { await element(by[textMatcher](`${data.random}message`)) .atIndex(0) .longPress(); @@ -307,7 +307,7 @@ describe('Room screen', () => { .withTimeout(2000); await expect(element(by.id('action-sheet-handle'))).toBeVisible(); await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5); - await element(by[textMatcher]('Permalink')).atIndex(0).tap(); + await element(by[textMatcher]('Get Link')).atIndex(0).tap(); // TODO: test clipboard }); it('should copy message', async () => {