handle unfriends in ui
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user