Restructure Capa

This commit is contained in:
the-djmaze 2022-02-24 12:22:27 +01:00
parent 5990addfef
commit e7c7b8ed53
15 changed files with 74 additions and 140 deletions

View file

@ -3,11 +3,10 @@ import { koComputable } from 'External/ko';
import { Notification } from 'Common/Enums';
import { FolderMetadataKeys } from 'Common/EnumsUser';
import { Settings } from 'Common/Globals';
import { SettingsCapa } from 'Common/Globals';
import { getNotification } from 'Common/Translator';
import { setFolder, getFolderFromCacheList, removeFolderFromCacheList } from 'Common/Cache';
import { Capa } from 'Common/Enums';
import { defaultOptionsAfterRender } from 'Common/Utils';
import { sortFolders } from 'Common/Folders';
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
@ -27,7 +26,7 @@ const folderForDeletion = ko.observable(null).askDeleteHelper();
export class FoldersUserSettings /*extends AbstractViewSettings*/ {
constructor() {
this.showKolab = koComputable(() => FolderUserStore.hasCapability('METADATA') && Settings.capa(Capa.Kolab));
this.showKolab = koComputable(() => FolderUserStore.hasCapability('METADATA') && SettingsCapa('Kolab'));
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
this.kolabTypeOptions = ko.observableArray();
let i18nFilter = key => i18n('SETTINGS_FOLDERS/TYPE_' + key);

View file

@ -3,7 +3,7 @@ import { koComputable } from 'External/ko';
import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { Capa, SaveSettingsStep } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import { SettingsCapa } from 'Common/Globals';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import { SettingsUserStore } from 'Stores/User/Settings';
@ -12,7 +12,7 @@ import Remote from 'Remote/User/Fetch';
export class SecurityUserSettings /*extends AbstractViewSettings*/ {
constructor() {
this.capaAutoLogout = Settings.capa(Capa.AutoLogout);
this.capaAutoLogout = SettingsCapa(Capa.AutoLogout);
this.autoLogout = SettingsUserStore.autoLogout;
this.autoLogoutTrigger = ko.observable(SaveSettingsStep.Idle);

View file

@ -4,7 +4,7 @@ import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
import { changeTheme, convertThemeName } from 'Common/Utils';
import { themePreviewLink, serverRequest } from 'Common/Links';
import { i18n } from 'Common/Translator';
import { Settings } from 'Common/Globals';
import { SettingsCapa } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
@ -26,10 +26,9 @@ export class ThemesUserSettings /*extends AbstractViewSettings*/ {
this.themes = ThemeStore.themes;
this.themesObjects = ko.observableArray();
themeBackground.enabled = SettingsCapa(Capa.UserBackground);
this.background = themeBackground;
this.capaUserBackground = Settings.capa(Capa.UserBackground);
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });
ThemeStore.theme.subscribe(value => {
@ -59,7 +58,7 @@ export class ThemesUserSettings /*extends AbstractViewSettings*/ {
// initUploader
if (themeBackground.uploaderButton() && this.capaUserBackground) {
if (themeBackground.uploaderButton() && themeBackground.enabled) {
const oJua = new Jua({
action: serverRequest('UploadBackground'),
limit: 1,
@ -112,7 +111,7 @@ export class ThemesUserSettings /*extends AbstractViewSettings*/ {
}
clearBackground() {
if (this.capaUserBackground) {
if (themeBackground.enabled) {
Remote.request('ClearUserBackground', () => {
themeBackground.name('');
themeBackground.hash('');