From 676de1ed23358f7d48c4b988ecee053e4894df4e Mon Sep 17 00:00:00 2001 From: djmaze Date: Wed, 17 Mar 2021 10:05:22 +0100 Subject: [PATCH] Simplify AppUserStore.contactsIsAllowed --- dev/App/User.js | 2 -- dev/Screen/User/Settings.js | 2 +- dev/Stores/User/App.js | 8 ++------ dev/View/Popup/Compose.js | 2 +- dev/View/User/AbstractSystemDropDown.js | 2 +- dev/View/User/MailBox/FolderList.js | 2 +- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/dev/App/User.js b/dev/App/User.js index 48b0db5ea..f018ccf55 100644 --- a/dev/App/User.js +++ b/dev/App/User.js @@ -47,7 +47,6 @@ import { import { getNotification, i18n } from 'Common/Translator'; -import { AppUserStore } from 'Stores/User/App'; import { SettingsUserStore } from 'Stores/User/Settings'; import { NotificationUserStore } from 'Stores/User/Notification'; import { AccountUserStore } from 'Stores/User/Account'; @@ -887,7 +886,6 @@ class AppUser extends AbstractApp { addEventListener('resize', () => leftPanelDisabled(ThemeStore.isMobile() || 1000 > innerWidth)); - AppUserStore.populate(); SettingsUserStore.populate(); NotificationUserStore.populate(); AccountUserStore.populate(); diff --git a/dev/Screen/User/Settings.js b/dev/Screen/User/Settings.js index 777f5402c..88d5675cd 100644 --- a/dev/Screen/User/Settings.js +++ b/dev/Screen/User/Settings.js @@ -45,7 +45,7 @@ export class SettingsUserScreen extends AbstractSettingsScreen { settingsAddViewModel(GeneralUserSettings, 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true); - if (AppUserStore.contactsIsAllowed()) { + if (AppUserStore.allowContacts()) { settingsAddViewModel(ContactsUserSettings, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts'); } diff --git a/dev/Stores/User/App.js b/dev/Stores/User/App.js index a351899f6..046a085a5 100644 --- a/dev/Stores/User/App.js +++ b/dev/Stores/User/App.js @@ -4,9 +4,7 @@ import { addObservablesTo } from 'Common/Utils'; import { ThemeStore } from 'Stores/Theme'; export const AppUserStore = { - populate: () => { - AppUserStore.contactsIsAllowed(!!SettingsGet('ContactsIsAllowed')); - } + allowContacts: () => !!SettingsGet('ContactsIsAllowed') }; addObservablesTo(AppUserStore, { @@ -16,9 +14,7 @@ addObservablesTo(AppUserStore, { threadsAllowed: false, - composeInEdit: false, - - contactsIsAllowed: false + composeInEdit: false }); AppUserStore.focusedState.subscribe(value => { diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index f60cab660..0f83b78ae 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -125,7 +125,7 @@ class ComposePopupView extends AbstractViewPopup { this.sLastFocusedField = 'to'; - this.allowContacts = AppUserStore.contactsIsAllowed(); + this.allowContacts = AppUserStore.allowContacts(); this.bSkipNextHide = false; this.editorDefaultType = SettingsUserStore.editorDefaultType; diff --git a/dev/View/User/AbstractSystemDropDown.js b/dev/View/User/AbstractSystemDropDown.js index 123bda59a..51c13641d 100644 --- a/dev/View/User/AbstractSystemDropDown.js +++ b/dev/View/User/AbstractSystemDropDown.js @@ -36,7 +36,7 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight { capaAdditionalAccounts: Settings.capa(Capa.AdditionalAccounts) }); - this.allowContacts = AppUserStore.contactsIsAllowed(); + this.allowContacts = AppUserStore.allowContacts(); this.addAccountClick = this.addAccountClick.bind(this); diff --git a/dev/View/User/MailBox/FolderList.js b/dev/View/User/MailBox/FolderList.js index 837302f09..4acbe3cfb 100644 --- a/dev/View/User/MailBox/FolderList.js +++ b/dev/View/User/MailBox/FolderList.js @@ -38,7 +38,7 @@ export class FolderListMailBoxUserView extends AbstractViewLeft { this.leftPanelDisabled = leftPanelDisabled; this.allowComposer = Settings.capa(Capa.Composer); - this.allowContacts = AppUserStore.contactsIsAllowed(); + this.allowContacts = AppUserStore.allowContacts(); this.folderListFocused = ko.computed(() => Scope.FolderList === AppUserStore.focusedState());