From b98a5fc1661a19cc2634dc089f3806bba667f158 Mon Sep 17 00:00:00 2001 From: Evan Theurer Date: Tue, 12 May 2015 12:11:44 +0200 Subject: [PATCH] Correctly filter who is being added as a contact. Update scope when contact is added or removed. --- static/js/directives/chat.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/js/directives/chat.js b/static/js/directives/chat.js index d2505982..2ccfb1d4 100644 --- a/static/js/directives/chat.js +++ b/static/js/directives/chat.js @@ -345,7 +345,12 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro contacts.remove(buddy.contact.Userid); }; subscope.updateContactStatus = function(event, data) { + var userid = buddy && buddy.session && buddy.session.Userid; + if (userid !== data.Userid) { + return; + } subscope.isContact = event.type === "contactadded"; + safeApply(subscope); }; contacts.e.on("contactadded", subscope.updateContactStatus); contacts.e.on("contactremoved", subscope.updateContactStatus);