mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +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'))
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1057,6 +1057,7 @@ class Actions
|
|||
'ShowImages' => (bool) $oConfig->Get('defaults', 'show_images', false),
|
||||
'RemoveColors' => (bool) $oConfig->Get('defaults', 'remove_colors', false),
|
||||
'MPP' => (int) $oConfig->Get('webmail', 'messages_per_page', 25),
|
||||
'MessageReadDelay' => (int) $oConfig->Get('webmail', 'message_read_delay', 5),
|
||||
'SoundNotification' => false,
|
||||
'NotificationSound' => 'new-mail',
|
||||
'DesktopNotifications' => false,
|
||||
|
|
@ -1163,6 +1164,7 @@ class Actions
|
|||
$aResult['RemoveColors'] = (bool)$oSettings->GetConf('RemoveColors', $aResult['RemoveColors']);
|
||||
$aResult['ContactsAutosave'] = (bool)$oSettings->GetConf('ContactsAutosave', $aResult['ContactsAutosave']);
|
||||
$aResult['MPP'] = (int)$oSettings->GetConf('MPP', $aResult['MPP']);
|
||||
$aResult['MessageReadDelay'] = (int)$oSettings->GetConf('MessageReadDelay', $aResult['MessageReadDelay']);
|
||||
$aResult['SoundNotification'] = (bool)$oSettings->GetConf('SoundNotification', $aResult['SoundNotification']);
|
||||
$aResult['NotificationSound'] = (string)$oSettings->GetConf('NotificationSound', $aResult['NotificationSound']);
|
||||
$aResult['DesktopNotifications'] = (bool)$oSettings->GetConf('DesktopNotifications', $aResult['DesktopNotifications']);
|
||||
|
|
|
|||
|
|
@ -351,6 +351,7 @@ trait User
|
|||
$this->setSettingsFromParams($oSettings, 'UseCheckboxesInList', 'bool');
|
||||
$this->setSettingsFromParams($oSettings, 'AllowDraftAutosave', 'bool');
|
||||
$this->setSettingsFromParams($oSettings, 'AutoLogout', 'int');
|
||||
$this->setSettingsFromParams($oSettings, 'MessageReadDelay', 'int');
|
||||
|
||||
$this->setSettingsFromParams($oSettingsLocal, 'UseThreads', 'bool');
|
||||
$this->setSettingsFromParams($oSettingsLocal, 'ReplySameFolder', 'bool');
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ class Application extends \RainLoop\Config\AbstractConfig
|
|||
'allow_additional_identities' => array(true, ''),
|
||||
|
||||
'messages_per_page' => array(20, 'Number of messages displayed on page by default'),
|
||||
'message_read_delay' => array(5, 'Mark message read after N seconds'),
|
||||
|
||||
'attachment_size_limit' => array(\min($upload_max_filesize, 25), 'File size limit (MB) for file upload on compose screen
|
||||
0 for unlimited.')
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@
|
|||
"LABEL_SHOW_IMAGES": "In der Nachricht enthaltene Bilder immer anzeigen",
|
||||
"LABEL_REMOVE_COLORS": "Entferne Hintergrund- und Textfarben aus der Nachricht",
|
||||
"LABEL_MESSAGE_PER_PAGE": "Nachrichten pro Seite",
|
||||
"LABEL_MARK_MESSAGE_READ_AFTER": "Mark message as read after",
|
||||
"SECONDS": "seconds",
|
||||
"LABEL_NOTIFICATIONS": "Benachrichtigungen",
|
||||
"LABEL_SOUND_NOTIFICATION": "Benachrichtigungston",
|
||||
"LABEL_CHROME_NOTIFICATION_DESC": "Popups einblenden, wenn neue Nachrichten vorhanden sind",
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@
|
|||
"LABEL_SHOW_IMAGES": "Always display external images in message body",
|
||||
"LABEL_REMOVE_COLORS": "Remove background and text colors from message body",
|
||||
"LABEL_MESSAGE_PER_PAGE": "Messages on page",
|
||||
"LABEL_MARK_MESSAGE_READ_AFTER": "Mark message as read after",
|
||||
"SECONDS": "seconds",
|
||||
"LABEL_NOTIFICATIONS": "Notifications",
|
||||
"LABEL_SOUND_NOTIFICATION": "Sound notification",
|
||||
"LABEL_CHROME_NOTIFICATION_DESC": "Show new messages notification popups",
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@
|
|||
"LABEL_SHOW_IMAGES": "Mostrar siempre las imágenes en el cuerpo del mensaje",
|
||||
"LABEL_REMOVE_COLORS": "Eliminar el fondo y los colores del texto del mensaje",
|
||||
"LABEL_MESSAGE_PER_PAGE": "Mensajes en página",
|
||||
"LABEL_MARK_MESSAGE_READ_AFTER": "Mark message as read after",
|
||||
"SECONDS": "seconds",
|
||||
"LABEL_NOTIFICATIONS": "Notificaciones",
|
||||
"LABEL_SOUND_NOTIFICATION": "Sonido de la notificación",
|
||||
"LABEL_CHROME_NOTIFICATION_DESC": "Mostrar notificación de nuevos mensajes en Popup",
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@
|
|||
"LABEL_SHOW_IMAGES": "Toujours afficher les images dans le mail",
|
||||
"LABEL_REMOVE_COLORS": "Supprimer les couleurs d'arrière-plan et de texte du message",
|
||||
"LABEL_MESSAGE_PER_PAGE": "Messages par page",
|
||||
"LABEL_MARK_MESSAGE_READ_AFTER": "Mark message as read after",
|
||||
"SECONDS": "seconds",
|
||||
"LABEL_NOTIFICATIONS": "Notifications",
|
||||
"LABEL_SOUND_NOTIFICATION": "Son de notification",
|
||||
"LABEL_CHROME_NOTIFICATION_DESC": "Afficher un pop-up de notification pour les nouveaux messages",
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@
|
|||
"LABEL_SHOW_IMAGES": "Mindig jelenítse meg a külső képeket az üzenet törzsében",
|
||||
"LABEL_REMOVE_COLORS": "Remove background and text colors from message body",
|
||||
"LABEL_MESSAGE_PER_PAGE": "Üzenetek egy oldalon",
|
||||
"LABEL_MARK_MESSAGE_READ_AFTER": "Mark message as read after",
|
||||
"SECONDS": "seconds",
|
||||
"LABEL_NOTIFICATIONS": "Értesítések",
|
||||
"LABEL_SOUND_NOTIFICATION": "Hangos értesítés",
|
||||
"LABEL_CHROME_NOTIFICATION_DESC": "Új üzenetek értesítő ablakainak megjelenítése",
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@
|
|||
"LABEL_SHOW_IMAGES": "Afbeeldingen altijd weergeven in het bericht",
|
||||
"LABEL_REMOVE_COLORS": "Verwijder achtergrond- en tekstkleuren uit het bericht",
|
||||
"LABEL_MESSAGE_PER_PAGE": "Berichten op pagina",
|
||||
"LABEL_MARK_MESSAGE_READ_AFTER": "Mark message as read after",
|
||||
"SECONDS": "seconds",
|
||||
"LABEL_NOTIFICATIONS": "Notificaties",
|
||||
"LABEL_SOUND_NOTIFICATION": "Notificatie geluid",
|
||||
"LABEL_CHROME_NOTIFICATION_DESC": "Toon nieuwe berichten popup",
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@
|
|||
"LABEL_SHOW_IMAGES": "Visa alltid bilder i mail",
|
||||
"LABEL_REMOVE_COLORS": "Remove background and text colors from message body",
|
||||
"LABEL_MESSAGE_PER_PAGE": "Meddelanden per sida",
|
||||
"LABEL_MARK_MESSAGE_READ_AFTER": "Mark message as read after",
|
||||
"SECONDS": "seconds",
|
||||
"LABEL_NOTIFICATIONS": "Aviseringar",
|
||||
"LABEL_SOUND_NOTIFICATION": "Ljudnotifikation",
|
||||
"LABEL_CHROME_NOTIFICATION_DESC": "Visa nya meddelande-aviseringar som popup-fönster",
|
||||
|
|
|
|||
|
|
@ -397,6 +397,8 @@
|
|||
"LABEL_SHOW_IMAGES": "总是显示外部图片信息",
|
||||
"LABEL_REMOVE_COLORS": "从消息中删除背景和文本颜色",
|
||||
"LABEL_MESSAGE_PER_PAGE": "封邮件每页",
|
||||
"LABEL_MARK_MESSAGE_READ_AFTER": "Mark message as read after",
|
||||
"SECONDS": "seconds",
|
||||
"LABEL_NOTIFICATIONS": "通知",
|
||||
"LABEL_SOUND_NOTIFICATION": "提示音",
|
||||
"LABEL_CHROME_NOTIFICATION_DESC": "显示新邮件弹窗",
|
||||
|
|
|
|||
|
|
@ -62,6 +62,15 @@
|
|||
}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" data-i18n="SETTINGS_GENERAL/LABEL_MARK_MESSAGE_READ_AFTER"></label>
|
||||
<div class="controls">
|
||||
<input type="number" min="0" step="1" class="span1" data-bind="textInput: messageReadDelay"/>
|
||||
|
||||
<span data-i18n="SETTINGS_GENERAL/SECONDS"></label>
|
||||
<span data-bind="saveTrigger: messageReadDelayTrigger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<div data-bind="component: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue