Skip to content
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
10 changes: 6 additions & 4 deletions app/lib/server/functions/notifications/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ import { settings } from '../../../../settings';
* @param {object} message the message to be parsed
*/
export function parseMessageTextPerUser(messageText, message, receiver) {
if (!message.msg && message.attachments && message.attachments[0]) {
const lng = receiver.language || settings.get('Language') || 'en';
const lng = receiver.language || settings.get('Language') || 'en';

if (settings.get('Push_request_content_from_server')) {
return TAPi18n.__('You_have_a_new_message', { lng });
}

if (!message.msg && message.attachments && message.attachments[0]) {
return message.attachments[0].image_type ? TAPi18n.__('User_uploaded_image', { lng }) : TAPi18n.__('User_uploaded_file', { lng });
}

if (message.msg && message.t === 'e2e') {
const lng = receiver.language || settings.get('Language') || 'en';

return TAPi18n.__('Encrypted_message', { lng });
}

Expand Down
18 changes: 7 additions & 11 deletions app/push-notifications/server/lib/PushNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,23 @@ export class PushNotification {
}

getNotificationConfig({ rid, uid: userId, mid: messageId, roomName, username, message, payload, badge = 1, category, idOnly = false }) {
let title;
if (roomName && roomName !== '') {
title = `${ roomName }`;
message = `${ username }: ${ message }`;
} else {
title = `${ username }`;
}
const title = idOnly ? '' : roomName || username;

// message is being redacted already by 'parseMessageTextPerUser' if idOnly is true
const text = !idOnly && roomName !== '' ? `${ username }: ${ message }` : message;

const config = {
from: 'push',
badge,
sound: 'default',
priority: 10,
title: idOnly ? '' : title,
text: idOnly ? ' ' : message,
title,
text,
payload: {
host: Meteor.absoluteUrl(),
...idOnly || { rid },
messageId,
notificationType: idOnly ? 'message-id-only' : 'message',
...idOnly || payload,
...idOnly || { rid, ...payload },
},
userId,
notId: this.getNotificationId(rid),
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3924,6 +3924,7 @@
"You_can_use_an_emoji_as_avatar": "You can also use an emoji as an avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "You can use webhooks to easily integrate Omnichannel with your CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "You can't leave a omnichannel room. Please, use the close button.",
"You_have_a_new_message": "You have a new message",
"You_have_been_muted": "You have been muted and cannot speak in this room",
"You_have_n_codes_remaining": "You have __number__ codes remaining.",
"You_have_not_verified_your_email": "You have not verified your email.",
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-i18n/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3447,6 +3447,7 @@
"You_can_use_an_emoji_as_avatar": "Você também pode usar um emoji como um avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Você pode usar webhooks para integrar facilmente o Omnichannel com seu CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Você não pode sair de uma sala de omnichannel. Por favor, use o botão de fechar sala.",
"You_have_a_new_message": "Nova mensagem",
"You_have_been_muted": "Você foi silenciado e não pode falar nesta sala",
"You_have_n_codes_remaining": "Você tem __number__ codes restantes.",
"You_have_not_verified_your_email": "Você ainda não verificou o seu e-mail.",
Expand Down