From aa8dd95310ee8d2c411936d58abe4bd9e4bcd62b Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 11 Dec 2019 13:28:07 +0100 Subject: [PATCH] Add unfriend, mute and unmute buttons in profile --- www/common/common-ui-elements.js | 1 - www/common/messenger-ui.js | 4 +- www/common/outer/messenger.js | 7 ++-- www/profile/inner.js | 66 ++++++++++++++++++++++++++++++-- 4 files changed, 68 insertions(+), 10 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 992428899..459f4319d 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -4174,7 +4174,6 @@ define([ }, function (e) { cb(e); if (e) { return void UI.warn(Messages.error); } - UI.log(Messages.success); }); }); }); diff --git a/www/common/messenger-ui.js b/www/common/messenger-ui.js index 9ce795f4e..f157f2a08 100644 --- a/www/common/messenger-ui.js +++ b/www/common/messenger-ui.js @@ -542,7 +542,7 @@ define([ var friend = contactsData[curvePublic] || friendData; var muteBox = UI.createCheckbox('cp-contacts-mute', Messages.contacts_mute, false); var content = h('div', [ - h('p', Messages._getKey('contacts_confirmRemove', [Util.fixHTML(friend.name)])), + UI.setHTML(h('p'), Messages._getKey('contacts_confirmRemove', [Util.fixHTML(friend.name)])), muteBox ]); UI.confirm(content, function (yes) { @@ -553,7 +553,7 @@ define([ // 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) - }, undefined, true); + }); }); if (friendData.avatar && avatars[friendData.avatar]) { diff --git a/www/common/outer/messenger.js b/www/common/outer/messenger.js index 5d4c67135..4d5e42973 100644 --- a/www/common/outer/messenger.js +++ b/www/common/outer/messenger.js @@ -428,20 +428,21 @@ define([ } var channel = ctx.channels[data.channel]; - if (!channel) { - return void cb({error: "NO_SUCH_CHANNEL"}); - } // Unfriend with mailbox if (ctx.store.mailbox && data.curvePublic && data.notifications) { Messaging.removeFriend(ctx.store, curvePublic, function (obj) { if (obj && obj.error) { return void cb({error:obj.error}); } + ctx.updateMetadata(); cb(obj); }); return; } // Unfriend with channel + if (!channel) { + return void cb({error: "NO_SUCH_CHANNEL"}); + } try { var msg = [Types.unfriend, proxy.curvePublic, +new Date()]; var msgStr = JSON.stringify(msg); diff --git a/www/profile/inner.js b/www/profile/inner.js index 4635743f6..301fa0808 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -178,9 +178,6 @@ define([ var addFriendRequest = function ($container) { if (!APP.readOnly || !APP.common.isLoggedIn()) { return; } - APP.$friend = $('