Fix setting friend requests incorrectly.

pull/33/head
Mikunj 7 years ago
parent 5e48efc935
commit f4b60c3ff6

@ -498,14 +498,19 @@
this.updateTextInputState(); this.updateTextInputState();
const friendRequestStatus = this.getFriendRequestStatus(); const friendRequestStatus = this.getFriendRequestStatus();
if (friendRequestStatus) {
friendRequestStatus.allowSending = true; friendRequestStatus.allowSending = true;
this.set({ friendRequestStatus }); this.set({ friendRequestStatus });
await window.Signal.Data.updateConversation(this.id, this.attributes, { await window.Signal.Data.updateConversation(this.id, this.attributes, {
Conversation: Whisper.Conversation, Conversation: Whisper.Conversation,
}); });
}
}, },
async onFriendRequestSent() { async onFriendRequestSent() {
// Don't bother setting the friend request if we have already exchanged keys
if (this.isKeyExchangeCompleted()) return;
const friendRequestLockDuration = 72; // hours const friendRequestLockDuration = 72; // hours
let friendRequestStatus = this.getFriendRequestStatus(); let friendRequestStatus = this.getFriendRequestStatus();
@ -1102,7 +1107,7 @@
this.trigger('disable:input', true); this.trigger('disable:input', true);
this.trigger('change:placeholder', 'disabled'); this.trigger('change:placeholder', 'disabled');
return; return;
} else if (outgoing.length > 0) { } else {
// Tell the user to introduce themselves // Tell the user to introduce themselves
this.trigger('disable:input', false); this.trigger('disable:input', false);
this.trigger('change:placeholder', 'friend-request'); this.trigger('change:placeholder', 'friend-request');

@ -965,6 +965,7 @@ MessageReceiver.prototype.extend({
); );
} }
await conversation.onFriendRequestAccepted();
} }
console.log(`Friend request for ${pubKey} was ${message.friendStatus}`, message); console.log(`Friend request for ${pubKey} was ${message.friendStatus}`, message);
}, },

Loading…
Cancel
Save