handle unfriends in ui

pull/1/head
ansuz 7 years ago
parent 5c2b58e703
commit 6314487d98

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

Loading…
Cancel
Save