Skip to content

Commit

Permalink
Check if lastMessage has an attachment and show "User sent an attachm…
Browse files Browse the repository at this point in the history
…ent" at RoomsList
  • Loading branch information
diegolmello committed Oct 26, 2018
1 parent 6657ad2 commit 69d6410
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export default {
User_is_no_longer_role_by_: '{{user}} is no longer {{role}} by {{userBy}}',
User_muted_by: 'User {{userMuted}} muted 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_was_set_role_by_: '{{user}} was set {{role}} by {{userBy}}',
Username_is_empty: 'Username is empty',
Expand All @@ -343,7 +344,7 @@ export default {
You_can_search_using_RegExp_eg: 'You can search using RegExp. e.g. `/^text$/i`',
You_colon: 'You: ',
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',
Your_server: 'Your server'
You: 'You',
You_will_not_be_able_to_recover_this_message: 'You will not be able to recover this message!'
};
6 changes: 4 additions & 2 deletions app/i18n/locales/pt-BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export default {
User_is_no_longer_role_by_: '{{user}} não pertence mais à {{role}} por {{userBy}}',
User_muted_by: 'User {{userMuted}} muted 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_was_set_role_by_: '{{user}} foi definido como {{role}} por {{userBy}}',
Username_is_empty: 'Usuário está vazio',
Expand All @@ -340,6 +341,7 @@ export default {
You_can_search_using_RegExp_eg: 'Você pode pesquisar usando expressões regulares, por exemplo `/^text$/i`',
You_colon: 'Você: ',
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!'
};
11 changes: 10 additions & 1 deletion app/presentation/RoomItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,17 @@ export default class RoomItem extends React.Component {
}

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');
} else if (type !== 'd') {
prefix = `${ lastMessage.u.username }: `;
Expand Down

0 comments on commit 69d6410

Please sign in to comment.