mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
prompt admins to flush cache when relevant
also remove some accidentally duplicated code
This commit is contained in:
parent
b83e8600f4
commit
87f6f97cca
@ -294,81 +294,6 @@ define([
|
||||
return $div;
|
||||
};
|
||||
|
||||
create['registration'] = function () {
|
||||
var key = 'registration';
|
||||
var $div = makeBlock(key); // Msg.admin_registrationHint, .admin_registrationTitle, .admin_registrationButton
|
||||
|
||||
var state = APP.instanceStatus.restrictRegistration;
|
||||
var $cbox = $(UI.createCheckbox('cp-settings-' + key,
|
||||
Messages.admin_registrationTitle,
|
||||
state, { label: { class: 'noTitle' } }));
|
||||
var spinner = UI.makeSpinner($cbox);
|
||||
var $checkbox = $cbox.find('input').on('change', function() {
|
||||
spinner.spin();
|
||||
var val = $checkbox.is(':checked') || false;
|
||||
$checkbox.attr('disabled', 'disabled');
|
||||
sFrameChan.query('Q_ADMIN_RPC', {
|
||||
cmd: 'ADMIN_DECREE',
|
||||
data: ['RESTRICT_REGISTRATION', [val]]
|
||||
}, function (e, response) {
|
||||
if (e || response.error) {
|
||||
UI.warn(Messages.error);
|
||||
console.error(e, response);
|
||||
}
|
||||
APP.updateStatus(function () {
|
||||
spinner.done();
|
||||
state = APP.instanceStatus.restrictRegistration;
|
||||
$checkbox[0].checked = state;
|
||||
$checkbox.removeAttr('disabled');
|
||||
});
|
||||
});
|
||||
});
|
||||
$cbox.appendTo($div);
|
||||
|
||||
return $div;
|
||||
};
|
||||
|
||||
Messages.admin_disableembedsTitle = "Disable remote embedding"; // XXX
|
||||
Messages.admin_disableembedsHint = "Remove options to embed pads and media-tags hosted on third party websites from sharing menus."; // XXX
|
||||
//Messages.admin_disableembedsButton = "admin_disableembedsButton";
|
||||
Messages.admin_cacheEvictionRequired = "XXX YOU MAY NEED TO USE THE 'FLUSH CACHE' BUTTON FOR THIS TO TAKE EFFECT"; // XXX
|
||||
|
||||
create['disableembeds'] = function () {
|
||||
var key = 'disableembeds';
|
||||
var $div = makeBlock(key);
|
||||
// Msg.admin_disableembedsHint, .admin_disableembedsTitle, .admin_disableembedsButton
|
||||
|
||||
var state = APP.instanceStatus.disableEmbedding;
|
||||
var $cbox = $(UI.createCheckbox('cp-settings-' + key,
|
||||
Messages.admin_disableembedsTitle,
|
||||
state, { label: { class: 'noTitle' } }));
|
||||
var spinner = UI.makeSpinner($cbox);
|
||||
var $checkbox = $cbox.find('input').on('change', function() {
|
||||
spinner.spin();
|
||||
var val = $checkbox.is(':checked') || false;
|
||||
$checkbox.attr('disabled', 'disabled');
|
||||
sFrameChan.query('Q_ADMIN_RPC', {
|
||||
cmd: 'ADMIN_DECREE',
|
||||
data: ['DISABLE_EMBEDDING', [val]]
|
||||
}, function (e, response) {
|
||||
if (e || response.error) {
|
||||
UI.warn(Messages.error);
|
||||
console.error(e, response);
|
||||
}
|
||||
APP.updateStatus(function () {
|
||||
spinner.done();
|
||||
state = APP.instanceStatus.disableEmbedding;
|
||||
$checkbox[0].checked = state;
|
||||
$checkbox.removeAttr('disabled');
|
||||
UI.alert(Messages.admin_cacheEvictionRequired);
|
||||
});
|
||||
});
|
||||
});
|
||||
$cbox.appendTo($div);
|
||||
|
||||
return $div;
|
||||
};
|
||||
|
||||
var makeAdminCheckbox = function (data) {
|
||||
return function () {
|
||||
var state = data.getState();
|
||||
@ -396,8 +321,17 @@ define([
|
||||
};
|
||||
};
|
||||
|
||||
// Msg.admin_registrationHint, .admin_registrationTitle, .admin_registrationButton
|
||||
create['registration'] = makeAdminCheckbox({
|
||||
Messages.admin_cacheEvictionRequired = "Your server's internal state has been updated, but you may need to use the 'flush cache' button for clients to experience the intended effect."; // XXX
|
||||
Messages.admin_reviewCheckupNotice = "It is also recommended that you review this instance's checkup page to confirm that it is configured correctly."; // XXX
|
||||
var flushCacheNotice = function () {
|
||||
UI.alert(h('span', [
|
||||
h('p', Messages.admin_cacheEvictionRequired),
|
||||
h('p', Messages.admin_reviewCheckupNotice),
|
||||
]));
|
||||
};
|
||||
|
||||
// Msg.admin_registrationHint, .admin_registrationTitle
|
||||
create['registration'] = makeAdminCheckbox({ // XXX
|
||||
key: 'registration',
|
||||
getState: function () {
|
||||
return APP.instanceStatus.restrictRegistration;
|
||||
@ -413,6 +347,32 @@ define([
|
||||
}
|
||||
APP.updateStatus(function () {
|
||||
setState(APP.instanceStatus.restrictRegistration);
|
||||
flushCacheNotice();
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Messages.admin_disableembedsTitle = "Disable remote embedding"; // XXX
|
||||
Messages.admin_disableembedsHint = "Remove options to embed pads and media-tags hosted on third party websites from sharing menus."; // XXX
|
||||
// Msg.admin_disableembedsHint, .admin_disableembedsTitle
|
||||
create['disableembeds'] = makeAdminCheckbox({
|
||||
key: 'disableembeds',
|
||||
getState: function () {
|
||||
return APP.instanceStatus.disableEmbedding;
|
||||
},
|
||||
query: function (val, setState) {
|
||||
sFrameChan.query('Q_ADMIN_RPC', {
|
||||
cmd: 'ADMIN_DECREE',
|
||||
data: ['DISABLE_EMBEDDING', [val]]
|
||||
}, function (e, response) {
|
||||
if (e || response.error) {
|
||||
UI.warn(Messages.error);
|
||||
console.error(e, response);
|
||||
}
|
||||
APP.updateStatus(function () {
|
||||
setState(APP.instanceStatus.disableEmbedding);
|
||||
flushCacheNotice();
|
||||
});
|
||||
});
|
||||
},
|
||||
@ -1999,7 +1959,6 @@ define([
|
||||
Messages.admin_bytesWrittenTitle = "Disk performance measurement window"; // XXX
|
||||
Messages.admin_bytesWrittenHint = "If you have enabled disk performance measurements then the duration of the window can be configured below."; // XXX
|
||||
Messages.admin_bytesWrittenDuration = "Duration of the window in milliseconds: {0}"; // XXX
|
||||
//Messages.admin_defaultDuration = "admin_defaultDuration"; // XXX
|
||||
Messages.admin_setDuration = "Set duration"; // XXX
|
||||
|
||||
var isPositiveInteger = function (n) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user