Improve mute/unmute process
This commit is contained in:
@@ -3803,20 +3803,10 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
var modal;
|
||||
var mute = UIElements.createMuteButton(common, msg.content, function () {
|
||||
// Mute = auto-reject friend request
|
||||
var $modal = modal && $(modal) && $(modal).closest('div.alertify');
|
||||
if ($modal && $modal.length && $modal[0].closeModal) {
|
||||
$modal[0].closeModal(function () {});
|
||||
}
|
||||
return void todo(false); // XXX false is reject. We can also "dismiss"...
|
||||
});
|
||||
var content = h('div.cp-share-modal', [
|
||||
setHTML(h('p'), text),
|
||||
h('p', mute)
|
||||
]);
|
||||
modal = UI.proposal(content, todo);
|
||||
UI.proposal(content, todo);
|
||||
};
|
||||
|
||||
UIElements.displayAddOwnerModal = function (common, data) {
|
||||
@@ -4158,27 +4148,5 @@ define([
|
||||
UI.proposal(div, todo);
|
||||
};
|
||||
|
||||
UIElements.createMuteButton = function (common, data, cb) {
|
||||
cb = cb || function () {};
|
||||
var button = h('i.fa.fa-bell-slash-o', {
|
||||
title: Messages.notifications_muteUserTitle
|
||||
});
|
||||
var module = common.makeUniversal('messenger');
|
||||
$(button).click(function () {
|
||||
UI.confirm(Messages.notifications_muteUserConfirm, function (yes) {
|
||||
if (!yes) { return; }
|
||||
module.execCommand('MUTE_USER', {
|
||||
curvePublic: data.curvePublic,
|
||||
name: data.displayName || data.name,
|
||||
avatar: data.avatar
|
||||
}, function (e) {
|
||||
cb(e);
|
||||
if (e) { return void UI.warn(Messages.error); }
|
||||
});
|
||||
});
|
||||
});
|
||||
return button;
|
||||
};
|
||||
|
||||
return UIElements;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user