diff --git a/dev/App/User.js b/dev/App/User.js index 197e1f238..aafec7da3 100644 --- a/dev/App/User.js +++ b/dev/App/User.js @@ -1,7 +1,6 @@ import 'External/User/ko'; import { SMAudio } from 'Common/Audio'; -import { pInt } from 'Common/Utils'; import { mailToHelper, setLayoutResizer, dropdownsDetectVisibility, loadAccountsAndIdentities } from 'Common/UtilsUser'; import { @@ -192,7 +191,7 @@ export class AppUser extends AbstractApp { SettingsUserScreen ]); - setRefreshFoldersInterval(pInt(SettingsGet('CheckMailInterval'))); + setRefreshFoldersInterval(SettingsGet('CheckMailInterval')); loadAccountsAndIdentities(); diff --git a/dev/Common/Folders.js b/dev/Common/Folders.js index 3e397d112..a6278201c 100644 --- a/dev/Common/Folders.js +++ b/dev/Common/Folders.js @@ -1,7 +1,8 @@ import { RFC822 } from 'Common/File'; import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache'; import { baseCollator } from 'Common/Translator'; -import { isArray, arrayLength } from 'Common/Utils'; +import { SettingsGet } from 'Common/Globals'; +import { isArray, arrayLength, pInt } from 'Common/Utils'; import { SettingsUserStore } from 'Stores/User/Settings'; import { FolderUserStore } from 'Stores/User/Folder'; import { MessagelistUserStore } from 'Stores/User/Messagelist'; @@ -9,13 +10,13 @@ import { MessagelistUserStore } from 'Stores/User/Messagelist'; import Remote from 'Remote/User/Fetch'; let refreshInterval, - // Default every 5 minutes - refreshFoldersInterval = 300000; + // Default every 15 minutes + refreshFoldersInterval = 900000; export const setRefreshFoldersInterval = minutes => { - refreshFoldersInterval = Math.max(5, minutes) * 60000; + refreshFoldersInterval = Math.max(1, pInt(SettingsGet('minRefreshInterval')), pInt(minutes)) * 60000; clearInterval(refreshInterval); refreshInterval = setInterval(() => { const cF = FolderUserStore.currentFolderFullName(), diff --git a/dev/Settings/User/General.js b/dev/Settings/User/General.js index 27940f5ba..edeb3e2de 100644 --- a/dev/Settings/User/General.js +++ b/dev/Settings/User/General.js @@ -39,6 +39,8 @@ export class UserSettingsGeneral extends AbstractViewSettings { this.notificationSound = ko.observable(SettingsGet('NotificationSound')); this.notificationSounds = ko.observableArray(SettingsGet('newMailSounds')); + this.minRefreshInterval = SettingsGet('minRefreshInterval'); + this.desktopNotifications = NotificationUserStore.enabled; this.isDesktopNotificationAllowed = NotificationUserStore.allowed; 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 848601c32..d3f3914ea 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -737,6 +737,7 @@ class Actions $aResult['proxyExternalImages'] = (bool)$oConfig->Get('labs', 'use_local_proxy_for_external_images', false); $aResult['autoVerifySignatures'] = (bool)$oConfig->Get('security', 'auto_verify_signatures', false); $aResult['allowLanguagesOnSettings'] = (bool) $oConfig->Get('webmail', 'allow_languages_on_settings', true); + $aResult['minRefreshInterval'] = (int) $oConfig->Get('webmail', 'min_refresh_interval', 5); $aResult['Capa'] = $this->Capa($bAdmin, $oAccount); $value = \ini_get('upload_max_filesize'); $upload_max_filesize = \intval($value); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Accounts.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Accounts.php index 97eed38de..4ad8d20d0 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Accounts.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Accounts.php @@ -200,6 +200,7 @@ trait Accounts public function getAccountData(Account $oAccount): array { $oConfig = $this->Config(); + $minRefreshInterval = (int) $oConfig->Get('webmail', 'min_refresh_interval', 5); $aResult = [ // 'Email' => IDN::emailToUtf8($oAccount->Email()), 'Email' => $oAccount->Email(), @@ -213,7 +214,7 @@ trait Accounts 'HideDeleted' => true, 'ShowUnreadCount' => false, 'UnhideKolabFolders' => false, - 'CheckMailInterval' => 15 + 'CheckMailInterval' => \max(15, $minRefreshInterval) ]; $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); if ($oSettingsLocal instanceof \RainLoop\Settings) { @@ -229,7 +230,7 @@ trait Accounts $aResult['HideDeleted'] = (bool)$oSettingsLocal->GetConf('HideDeleted', $aResult['HideDeleted']); $aResult['ShowUnreadCount'] = (bool)$oSettingsLocal->GetConf('ShowUnreadCount', $aResult['ShowUnreadCount']); $aResult['UnhideKolabFolders'] = (bool)$oSettingsLocal->GetConf('UnhideKolabFolders', $aResult['UnhideKolabFolders']); - $aResult['CheckMailInterval'] = (int)$oSettingsLocal->GetConf('CheckMailInterval', $aResult['CheckMailInterval']); + $aResult['CheckMailInterval'] = \max((int) $oSettingsLocal->GetConf('CheckMailInterval', $aResult['CheckMailInterval']), $minRefreshInterval); /* foreach ($oSettingsLocal->toArray() as $key => $value) { $aResult[\lcfirst($key)] = $value; diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 8993bc947..0ce4052aa 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -195,6 +195,8 @@ class Application extends \RainLoop\Config\AbstractConfig 'messages_per_page' => array(20, 'Number of messages displayed on page by default'), 'message_read_delay' => array(5, 'Mark message read after N seconds'), + 'min_refresh_interval' => array(5, 'Minimal check for new messages interval in minutes'), + 'attachment_size_limit' => array(\min($upload_max_filesize, 25), 'File size limit (MB) for file upload on compose screen 0 for unlimited.'), 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 667e4f4a0..425219a7c 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 @@ -39,7 +39,7 @@
- +