Add notifications when removed from owners or pending_owners

This commit is contained in:
yflory
2019-09-02 18:46:52 +02:00
parent d190b8acd0
commit 4708d59a65
4 changed files with 82 additions and 16 deletions

View File

@@ -203,25 +203,53 @@ define([
if (ed === edPublic) { me = true; }
return ed;
}).filter(function (x) { return x; });
// Send the command
var send = function () {
NThen(function (waitFor) {
var msg = me ?
"Are you sure? You're going to give up on your rights, this can't be undone!" :
"Are you sure?"; // XXX
UI.confirm(msg, waitFor(function (yes) {
if (!yes) {
waitFor.abort();
return;
}
}));
}).nThen(function (waitFor) {
// Send the command
sframeChan.query('Q_SET_PAD_METADATA', {
channel: channel,
command: pending ? 'RM_PENDING_OWNERS' : 'RM_OWNERS',
value: toRemove
}, function (err, res) {
}, waitFor(function (err, res) {
err = err || (res && res.error);
if (err) { return void UI.warn('ERROR' + err); } // XXX
redrawAll();
if (err) {
waitFor.abort();
return void UI.warn('ERROR' + err);
} // XXX
UI.log('DONE'); // XXX
}));
}).nThen(function (waitFor) {
sel.forEach(function (el) {
var friend = friends[$(el).attr('data-curve')];
if (!friend) { return; }
common.mailbox.sendTo("RM_OWNER", {
channel: channel,
title: data.title,
pending: pending,
user: {
displayName: user.name,
avatar: user.avatar,
profile: user.profile,
notifications: user.notifications,
curvePublic: user.curvePublic,
edPublic: priv.edPublic
}
}, {
channel: friend.notifications,
curvePublic: friend.curvePublic
}, waitFor());
});
};
var msg = me ?
"Are you sure? You're going to give up on your rights, this can't be undone!" :
"Are you sure?"; // XXX
UI.confirm(msg, function (yes) {
if (!yes) { return; }
send();
}).nThen(function () {
redrawAll();
});
});
$div.append(h('p', removeButton));