Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if last message has an attachment and show "User sent an attachment" at rooms list #510

Merged
merged 1 commit into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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