From 2715e792680398f2296ba0c535c98b404a904c9f Mon Sep 17 00:00:00 2001 From: Mikunj Date: Mon, 10 Dec 2018 13:17:44 +1100 Subject: [PATCH] Fix conversation status not being reset upon conversation messages deletion. Fix incoming friend request not replacing old friend requests. Fixed incorrect function name. --- js/models/conversations.js | 6 ++++++ js/models/messages.js | 2 +- libtextsecure/outgoing_message.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index 2fc0b9480..5635bdfd0 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1876,6 +1876,12 @@ timestamp: null, active_at: null, }); + + // Reset our friend status if we're not friends + if (!this.isFriend()) { + this.set({ friendRequestStatus: FriendRequestStatusEnum.none }); + } + await window.Signal.Data.updateConversation(this.id, this.attributes, { Conversation: Whisper.Conversation, }); diff --git a/js/models/messages.js b/js/models/messages.js index 23ee2fb3c..f2735349f 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -1402,7 +1402,7 @@ message.set({ friendStatus: 'accepted' }); await conversation.onFriendRequestAccepted(); window.libloki.sendFriendRequestAccepted(message.get('source')); - } else if (conversation.isFriendRequestStatusNone()) { + } else if (!conversation.isFriend()) { await conversation.onFriendRequestReceived(); } } else { diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js index e32056d22..7de94ee32 100644 --- a/libtextsecure/outgoing_message.js +++ b/libtextsecure/outgoing_message.js @@ -121,7 +121,7 @@ OutgoingMessage.prototype = { } return builder.processPreKey(device).then(async () => { // TODO: only remove the keys that were used above! - await window.libloki.removePreKeyBundleForNumber(number); + await window.libloki.removeContactPreKeyBundle(number); return true; } ).catch(error => {