Bugfix: on login loading the user settings failed

This commit is contained in:
djmaze 2021-11-19 12:44:53 +01:00
parent 3895b7233c
commit e6145249fa
6 changed files with 73 additions and 41 deletions

View file

@ -719,6 +719,8 @@ class AppUser extends AbstractApp {
AccountUserStore.email(SettingsGet('Email'));
SettingsUserStore.init();
this.foldersReload(value => {
try {
if (value) {

View file

@ -7,11 +7,13 @@ import { ThemeStore } from 'Stores/Theme';
export const SettingsUserStore = new class {
constructor() {
this.layout = ko
.observable(pInt(SettingsGet('Layout')))
const self = this;
self.layout = ko
.observable(1)
.extend({ limitedList: Object.values(Layout) });
this.editorDefaultType = ko.observable(SettingsGet('EditorDefaultType')).extend({
self.editorDefaultType = ko.observable('Html').extend({
limitedList: [
EditorDefaultType.Html,
EditorDefaultType.Plain,
@ -20,43 +22,64 @@ export const SettingsUserStore = new class {
]
});
this.messagesPerPage = ko.observable(pInt(SettingsGet('MPP'))).extend({ debounce: 999 });
self.messagesPerPage = ko.observable(25).extend({ debounce: 999 });
this.messageReadDelay = ko.observable(pInt(SettingsGet('MessageReadDelay'))).extend({ debounce: 999 });
self.messageReadDelay = ko.observable(5).extend({ debounce: 999 });
addObservablesTo(this, {
showImages: !!SettingsGet('ShowImages'),
removeColors: !!SettingsGet('RemoveColors'),
useCheckboxesInList: !!(ThemeStore.isMobile() || SettingsGet('UseCheckboxesInList')),
allowDraftAutosave: !!SettingsGet('AllowDraftAutosave'),
useThreads: !!SettingsGet('UseThreads'),
replySameFolder: !!SettingsGet('ReplySameFolder'),
hideUnsubscribed: Settings.app('useImapSubscribe') && SettingsGet('HideUnsubscribed'),
autoLogout: pInt(SettingsGet('AutoLogout'))
addObservablesTo(self, {
showImages: 0,
removeColors: 0,
useCheckboxesInList: 1,
allowDraftAutosave: 1,
useThreads: 0,
replySameFolder: 0,
hideUnsubscribed: 1,
autoLogout: 0
});
this.usePreviewPane = ko.computed(() => Layout.NoPreview !== this.layout() && !ThemeStore.isMobile());
self.init();
self.usePreviewPane = ko.computed(() => Layout.NoPreview !== self.layout() && !ThemeStore.isMobile());
const toggleLayout = () => {
const value = ThemeStore.isMobile() ? Layout.NoPreview : this.layout();
const value = ThemeStore.isMobile() ? Layout.NoPreview : self.layout();
$htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
$htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
$htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
dispatchEvent(new CustomEvent('rl-layout', {detail:value}));
};
this.layout.subscribe(toggleLayout);
self.layout.subscribe(toggleLayout);
ThemeStore.isMobile.subscribe(toggleLayout);
toggleLayout();
let iAutoLogoutTimer;
this.delayLogout = (() => {
self.delayLogout = (() => {
clearTimeout(iAutoLogoutTimer);
if (0 < this.autoLogout() && !SettingsGet('AccountSignMe')) {
if (0 < self.autoLogout() && !SettingsGet('AccountSignMe')) {
iAutoLogoutTimer = setTimeout(
rl.app.logout,
this.autoLogout() * 60000
self.autoLogout() * 60000
);
}
}).throttle(5000);
}
init() {
const self = this;
self.editorDefaultType(SettingsGet('EditorDefaultType'));
self.layout(pInt(SettingsGet('Layout')));
self.messagesPerPage(pInt(SettingsGet('MessagesPerPage')));
self.messageReadDelay(pInt(SettingsGet('MessageReadDelay')));
self.autoLogout(pInt(SettingsGet('AutoLogout')));
self.showImages(!!SettingsGet('ShowImages'));
self.removeColors(!!SettingsGet('RemoveColors'));
self.useCheckboxesInList(!!SettingsGet('UseCheckboxesInList'));
self.allowDraftAutosave(!!SettingsGet('AllowDraftAutosave'));
self.useThreads(!!SettingsGet('UseThreads'));
self.replySameFolder(!!SettingsGet('ReplySameFolder'));
self.hideUnsubscribed(Settings.app('useImapSubscribe') && SettingsGet('HideUnsubscribed'));
}
};

View file

@ -76,12 +76,6 @@
font-size: 24px;
line-height: 30px;
}
&.hideContactListCheckbox {
.checkboxItem {
visibility: hidden;
}
}
}
.e-contact-item {
@ -263,3 +257,11 @@
}
}
}
html:not(rl-mobile) {
.hideContactListCheckbox {
.checkboxItem {
visibility: hidden;
}
}
}

View file

@ -172,13 +172,15 @@ html.rl-no-preview-pane {
}
}
.hideMessageListCheckbox {
.checkboxCheckAll {
visibility: hidden;
}
html:not(rl-mobile) {
.hideMessageListCheckbox {
.checkboxCheckAll {
visibility: hidden;
}
.checkboxMessage {
display: none;
.checkboxMessage {
display: none;
}
}
}
@ -416,7 +418,9 @@ html.rl-ctrl-key-pressed .messageListItem {
order: 3;
}
}
}
.rl-side-preview-pane {
.messageList:not(.hideMessageListCheckbox) .subjectParent {
margin-left: 30px;
}