From e28aba5a599a3524e5ba40d07fb8c935dd8b0e8e Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 28 Jul 2016 10:35:43 +0000 Subject: [PATCH] Fixes #645. When accepting a contact request... the contact didn't appear under the pending contacts list. --- docs/CHANGES.md | 2 ++ src/converse-rosterview.js | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 9e6389c40..833611c2d 100755 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -7,6 +7,8 @@ use it. [jcbrand] - Mention someone in your chat room message by clicking on their name in the occupants list. [jcbrand] +- #645 When accepting a contact request, the contact didn't appear in the + pending contacts group. [jcbrand] ## 1.0.4 (2016-07-26) diff --git a/src/converse-rosterview.js b/src/converse-rosterview.js index 2e4757791..09953c570 100644 --- a/src/converse-rosterview.js +++ b/src/converse-rosterview.js @@ -883,7 +883,15 @@ onContactRequestChange: function (contact) { if ((this.model.get('name') === HEADER_REQUESTING_CONTACTS) && !contact.get('requesting')) { - this.model.contacts.remove(contact.get('id')); + /* We suppress events, otherwise the remove event will + * also cause the contact's view to be removed from the + * "Pending Contacts" group. + */ + this.model.contacts.remove(contact.get('id'), {'silent': true}); + // Since we suppress events, we make sure the view and + // contact are removed from this group. + this.get(contact.get('id')).remove(); + this.onRemove(contact); } },