add currentSetting to ReactiveCache

This commit is contained in:
Martin Filser 2022-12-13 23:20:04 +01:00
parent c6ee58ef88
commit b7dbeba7de
13 changed files with 59 additions and 55 deletions

View file

@ -42,10 +42,6 @@ BlazeComponent.extendComponent({
}
},
currentSetting() {
return Settings.findOne();
},
boards() {
return Boards.find(
{
@ -60,16 +56,16 @@ BlazeComponent.extendComponent({
},
toggleForgotPassword() {
this.setLoading(true);
const forgotPasswordClosed = this.currentSetting().disableForgotPassword;
Settings.update(Settings.findOne()._id, {
const forgotPasswordClosed = Utils.getCurrentSetting().disableForgotPassword;
Settings.update(Utils.getCurrentSetting()._id, {
$set: { disableForgotPassword: !forgotPasswordClosed },
});
this.setLoading(false);
},
toggleRegistration() {
this.setLoading(true);
const registrationClosed = this.currentSetting().disableRegistration;
Settings.update(Settings.findOne()._id, {
const registrationClosed = Utils.getCurrentSetting().disableRegistration;
Settings.update(Utils.getCurrentSetting()._id, {
$set: { disableRegistration: !registrationClosed },
});
this.setLoading(false);
@ -165,7 +161,7 @@ BlazeComponent.extendComponent({
.trim();
const from = this.checkField('#mail-server-from');
const tls = $('#mail-server-tls.is-checked').length > 0;
Settings.update(Settings.findOne()._id, {
Settings.update(Utils.getCurrentSetting()._id, {
$set: {
'mailServer.host': host,
'mailServer.port': port,
@ -245,7 +241,7 @@ BlazeComponent.extendComponent({
const spinnerName = $('#spinnerName').val();
try {
Settings.update(Settings.findOne()._id, {
Settings.update(Utils.getCurrentSetting()._id, {
$set: {
productName,
hideLogo: hideLogoChange,