mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Resolve issue #138
This commit is contained in:
parent
1457039448
commit
7c75e11666
15 changed files with 71 additions and 37 deletions
|
|
@ -25,6 +25,7 @@ export class GeneralUserSettings {
|
|||
constructor() {
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
this.messageReadDelay = SettingsUserStore.messageReadDelay;
|
||||
this.messagesPerPage = SettingsUserStore.messagesPerPage;
|
||||
this.messagesPerPageArray = MESSAGES_PER_PAGE_VALUES;
|
||||
|
||||
|
|
@ -51,6 +52,7 @@ export class GeneralUserSettings {
|
|||
|
||||
addObservablesTo(this, {
|
||||
mppTrigger: SaveSettingsStep.Idle,
|
||||
messageReadDelayTrigger: SaveSettingsStep.Idle,
|
||||
editorDefaultTypeTrigger: SaveSettingsStep.Idle,
|
||||
layoutTrigger: SaveSettingsStep.Idle
|
||||
});
|
||||
|
|
@ -102,6 +104,9 @@ export class GeneralUserSettings {
|
|||
editorDefaultType: value => Remote.saveSetting('EditorDefaultType', value,
|
||||
settingsSaveHelperSimpleFunction(this.editorDefaultTypeTrigger, this)),
|
||||
|
||||
messageReadDelay: value => Remote.saveSetting('MessageReadDelay', value,
|
||||
settingsSaveHelperSimpleFunction(this.messageReadDelayTrigger, this)),
|
||||
|
||||
messagesPerPage: value => Remote.saveSetting('MPP', value,
|
||||
settingsSaveHelperSimpleFunction(this.mppTrigger, this)),
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import ko from 'ko';
|
|||
import { Scope, Notification } from 'Common/Enums';
|
||||
import { MessageSetAction } from 'Common/EnumsUser';
|
||||
import { doc, $htmlCL, createElement, elementById } from 'Common/Globals';
|
||||
import { arrayLength, pInt, pString, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||
import { arrayLength, pInt, pString, addObservablesTo, addComputablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||
import { plainToHtml } from 'Common/UtilsUser';
|
||||
|
||||
import {
|
||||
|
|
@ -111,30 +111,46 @@ export const MessageUserStore = new class {
|
|||
|
||||
// Computed Observables
|
||||
|
||||
this.listEndHash = ko.computed(
|
||||
() =>
|
||||
addComputablesTo(this, {
|
||||
listEndHash: () =>
|
||||
this.listEndFolder() +
|
||||
'|' +
|
||||
this.listEndSearch() +
|
||||
'|' +
|
||||
this.listEndThreadUid() +
|
||||
'|' +
|
||||
this.listEndPage()
|
||||
);
|
||||
this.listEndPage(),
|
||||
|
||||
this.listPageCount = ko.computed(() =>
|
||||
Math.max(1, Math.ceil(this.listCount() / SettingsUserStore.messagesPerPage()))
|
||||
);
|
||||
listPageCount: () => Math.max(1, Math.ceil(this.listCount() / SettingsUserStore.messagesPerPage())),
|
||||
|
||||
this.mainMessageListSearch = ko.computed({
|
||||
read: this.listSearch,
|
||||
write: value =>
|
||||
rl.route.setHash(
|
||||
mainMessageListSearch: {
|
||||
read: this.listSearch,
|
||||
write: value => rl.route.setHash(
|
||||
mailBox(FolderUserStore.currentFolderFullNameHash(), 1, value.toString().trim(), this.listThreadUid())
|
||||
)
|
||||
});
|
||||
},
|
||||
|
||||
this.isMessageSelected = ko.computed(() => null !== this.message());
|
||||
isMessageSelected: () => null !== this.message(),
|
||||
|
||||
listCheckedOrSelected: () => {
|
||||
const
|
||||
selectedMessage = this.selectorMessageSelected(),
|
||||
focusedMessage = this.selectorMessageFocused(),
|
||||
checked = this.list.filter(item => isChecked(item) || item === selectedMessage);
|
||||
return checked.length ? checked : (focusedMessage ? [focusedMessage] : []);
|
||||
},
|
||||
|
||||
listCheckedOrSelectedUidsWithSubMails: () => {
|
||||
let result = [];
|
||||
this.listCheckedOrSelected().forEach(message => {
|
||||
result.push(message.uid);
|
||||
if (1 < message.threadsLen()) {
|
||||
result = result.concat(message.threads()).unique();
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
this.listChecked = ko
|
||||
.computed(() => this.list.filter(isChecked))
|
||||
|
|
@ -150,25 +166,6 @@ export const MessageUserStore = new class {
|
|||
|| this.list.find(item => item.checked())))
|
||||
.extend({ rateLimit: 50 });
|
||||
|
||||
this.listCheckedOrSelected = ko.computed(() => {
|
||||
const
|
||||
selectedMessage = this.selectorMessageSelected(),
|
||||
focusedMessage = this.selectorMessageFocused(),
|
||||
checked = this.list.filter(item => isChecked(item) || item === selectedMessage);
|
||||
return checked.length ? checked : (focusedMessage ? [focusedMessage] : []);
|
||||
});
|
||||
|
||||
this.listCheckedOrSelectedUidsWithSubMails = ko.computed(() => {
|
||||
let result = [];
|
||||
this.listCheckedOrSelected().forEach(message => {
|
||||
result.push(message.uid);
|
||||
if (1 < message.threadsLen()) {
|
||||
result = result.concat(message.threads()).unique();
|
||||
}
|
||||
});
|
||||
return result;
|
||||
});
|
||||
|
||||
// Subscribers
|
||||
|
||||
let timer = 0, fn = this.listLoadingAnimation;
|
||||
|
|
@ -470,7 +467,7 @@ export const MessageUserStore = new class {
|
|||
|
||||
if (messagesDom) {
|
||||
let body = null,
|
||||
id = 'rl-mgs-' + message.hash.replace(/[^a-zA-Z0-9]/g, '');
|
||||
id = 'rl-msg-' + message.hash.replace(/[^a-zA-Z0-9]/g, '');
|
||||
|
||||
const textBody = elementById(id);
|
||||
if (textBody) {
|
||||
|
|
@ -557,10 +554,10 @@ export const MessageUserStore = new class {
|
|||
}
|
||||
|
||||
MessageFlagsCache.initMessage(message);
|
||||
if (message.isUnseen() || message.hasUnseenSubMessage()) {
|
||||
if (message.isUnseen()) {
|
||||
MessageSeenTimer = setTimeout(
|
||||
() => rl.app.messageListAction(message.folder, MessageSetAction.SetSeen, [message]),
|
||||
5000 // 5 seconds
|
||||
SettingsUserStore.messageReadDelay() * 1000 // seconds
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ export const SettingsUserStore = new class {
|
|||
|
||||
this.messagesPerPage = ko.observable(SettingsGet('MPP')).extend({ limitedList: MESSAGES_PER_PAGE_VALUES });
|
||||
|
||||
this.messageReadDelay = ko.observable(pInt(SettingsGet('MessageReadDelay'))).extend(
|
||||
{ rateLimit: { timeout: 500, method: "notifyWhenChangesStop" } }
|
||||
);
|
||||
|
||||
addObservablesTo(this, {
|
||||
showImages: !!SettingsGet('ShowImages'),
|
||||
removeColors: !!SettingsGet('RemoveColors'),
|
||||
|
|
@ -31,7 +35,6 @@ export const SettingsUserStore = new class {
|
|||
useThreads: !!SettingsGet('UseThreads'),
|
||||
replySameFolder: !!SettingsGet('ReplySameFolder'),
|
||||
hideUnsubscribed: !!SettingsGet('HideUnsubscribed'),
|
||||
|
||||
autoLogout: pInt(SettingsGet('AutoLogout'))
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue