Check if lastMessage has an attachment and show "User sent an attachment" at RoomsList (#510)

This commit is contained in:
Diego Mello 2018-10-26 10:24:00 -03:00 committed by GitHub
parent 6657ad272e
commit 53014ce022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View File

@ -325,6 +325,7 @@ export default {
User_is_no_longer_role_by_: '{{user}} is no longer {{role}} by {{userBy}}', User_is_no_longer_role_by_: '{{user}} is no longer {{role}} by {{userBy}}',
User_muted_by: 'User {{userMuted}} muted by {{userBy}}', User_muted_by: 'User {{userMuted}} muted by {{userBy}}',
User_removed_by: 'User {{userRemoved}} removed by {{userBy}}', User_removed_by: 'User {{userRemoved}} removed by {{userBy}}',
User_sent_an_attachment: '{{user}} sent an attachment',
User_unmuted_by: 'User {{userUnmuted}} unmuted by {{userBy}}', User_unmuted_by: 'User {{userUnmuted}} unmuted by {{userBy}}',
User_was_set_role_by_: '{{user}} was set {{role}} by {{userBy}}', User_was_set_role_by_: '{{user}} was set {{role}} by {{userBy}}',
Username_is_empty: 'Username is empty', Username_is_empty: 'Username is empty',
@ -343,7 +344,7 @@ export default {
You_can_search_using_RegExp_eg: 'You can search using RegExp. e.g. `/^text$/i`', You_can_search_using_RegExp_eg: 'You can search using RegExp. e.g. `/^text$/i`',
You_colon: 'You: ', You_colon: 'You: ',
you_were_mentioned: 'you were mentioned', you_were_mentioned: 'you were mentioned',
You_will_not_be_able_to_recover_this_message: 'You will not be able to recover this message!',
you: 'you', you: 'you',
Your_server: 'Your server' You: 'You',
You_will_not_be_able_to_recover_this_message: 'You will not be able to recover this message!'
}; };

View File

@ -323,6 +323,7 @@ export default {
User_is_no_longer_role_by_: '{{user}} não pertence mais à {{role}} por {{userBy}}', User_is_no_longer_role_by_: '{{user}} não pertence mais à {{role}} por {{userBy}}',
User_muted_by: 'User {{userMuted}} muted por {{userBy}}', User_muted_by: 'User {{userMuted}} muted por {{userBy}}',
User_removed_by: 'Usuário {{userRemoved}} removido por {{userBy}}', User_removed_by: 'Usuário {{userRemoved}} removido por {{userBy}}',
User_sent_an_attachment: '{{user}} enviou um anexo',
User_unmuted_by: '{{userBy}} permitiu que {{userUnmuted}} fale na sala', User_unmuted_by: '{{userBy}} permitiu que {{userUnmuted}} fale na sala',
User_was_set_role_by_: '{{user}} foi definido como {{role}} por {{userBy}}', User_was_set_role_by_: '{{user}} foi definido como {{role}} por {{userBy}}',
Username_is_empty: 'Usuário está vazio', Username_is_empty: 'Usuário está vazio',
@ -340,6 +341,7 @@ export default {
You_can_search_using_RegExp_eg: 'Você pode pesquisar usando expressões regulares, por exemplo `/^text$/i`', You_can_search_using_RegExp_eg: 'Você pode pesquisar usando expressões regulares, por exemplo `/^text$/i`',
You_colon: 'Você: ', You_colon: 'Você: ',
you_were_mentioned: 'você foi mencionado', you_were_mentioned: 'você foi mencionado',
You_will_not_be_able_to_recover_this_message: 'Você não será capaz de recuperar essa mensagem!', you: 'você',
you: 'você' You: 'Você',
You_will_not_be_able_to_recover_this_message: 'Você não será capaz de recuperar essa mensagem!'
}; };

View File

@ -189,8 +189,17 @@ export default class RoomItem extends React.Component {
} }
let prefix = ''; let prefix = '';
const me = lastMessage.u.username === username;
if (lastMessage.u.username === username) { if (!lastMessage.msg && Object.keys(lastMessage.attachments).length > 0) {
if (me) {
return I18n.t('User_sent_an_attachment', { user: I18n.t('You') });
} else {
return I18n.t('User_sent_an_attachment', { user: lastMessage.u.username });
}
}
if (me) {
prefix = I18n.t('You_colon'); prefix = I18n.t('You_colon');
} else if (type !== 'd') { } else if (type !== 'd') {
prefix = `${ lastMessage.u.username }: `; prefix = `${ lastMessage.u.username }: `;