Ability to disable comments notifications

pull/1/head
yflory 5 years ago
parent 3d22a5e95a
commit 0cbe14acf5

@ -534,9 +534,10 @@ define([
var msg = data.msg; var msg = data.msg;
var hash = data.hash; var hash = data.hash;
var content = msg.content; var content = msg.content;
// content.channel
//if (isMuted(ctx, data)) { return void cb(true); } if (Util.find(ctx.store.proxy, ['settings', 'pad', 'disableNotif'])) {
return void cb(true);
}
var channel = content.channel; var channel = content.channel;
if (!channel) { return void cb(true); } if (!channel) { return void cb(true); }

@ -78,6 +78,7 @@ define([
'pad': [ 'pad': [
'cp-settings-pad-width', 'cp-settings-pad-width',
'cp-settings-pad-spellcheck', 'cp-settings-pad-spellcheck',
'cp-settings-pad-notif',
], ],
'code': [ 'code': [
'cp-settings-code-indent-unit', 'cp-settings-code-indent-unit',
@ -1275,6 +1276,38 @@ define([
return $div; return $div;
}; };
// XXX Messages.settings_padNotifTitle
// XXX Messages.settings_padNotifHint
// XXX Messages.settings_padNotifCheckbox ("disable comments notifications")
Messages.settings_padNotifTitle = "Comments notifications"; // XXX
Messages.settings_padNotifHint = "Block notifications when someone replies to one of your comments"; // XXX
Messages.settings_padNotifCheckbox = "Disable comment notifications";
makeBlock('pad-notif', function (cb) {
var $cbox = $(UI.createCheckbox('cp-settings-pad-notif',
Messages.settings_padNotifCheckbox,
false, { label: {class: 'noTitle'} }));
var spinner = UI.makeSpinner($cbox);
// Checkbox: "Enable safe links"
var $checkbox = $cbox.find('input').on('change', function () {
spinner.spin();
var val = $checkbox.is(':checked');
common.setAttribute(['pad', 'disableNotif'], val, function () {
spinner.done();
});
});
common.getAttribute(['pad', 'disableNotif'], function (e, val) {
if (e) { return void console.error(e); }
if (val === true) {
$checkbox.attr('checked', 'checked');
}
});
cb($cbox);
}, true);
// Code settings // Code settings
create['code-indent-unit'] = function () { create['code-indent-unit'] = function () {

Loading…
Cancel
Save