mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Fix notification display after friend request is accepted.
This commit is contained in:
parent
4b4a2b1bf2
commit
a12ed61cc1
2 changed files with 8 additions and 4 deletions
|
@ -2165,6 +2165,7 @@
|
|||
message: i18n(message, conversation.getTitle()),
|
||||
messageSentAt: Date.now(),
|
||||
title: i18n(title),
|
||||
isFriendRequest: true,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -86,12 +86,15 @@
|
|||
let message;
|
||||
let iconUrl;
|
||||
|
||||
// The number of notifications excluding friend request
|
||||
const messagesNotificationCount = this.models.filter(n => !n.get('isFriendRequest')).length;
|
||||
|
||||
// NOTE: i18n has more complex rules for pluralization than just
|
||||
// distinguishing between zero (0) and other (non-zero),
|
||||
// e.g. Russian:
|
||||
// http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html
|
||||
const newMessageCountLabel = `${numNotifications} ${
|
||||
numNotifications === 1 ? i18n('newMessage') : i18n('newMessages')
|
||||
const newMessageCountLabel = `${messagesNotificationCount} ${
|
||||
messagesNotificationCount === 1 ? i18n('newMessage') : i18n('newMessages')
|
||||
}`;
|
||||
|
||||
const last = this.last().toJSON();
|
||||
|
@ -105,7 +108,7 @@
|
|||
title = newMessageCountLabel;
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
iconUrl = last.iconUrl;
|
||||
if (numNotifications === 1) {
|
||||
if (last.isFriendRequest || messagesNotificationCount === 1) {
|
||||
message = `${i18n('notificationFrom')} ${lastMessageTitle}`;
|
||||
} else {
|
||||
message = `${i18n(
|
||||
|
@ -115,7 +118,7 @@
|
|||
break;
|
||||
}
|
||||
case SettingNames.MESSAGE:
|
||||
if (numNotifications === 1) {
|
||||
if (last.isFriendRequest || messagesNotificationCount === 1) {
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
title = last.title;
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
|
|
Loading…
Reference in a new issue