Add unfriend, mute and unmute buttons in profile

This commit is contained in:
yflory
2019-12-11 13:28:07 +01:00
parent 11ddb96422
commit aa8dd95310
4 changed files with 68 additions and 10 deletions

View File

@@ -4174,7 +4174,6 @@ define([
}, function (e) {
cb(e);
if (e) { return void UI.warn(Messages.error); }
UI.log(Messages.success);
});
});
});

View File

@@ -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]) {

View File

@@ -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);