mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Simplify save settings
This commit is contained in:
parent
fc60dc94fc
commit
f4d98130a5
12 changed files with 66 additions and 162 deletions
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
|||
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { defaultOptionsAfterRender } from 'Common/Utils';
|
||||
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
|
||||
import { addObservablesTo } from 'External/ko';
|
||||
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
||||
|
|
@ -22,10 +22,9 @@ export class ContactsAdminSettings extends AbstractViewSettings {
|
|||
this.testContactsErrorMessage('');
|
||||
});
|
||||
|
||||
addObservablesTo(this, {
|
||||
enableContacts: !!SettingsGet('ContactsEnable'),
|
||||
contactsSync: !!SettingsGet('ContactsSync'),
|
||||
this.addSettings(['ContactsEnable','ContactsSync']);
|
||||
|
||||
addObservablesTo(this, {
|
||||
testing: false,
|
||||
testContactsSuccess: false,
|
||||
testContactsError: false,
|
||||
|
|
@ -65,18 +64,6 @@ export class ContactsAdminSettings extends AbstractViewSettings {
|
|||
})
|
||||
.extend({ notify: 'always' });
|
||||
|
||||
addSubscribablesTo(this, {
|
||||
enableContacts: value =>
|
||||
Remote.saveConfig({
|
||||
ContactsEnable: value ? 1 : 0
|
||||
}),
|
||||
|
||||
contactsSync: value =>
|
||||
Remote.saveConfig({
|
||||
ContactsSync: value ? 1 : 0
|
||||
})
|
||||
})
|
||||
|
||||
decorateKoCommands(this, {
|
||||
testContactsCommand: self => self.contactsPdoDsn() && self.contactsPdoUser()
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue