From daf1e2769fd887df94b09114e6f18e6e85a94f48 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 27 Nov 2023 15:07:02 +0100 Subject: [PATCH] Resolve #1289 --- dev/Common/UtilsUser.js | 2 +- dev/Settings/User/General.js | 2 +- dev/Stores/User/Settings.js | 64 ++++++++++--------- .../0.0.0/app/libraries/RainLoop/Actions.php | 2 + .../app/libraries/RainLoop/Actions/User.php | 1 + .../templates/Views/User/SettingsGeneral.html | 8 ++- 6 files changed, 47 insertions(+), 32 deletions(-) diff --git a/dev/Common/UtilsUser.js b/dev/Common/UtilsUser.js index 2a01115c8..16f224200 100644 --- a/dev/Common/UtilsUser.js +++ b/dev/Common/UtilsUser.js @@ -276,7 +276,7 @@ viewMessage = (oMessage, popup) => { MessageUserStore.loading(false); oMessage.body.hidden = false; - if (oMessage.isUnseen()) { + if (oMessage.isUnseen() && SettingsUserStore.messageReadAuto()) { MessageUserStore.MessageSeenTimer = setTimeout( () => MessagelistUserStore.setAction(oMessage.folder, MessageSetAction.SetSeen, [oMessage]), SettingsUserStore.messageReadDelay() * 1000 // seconds diff --git a/dev/Settings/User/General.js b/dev/Settings/User/General.js index 5fe3648c8..d8360d5a2 100644 --- a/dev/Settings/User/General.js +++ b/dev/Settings/User/General.js @@ -104,7 +104,7 @@ export class UserSettingsGeneral extends AbstractViewSettings { this.addSettings(['ViewHTML', 'ViewImages', 'ViewImagesWhitelist', 'HideDeleted', 'RemoveColors', 'AllowStyles', 'ListInlineAttachments', 'simpleAttachmentsList', 'UseCheckboxesInList', 'listGrouped', 'ReplySameFolder', - 'requestReadReceipt', 'requestDsn', 'requireTLS', 'pgpSign', 'pgpEncrypt', 'allowSpellcheck', + 'requestReadReceipt', 'requestDsn', 'requireTLS', 'pgpSign', 'pgpEncrypt', 'allowSpellcheck', 'messageReadAuto', 'DesktopNotifications', 'SoundNotification', 'CollapseBlockquotes', 'AllowDraftAutosave', 'showNextMessage']); const fReloadLanguageHelper = (saveSettingsStep) => () => { diff --git a/dev/Stores/User/Settings.js b/dev/Stores/User/Settings.js index 2be7aef57..d71b9b66c 100644 --- a/dev/Stores/User/Settings.js +++ b/dev/Stores/User/Settings.js @@ -35,6 +35,7 @@ export const SettingsUserStore = new class { unhideKolabFolders: 0, autoLogout: 0, showUnreadCount: 0, + messageReadAuto: 0, requestReadReceipt: 0, requestDsn: 0, @@ -78,39 +79,44 @@ export const SettingsUserStore = new class { const self = this; self.editorDefaultType(SettingsGet('EditorDefaultType')); + [ + 'messageReadAuto', + 'MsgDefaultAction', + 'ViewHTML', + 'ViewImages', + 'ViewImagesWhitelist', + 'RemoveColors', + 'AllowStyles', + 'CollapseBlockquotes', + 'MaxBlockquotesLevel', + 'ListInlineAttachments', + 'simpleAttachmentsList', + 'UseCheckboxesInList', + 'listGrouped', + 'showNextMessage', + 'AllowDraftAutosave', + 'UseThreads', + 'ReplySameFolder', + 'HideUnsubscribed', + 'HideDeleted', + 'ShowUnreadCount', + 'UnhideKolabFolders', + 'requestReadReceipt', + 'requestDsn', + 'requireTLS', + 'pgpSign', + 'pgpEncrypt', + 'allowSpellcheck' + ].forEach(name => { + let value = SettingsGet(name); + name = name[0].toLowerCase() + name.slice(1); + self[name](value); + }); + self.layout(pInt(SettingsGet('Layout'))); self.messagesPerPage(pInt(SettingsGet('MessagesPerPage'))); self.checkMailInterval(pInt(SettingsGet('CheckMailInterval'))); self.messageReadDelay(pInt(SettingsGet('MessageReadDelay'))); self.autoLogout(pInt(SettingsGet('AutoLogout'))); - self.msgDefaultAction(SettingsGet('MsgDefaultAction')); - - self.viewHTML(SettingsGet('ViewHTML')); - self.viewImages(SettingsGet('ViewImages')); - self.viewImagesWhitelist(SettingsGet('ViewImagesWhitelist')); - self.removeColors(SettingsGet('RemoveColors')); - self.allowStyles(SettingsGet('AllowStyles')); - self.collapseBlockquotes(SettingsGet('CollapseBlockquotes')); - self.maxBlockquotesLevel(SettingsGet('MaxBlockquotesLevel')); - self.listInlineAttachments(SettingsGet('ListInlineAttachments')); - self.simpleAttachmentsList(SettingsGet('simpleAttachmentsList')); - self.useCheckboxesInList(SettingsGet('UseCheckboxesInList')); - self.listGrouped(SettingsGet('listGrouped')); - self.showNextMessage(SettingsGet('showNextMessage')); - self.allowDraftAutosave(SettingsGet('AllowDraftAutosave')); - self.useThreads(SettingsGet('UseThreads')); - self.replySameFolder(SettingsGet('ReplySameFolder')); - - self.hideUnsubscribed(SettingsGet('HideUnsubscribed')); - self.hideDeleted(SettingsGet('HideDeleted')); - self.showUnreadCount(SettingsGet('ShowUnreadCount')); - self.unhideKolabFolders(SettingsGet('UnhideKolabFolders')); - - self.requestReadReceipt(SettingsGet('requestReadReceipt')); - self.requestDsn(SettingsGet('requestDsn')); - self.requireTLS(SettingsGet('requireTLS')); - self.pgpSign(SettingsGet('pgpSign')); - self.pgpEncrypt(SettingsGet('pgpEncrypt')); - self.allowSpellcheck(SettingsGet('allowSpellcheck')); } }; diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php index febf39be7..7d58fa928 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -691,6 +691,7 @@ class Actions 'simpleAttachmentsList' => false, 'listGrouped' => $oConfig->Get('defaults', 'mail_list_grouped', false), 'MessagesPerPage' => (int) $oConfig->Get('webmail', 'messages_per_page', 25), + 'messageReadAuto' => true, // (bool) $oConfig->Get('webmail', 'message_read_auto', true), 'MessageReadDelay' => (int) $oConfig->Get('webmail', 'message_read_delay', 5), 'MsgDefaultAction' => (int) $oConfig->Get('defaults', 'msg_default_action', 1), 'SoundNotification' => true, @@ -790,6 +791,7 @@ class Actions $aResult['listGrouped'] = (bool)$oSettings->GetConf('listGrouped', $aResult['listGrouped']); $aResult['ContactsAutosave'] = (bool)$oSettings->GetConf('ContactsAutosave', $aResult['ContactsAutosave']); $aResult['MessagesPerPage'] = (int)$oSettings->GetConf('MessagesPerPage', $aResult['MessagesPerPage']); + $aResult['messageReadAuto'] = (int)$oSettings->GetConf('messageReadAuto', $aResult['messageReadAuto']); $aResult['MessageReadDelay'] = (int)$oSettings->GetConf('MessageReadDelay', $aResult['MessageReadDelay']); $aResult['MsgDefaultAction'] = (int)$oSettings->GetConf('MsgDefaultAction', $aResult['MsgDefaultAction']); $aResult['SoundNotification'] = (bool)$oSettings->GetConf('SoundNotification', $aResult['SoundNotification']); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php index 867c55a3a..cd07b2927 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php @@ -201,6 +201,7 @@ trait User $this->setSettingsFromParams($oSettings, 'UseCheckboxesInList', 'bool'); $this->setSettingsFromParams($oSettings, 'AllowDraftAutosave', 'bool'); $this->setSettingsFromParams($oSettings, 'AutoLogout', 'int'); + $this->setSettingsFromParams($oSettings, 'messageReadAuto', 'bool'); $this->setSettingsFromParams($oSettings, 'MessageReadDelay', 'int'); $this->setSettingsFromParams($oSettings, 'MsgDefaultAction', 'int'); $this->setSettingsFromParams($oSettings, 'showNextMessage', 'bool'); diff --git a/snappymail/v/0.0.0/app/templates/Views/User/SettingsGeneral.html b/snappymail/v/0.0.0/app/templates/Views/User/SettingsGeneral.html index e5f6f2f45..bd8f4c679 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/SettingsGeneral.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/SettingsGeneral.html @@ -175,7 +175,13 @@