From 78c5962ff06ece24a2c7923f433d49584f840983 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Tue, 15 Jan 2019 15:29:04 +1100 Subject: [PATCH 1/4] Fixed contact not being added after friend request is accepted. --- js/conversation_controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/conversation_controller.js b/js/conversation_controller.js index 816c3c4f4..37c1eb6a6 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -82,7 +82,7 @@ initialize() { this.on('change:timestamp change:name change:number change:profileName', this.sort); - this.listenTo(conversations, 'add change:active_at', this.addActive); + this.listenTo(conversations, 'add change:active_at change:friendRequestStatus', this.addActive); this.listenTo(conversations, 'reset', () => this.reset([])); this.collator = new Intl.Collator(); From 7341471ce7276630982649bdc93b14d90a78e2c6 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Tue, 15 Jan 2019 15:41:14 +1100 Subject: [PATCH 2/4] Fix up notification. --- js/models/conversations.js | 1 + js/notifications.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index 7a6963abb..af8ce2409 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -2166,6 +2166,7 @@ messageSentAt: Date.now(), title: i18n(title), isFriendRequest: true, + friendRequestType: type, }); }, diff --git a/js/notifications.js b/js/notifications.js index 4a3d0bb59..97c1766bf 100644 --- a/js/notifications.js +++ b/js/notifications.js @@ -100,8 +100,15 @@ const last = this.last().toJSON(); switch (userSetting) { case SettingNames.COUNT: - title = 'Signal'; - message = newMessageCountLabel; + title = 'Loki Messenger'; + + if (messagesNotificationCount > 0) { + message = newMessageCountLabel; + } else if (last.isFriendRequest) { + message = `Friend request ${last.friendRequestType}`; + } else { + message = '-'; + } break; case SettingNames.NAME: { const lastMessageTitle = last.title; From e69999a7908909e417b6be6fc0ebf3eef325f5aa Mon Sep 17 00:00:00 2001 From: Mikunj Date: Tue, 15 Jan 2019 15:46:57 +1100 Subject: [PATCH 3/4] Fix condition order. --- js/notifications.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/notifications.js b/js/notifications.js index 97c1766bf..da19f056e 100644 --- a/js/notifications.js +++ b/js/notifications.js @@ -102,10 +102,10 @@ case SettingNames.COUNT: title = 'Loki Messenger'; - if (messagesNotificationCount > 0) { - message = newMessageCountLabel; - } else if (last.isFriendRequest) { + if (last.isFriendRequest) { message = `Friend request ${last.friendRequestType}`; + } else if (messagesNotificationCount > 0) { + message = newMessageCountLabel; } else { message = '-'; } From f527e2a2ff0cae65839d3c17683aa44e7c68f955 Mon Sep 17 00:00:00 2001 From: Mikunj Varsani Date: Wed, 16 Jan 2019 13:33:41 +1100 Subject: [PATCH 4/4] Update js/notifications.js --- js/notifications.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/notifications.js b/js/notifications.js index da19f056e..5295b2a96 100644 --- a/js/notifications.js +++ b/js/notifications.js @@ -107,7 +107,7 @@ } else if (messagesNotificationCount > 0) { message = newMessageCountLabel; } else { - message = '-'; + return; } break; case SettingNames.NAME: {