diff --git a/www/contacts/messenger-ui.js b/www/contacts/messenger-ui.js index 1a7f15435..b2ce5cd9c 100644 --- a/www/contacts/messenger-ui.js +++ b/www/contacts/messenger-ui.js @@ -242,7 +242,13 @@ define([ var $status = find.inList(curvePublic).find('.status'); // FIXME this stopped working :( messenger.getStatus(curvePublic, function (e, online) { - if (e) { return void console.error(curvePublic, e); } + // if error maybe you shouldn't display this friend... + if (e) { + find.inList(curvePublic).hide(); + getChat(curvePublic).hide(); + + return void console.error(curvePublic, e); + } if (online) { return void $status .removeClass('offline').addClass('online'); @@ -286,6 +292,7 @@ define([ var removeFriend = function (curvePublic) { messenger.removeFriend(curvePublic, function (e, removed) { if (e) { return void console.error(e); } + find.inList(curvePublic).remove(); console.log(removed); }); }; @@ -319,7 +326,9 @@ define([ Cryptpad.fixHTML(data.displayName) ]), function (yes) { if (!yes) { return; } - removeFriend(curvePublic); + removeFriend(curvePublic, function (e) { + if (e) { return void console.error(e); } + }); // TODO remove friend from userlist ui // FIXME seems to trigger EJOINED from netflux-websocket (from server); // (tried to join a channel in which you were already present) @@ -400,6 +409,10 @@ define([ dataQuery(curvePublic) + ' div.sender').text(name).text(name); }); + messenger.on('unfriend', function (curvePublic) { + console.log(curvePublic); + }); + Cryptpad.onDisplayNameChanged(function () { messenger.checkNewFriends(); messenger.updateMyData();