[IMPROVE] Sync message actions order with web app (#4672)

This commit is contained in:
Diego Mello 2022-11-10 16:48:52 -03:00
parent 2b5803980d
commit 1f0af922fc
17 changed files with 51 additions and 59 deletions

View File

@ -342,18 +342,7 @@ const MessageActions = React.memo(
}; };
const getOptions = (message: TAnyMessageModel) => { const getOptions = (message: TAnyMessageModel) => {
let options: TActionSheetOptionsItem[] = []; const options: TActionSheetOptionsItem[] = [];
// Reply
if (!isReadOnly && !tmid) {
options = [
{
title: I18n.t('Reply_in_Thread'),
icon: 'threads',
onPress: () => handleReply(message)
}
];
}
// Quote // Quote
if (!isReadOnly) { 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 // Reply in DM
if (room.t !== 'd' && room.t !== 'l' && createDirectMessagePermission) { if (room.t !== 'd' && room.t !== 'l' && createDirectMessagePermission) {
options.push({ 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 // Create Discussion
options.push({ options.push({
title: I18n.t('Start_a_Discussion'), title: I18n.t('Start_a_Discussion'),
@ -396,14 +378,12 @@ const MessageActions = React.memo(
onPress: () => handleCreateDiscussion(message) onPress: () => handleCreateDiscussion(message)
}); });
// Mark as unread // Permalink
if (message.u && message.u._id !== user.id) {
options.push({ options.push({
title: I18n.t('Mark_unread'), title: I18n.t('Get_link'),
icon: 'flag', icon: 'link',
onPress: () => handleUnread(message) onPress: () => handlePermalink(message)
}); });
}
// Copy // Copy
options.push({ options.push({
@ -419,12 +399,12 @@ const MessageActions = React.memo(
onPress: () => handleShare(message) onPress: () => handleShare(message)
}); });
// Star // Edit
if (Message_AllowStarring) { if (allowEdit(message)) {
options.push({ options.push({
title: I18n.t(message.starred ? 'Unstar' : 'Star'), title: I18n.t('Edit'),
icon: message.starred ? 'star-filled' : 'star', icon: 'edit',
onPress: () => handleStar(message) 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 // Read Receipts
if (Message_Read_Receipt_Store_Users) { if (Message_Read_Receipt_Store_Users) {
options.push({ options.push({

View File

@ -157,7 +157,6 @@
"Copied_to_clipboard": "تم النسخ للحافظة!", "Copied_to_clipboard": "تم النسخ للحافظة!",
"Copy": "نسخ", "Copy": "نسخ",
"Conversation": "محادثة", "Conversation": "محادثة",
"Permalink": "رابط ثابت",
"Certificate_password": "الرقم السري للشهادة", "Certificate_password": "الرقم السري للشهادة",
"Clear_cache": "امسح ذاكرة التخزين المؤقتة للخادم", "Clear_cache": "امسح ذاكرة التخزين المؤقتة للخادم",
"Clear_cache_loading": "يتم مسح ذاكرة التخزين", "Clear_cache_loading": "يتم مسح ذاكرة التخزين",

View File

@ -168,7 +168,6 @@
"Copied_to_clipboard": "In die Zwischenablage kopiert!", "Copied_to_clipboard": "In die Zwischenablage kopiert!",
"Copy": "Kopieren", "Copy": "Kopieren",
"Conversation": "Konversationen", "Conversation": "Konversationen",
"Permalink": "Permalink",
"Certificate_password": "Zertifikats-Passwort", "Certificate_password": "Zertifikats-Passwort",
"Clear_cache": "Lokalen Server-Cache leeren", "Clear_cache": "Lokalen Server-Cache leeren",
"Clear_cache_loading": "Leere Cache.", "Clear_cache_loading": "Leere Cache.",

View File

@ -168,7 +168,6 @@
"Copied_to_clipboard": "Copied to clipboard!", "Copied_to_clipboard": "Copied to clipboard!",
"Copy": "Copy", "Copy": "Copy",
"Conversation": "Conversation", "Conversation": "Conversation",
"Permalink": "Permalink",
"Certificate_password": "Certificate Password", "Certificate_password": "Certificate Password",
"Clear_cache": "Clear local server cache", "Clear_cache": "Clear local server cache",
"Clear_cache_loading": "Clearing cache.", "Clear_cache_loading": "Clearing cache.",
@ -257,6 +256,7 @@
"Forward_to_user": "Forward to user", "Forward_to_user": "Forward to user",
"Full_table": "Click to see full table", "Full_table": "Click to see full table",
"Generate_New_Link": "Generate New Link", "Generate_New_Link": "Generate New Link",
"Get_link": "Get Link",
"User_joined_the_channel": "joined the channel", "User_joined_the_channel": "joined the channel",
"User_joined_the_conversation": "joined the conversation", "User_joined_the_conversation": "joined the conversation",
"User_joined_the_team": "joined this team", "User_joined_the_team": "joined this team",

View File

@ -137,7 +137,6 @@
"Continue_with": "Continuar con", "Continue_with": "Continuar con",
"Copied_to_clipboard": "¡Copiado al portapapeles!", "Copied_to_clipboard": "¡Copiado al portapapeles!",
"Copy": "Copiar", "Copy": "Copiar",
"Permalink": "Enlace permanente",
"Certificate_password": "Contraseña del certificado", "Certificate_password": "Contraseña del certificado",
"Whats_the_password_for_your_certificate": "¿Cuál es la contraseña de tu certificado?", "Whats_the_password_for_your_certificate": "¿Cuál es la contraseña de tu certificado?",
"Create_account": "Crear una cuenta", "Create_account": "Crear una cuenta",
@ -424,5 +423,6 @@
"Server_selection_numbers": "Seleccionar servidor 1...9", "Server_selection_numbers": "Seleccionar servidor 1...9",
"Add_server": "Añadir servidor", "Add_server": "Añadir servidor",
"New_line": "Nueva línea", "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"
} }

View File

@ -161,7 +161,6 @@
"Copied_to_clipboard": "Copié dans le presse-papier !", "Copied_to_clipboard": "Copié dans le presse-papier !",
"Copy": "Copier", "Copy": "Copier",
"Conversation": "Conversation", "Conversation": "Conversation",
"Permalink": "Lien permanent",
"Certificate_password": "Mot de passe du certificat", "Certificate_password": "Mot de passe du certificat",
"Clear_cache": "Effacer le cache du serveur local", "Clear_cache": "Effacer le cache du serveur local",
"Clear_cache_loading": "Effacement du cache.", "Clear_cache_loading": "Effacement du cache.",
@ -248,6 +247,7 @@
"Forward_to_user": "Transmettre à l'utilisateur", "Forward_to_user": "Transmettre à l'utilisateur",
"Full_table": "Cliquez pour voir le tableau complet", "Full_table": "Cliquez pour voir le tableau complet",
"Generate_New_Link": "Générer un nouveau lien", "Generate_New_Link": "Générer un nouveau lien",
"Get_link": "Obtenir le lien",
"Has_left_the_team": "a quitté l'équipe", "Has_left_the_team": "a quitté l'équipe",
"Hide_System_Messages": "Masquer les messages système", "Hide_System_Messages": "Masquer les messages système",
"Hide_type_messages": "Masquer les messages \"{{type}}\"", "Hide_type_messages": "Masquer les messages \"{{type}}\"",

View File

@ -168,7 +168,6 @@
"Copied_to_clipboard": "Copiato negli appunti!", "Copied_to_clipboard": "Copiato negli appunti!",
"Copy": "Copia", "Copy": "Copia",
"Conversation": "Conversazione", "Conversation": "Conversazione",
"Permalink": "Permalink",
"Certificate_password": "Password certificato", "Certificate_password": "Password certificato",
"Clear_cache": "Cancella la cache locale", "Clear_cache": "Cancella la cache locale",
"Clear_cache_loading": "Cancellando la cache.", "Clear_cache_loading": "Cancellando la cache.",
@ -256,6 +255,7 @@
"Forward_to_user": "Inoltra ad udente", "Forward_to_user": "Inoltra ad udente",
"Full_table": "Clicca per la tabella completa", "Full_table": "Clicca per la tabella completa",
"Generate_New_Link": "Genera nuovo link", "Generate_New_Link": "Genera nuovo link",
"Get_link": "Ottieni link",
"Has_left_the_team": "Ha lasciato il team", "Has_left_the_team": "Ha lasciato il team",
"Hide_System_Messages": "Nascondi messaggi di sistema", "Hide_System_Messages": "Nascondi messaggi di sistema",
"Hide_type_messages": "Nascondi messaggi di \"{{type}}\"", "Hide_type_messages": "Nascondi messaggi di \"{{type}}\"",

View File

@ -159,7 +159,6 @@
"Copied_to_clipboard": "クリップボードにコピー!", "Copied_to_clipboard": "クリップボードにコピー!",
"Copy": "コピー", "Copy": "コピー",
"Conversation": "会話", "Conversation": "会話",
"Permalink": "パーマリンク",
"Certificate_password": "パスワード証明書", "Certificate_password": "パスワード証明書",
"Clear_cache": "ローカルのサーバーキャッシュをクリア", "Clear_cache": "ローカルのサーバーキャッシュをクリア",
"Clear_cache_loading": "キャッシュをクリアしています。", "Clear_cache_loading": "キャッシュをクリアしています。",

View File

@ -161,7 +161,6 @@
"Copied_to_clipboard": "Gekopieerd naar klembord!", "Copied_to_clipboard": "Gekopieerd naar klembord!",
"Copy": "Kopiëren", "Copy": "Kopiëren",
"Conversation": "Conversatie", "Conversation": "Conversatie",
"Permalink": "Permalink",
"Certificate_password": "Certificaat wachtwoord", "Certificate_password": "Certificaat wachtwoord",
"Clear_cache": "Lokale server cache wissen", "Clear_cache": "Lokale server cache wissen",
"Clear_cache_loading": "Cache wissen.", "Clear_cache_loading": "Cache wissen.",
@ -248,6 +247,7 @@
"Forward_to_user": "Doorsturen naar gebruiker", "Forward_to_user": "Doorsturen naar gebruiker",
"Full_table": "Klik om de volledige tabel te zien", "Full_table": "Klik om de volledige tabel te zien",
"Generate_New_Link": "Nieuwe link genereren", "Generate_New_Link": "Nieuwe link genereren",
"Get_link": "Link krijgen",
"Has_left_the_team": "heeft het team verlaten", "Has_left_the_team": "heeft het team verlaten",
"Hide_System_Messages": "Verberg systeemberichten", "Hide_System_Messages": "Verberg systeemberichten",
"Hide_type_messages": "Verberg \"{{type}}\" berichten", "Hide_type_messages": "Verberg \"{{type}}\" berichten",

View File

@ -163,7 +163,6 @@
"Copied_to_clipboard": "Copiado para a área de transferência!", "Copied_to_clipboard": "Copiado para a área de transferência!",
"Copy": "Copiar", "Copy": "Copiar",
"Conversation": "Conversação", "Conversation": "Conversação",
"Permalink": "Link-Permanente",
"Clear_cache_loading": "Limpando cache.", "Clear_cache_loading": "Limpando cache.",
"Create_account": "Criar conta", "Create_account": "Criar conta",
"Create_Channel": "Criar Canal", "Create_Channel": "Criar Canal",
@ -248,6 +247,7 @@
"Forward_to_user": "Encaminhar para usuário", "Forward_to_user": "Encaminhar para usuário",
"Full_table": "Clique para ver a tabela completa", "Full_table": "Clique para ver a tabela completa",
"Generate_New_Link": "Gerar novo convite", "Generate_New_Link": "Gerar novo convite",
"Get_link": "Obter link",
"Has_left_the_team": "saiu da equipe", "Has_left_the_team": "saiu da equipe",
"Hide_System_Messages": "Esconder mensagens do sistema", "Hide_System_Messages": "Esconder mensagens do sistema",
"Hide_type_messages": "Esconder mensagens de \"{{type}}\"", "Hide_type_messages": "Esconder mensagens de \"{{type}}\"",

View File

@ -158,7 +158,6 @@
"Copied_to_clipboard": "Copiado para a área de transferência!", "Copied_to_clipboard": "Copiado para a área de transferência!",
"Copy": "Copiar", "Copy": "Copiar",
"Conversation": "Conversa", "Conversation": "Conversa",
"Permalink": "Link permanente",
"Certificate_password": "Senha do Certificado", "Certificate_password": "Senha do Certificado",
"Clear_cache": "Limpar a cache do servidor local", "Clear_cache": "Limpar a cache do servidor local",
"Clear_cache_loading": "A limpar a cache.", "Clear_cache_loading": "A limpar a cache.",
@ -245,6 +244,7 @@
"Forward_to_user": "Reencaminhar para o utilizador", "Forward_to_user": "Reencaminhar para o utilizador",
"Full_table": "Clique para ver a tabela completa", "Full_table": "Clique para ver a tabela completa",
"Generate_New_Link": "Gerar Novo Link", "Generate_New_Link": "Gerar Novo Link",
"Get_link": "Obter Ligação",
"Hide_System_Messages": "Esconder mensagens do sistema", "Hide_System_Messages": "Esconder mensagens do sistema",
"Hide_type_messages": "Esconder mensagens \"{{type}}\"", "Hide_type_messages": "Esconder mensagens \"{{type}}\"",
"How_It_Works": "Como Funciona", "How_It_Works": "Como Funciona",

View File

@ -168,7 +168,6 @@
"Copied_to_clipboard": "Скопировано в буфер обмена!", "Copied_to_clipboard": "Скопировано в буфер обмена!",
"Copy": "Копировать", "Copy": "Копировать",
"Conversation": "Диалог", "Conversation": "Диалог",
"Permalink": "Постоянная ссылка",
"Certificate_password": "Пароль сертификата", "Certificate_password": "Пароль сертификата",
"Clear_cache": "Очистить локальный кэш сервера", "Clear_cache": "Очистить локальный кэш сервера",
"Clear_cache_loading": "Очистка кэша.", "Clear_cache_loading": "Очистка кэша.",

View File

@ -170,7 +170,6 @@
"Copied_to_clipboard": "Kopirano v odložišče!", "Copied_to_clipboard": "Kopirano v odložišče!",
"Copy": "Kopiraj", "Copy": "Kopiraj",
"Conversation": "Pogovor", "Conversation": "Pogovor",
"Permalink": "Permalink",
"Certificate_password": "Geslo potrdila", "Certificate_password": "Geslo potrdila",
"Clear_cache": "Počistite predpomnilnik lokalnega strežnika", "Clear_cache": "Počistite predpomnilnik lokalnega strežnika",
"Clear_cache_loading": "Čiščenje predpomnilnika.", "Clear_cache_loading": "Čiščenje predpomnilnika.",

View File

@ -155,7 +155,6 @@
"Copied_to_clipboard": "Panoya kopyalandı!", "Copied_to_clipboard": "Panoya kopyalandı!",
"Copy": "Kopyala", "Copy": "Kopyala",
"Conversation": "Sohbet", "Conversation": "Sohbet",
"Permalink": "Kalıcı bağlantı",
"Certificate_password": "Sertifika Şifresi", "Certificate_password": "Sertifika Şifresi",
"Clear_cache": "Yerel sunucu önbelleğini temizleyin", "Clear_cache": "Yerel sunucu önbelleğini temizleyin",
"Clear_cache_loading": "Önbellek temizleniyor.", "Clear_cache_loading": "Önbellek temizleniyor.",
@ -240,6 +239,7 @@
"Forward_to_user": "Kullanıcıya İlet", "Forward_to_user": "Kullanıcıya İlet",
"Full_table": "Tam tabloyu görmek için tıklayın", "Full_table": "Tam tabloyu görmek için tıklayın",
"Generate_New_Link": "Yeni Bağlantı Oluştur", "Generate_New_Link": "Yeni Bağlantı Oluştur",
"Get_link": "Bağlantıyı Al",
"Hide_System_Messages": "Sistem İletilerını Gizle", "Hide_System_Messages": "Sistem İletilerını Gizle",
"Hide_type_messages": "\"{{type}}\" iletilerini gizle", "Hide_type_messages": "\"{{type}}\" iletilerini gizle",
"How_It_Works": "Nasıl Çalışır", "How_It_Works": "Nasıl Çalışır",

View File

@ -155,7 +155,6 @@
"Copied_to_clipboard": "复制到剪贴板", "Copied_to_clipboard": "复制到剪贴板",
"Copy": "复制", "Copy": "复制",
"Conversation": "对话", "Conversation": "对话",
"Permalink": "永久链接",
"Certificate_password": "凭证密码", "Certificate_password": "凭证密码",
"Clear_cache": "清除本机资料", "Clear_cache": "清除本机资料",
"Clear_cache_loading": "清除快取", "Clear_cache_loading": "清除快取",

View File

@ -156,7 +156,6 @@
"Copied_to_clipboard": "複製到剪貼簿", "Copied_to_clipboard": "複製到剪貼簿",
"Copy": "複製", "Copy": "複製",
"Conversation": "對話", "Conversation": "對話",
"Permalink": "永久連結",
"Certificate_password": "憑證密碼", "Certificate_password": "憑證密碼",
"Clear_cache": "清除本機資料", "Clear_cache": "清除本機資料",
"Clear_cache_loading": "清除快取", "Clear_cache_loading": "清除快取",
@ -241,6 +240,7 @@
"Forward_to_user": "轉發給使用者", "Forward_to_user": "轉發給使用者",
"Full_table": "點擊以查看完整表格", "Full_table": "點擊以查看完整表格",
"Generate_New_Link": "產生新的連結", "Generate_New_Link": "產生新的連結",
"Get_link": "取得連結",
"Hide_System_Messages": "隱藏系統訊息", "Hide_System_Messages": "隱藏系統訊息",
"Hide_type_messages": "隱藏 '{{type}}' 訊息", "Hide_type_messages": "隱藏 '{{type}}' 訊息",
"How_It_Works": "運作方式", "How_It_Works": "運作方式",

View File

@ -298,7 +298,7 @@ describe('Room screen', () => {
}); });
describe('Message', () => { describe('Message', () => {
it('should copy permalink', async () => { it('should copy link', async () => {
await element(by[textMatcher](`${data.random}message`)) await element(by[textMatcher](`${data.random}message`))
.atIndex(0) .atIndex(0)
.longPress(); .longPress();
@ -307,7 +307,7 @@ describe('Room screen', () => {
.withTimeout(2000); .withTimeout(2000);
await expect(element(by.id('action-sheet-handle'))).toBeVisible(); await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5); 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 // TODO: test clipboard
}); });
it('should copy message', async () => { it('should copy message', async () => {