This commit is contained in:
the-djmaze 2024-08-20 16:30:25 +02:00
parent 7ff5232554
commit 6a1b83b365
7 changed files with 15 additions and 9 deletions

View file

@ -1,7 +1,6 @@
import 'External/User/ko'; import 'External/User/ko';
import { SMAudio } from 'Common/Audio'; import { SMAudio } from 'Common/Audio';
import { pInt } from 'Common/Utils';
import { mailToHelper, setLayoutResizer, dropdownsDetectVisibility, loadAccountsAndIdentities } from 'Common/UtilsUser'; import { mailToHelper, setLayoutResizer, dropdownsDetectVisibility, loadAccountsAndIdentities } from 'Common/UtilsUser';
import { import {
@ -192,7 +191,7 @@ export class AppUser extends AbstractApp {
SettingsUserScreen SettingsUserScreen
]); ]);
setRefreshFoldersInterval(pInt(SettingsGet('CheckMailInterval'))); setRefreshFoldersInterval(SettingsGet('CheckMailInterval'));
loadAccountsAndIdentities(); loadAccountsAndIdentities();

View file

@ -1,7 +1,8 @@
import { RFC822 } from 'Common/File'; import { RFC822 } from 'Common/File';
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache'; import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
import { baseCollator } from 'Common/Translator'; 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 { SettingsUserStore } from 'Stores/User/Settings';
import { FolderUserStore } from 'Stores/User/Folder'; import { FolderUserStore } from 'Stores/User/Folder';
import { MessagelistUserStore } from 'Stores/User/Messagelist'; import { MessagelistUserStore } from 'Stores/User/Messagelist';
@ -9,13 +10,13 @@ import { MessagelistUserStore } from 'Stores/User/Messagelist';
import Remote from 'Remote/User/Fetch'; import Remote from 'Remote/User/Fetch';
let refreshInterval, let refreshInterval,
// Default every 5 minutes // Default every 15 minutes
refreshFoldersInterval = 300000; refreshFoldersInterval = 900000;
export const export const
setRefreshFoldersInterval = minutes => { setRefreshFoldersInterval = minutes => {
refreshFoldersInterval = Math.max(5, minutes) * 60000; refreshFoldersInterval = Math.max(1, pInt(SettingsGet('minRefreshInterval')), pInt(minutes)) * 60000;
clearInterval(refreshInterval); clearInterval(refreshInterval);
refreshInterval = setInterval(() => { refreshInterval = setInterval(() => {
const cF = FolderUserStore.currentFolderFullName(), const cF = FolderUserStore.currentFolderFullName(),

View file

@ -39,6 +39,8 @@ export class UserSettingsGeneral extends AbstractViewSettings {
this.notificationSound = ko.observable(SettingsGet('NotificationSound')); this.notificationSound = ko.observable(SettingsGet('NotificationSound'));
this.notificationSounds = ko.observableArray(SettingsGet('newMailSounds')); this.notificationSounds = ko.observableArray(SettingsGet('newMailSounds'));
this.minRefreshInterval = SettingsGet('minRefreshInterval');
this.desktopNotifications = NotificationUserStore.enabled; this.desktopNotifications = NotificationUserStore.enabled;
this.isDesktopNotificationAllowed = NotificationUserStore.allowed; this.isDesktopNotificationAllowed = NotificationUserStore.allowed;

View file

@ -737,6 +737,7 @@ class Actions
$aResult['proxyExternalImages'] = (bool)$oConfig->Get('labs', 'use_local_proxy_for_external_images', false); $aResult['proxyExternalImages'] = (bool)$oConfig->Get('labs', 'use_local_proxy_for_external_images', false);
$aResult['autoVerifySignatures'] = (bool)$oConfig->Get('security', 'auto_verify_signatures', false); $aResult['autoVerifySignatures'] = (bool)$oConfig->Get('security', 'auto_verify_signatures', false);
$aResult['allowLanguagesOnSettings'] = (bool) $oConfig->Get('webmail', 'allow_languages_on_settings', true); $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); $aResult['Capa'] = $this->Capa($bAdmin, $oAccount);
$value = \ini_get('upload_max_filesize'); $value = \ini_get('upload_max_filesize');
$upload_max_filesize = \intval($value); $upload_max_filesize = \intval($value);

View file

@ -200,6 +200,7 @@ trait Accounts
public function getAccountData(Account $oAccount): array public function getAccountData(Account $oAccount): array
{ {
$oConfig = $this->Config(); $oConfig = $this->Config();
$minRefreshInterval = (int) $oConfig->Get('webmail', 'min_refresh_interval', 5);
$aResult = [ $aResult = [
// 'Email' => IDN::emailToUtf8($oAccount->Email()), // 'Email' => IDN::emailToUtf8($oAccount->Email()),
'Email' => $oAccount->Email(), 'Email' => $oAccount->Email(),
@ -213,7 +214,7 @@ trait Accounts
'HideDeleted' => true, 'HideDeleted' => true,
'ShowUnreadCount' => false, 'ShowUnreadCount' => false,
'UnhideKolabFolders' => false, 'UnhideKolabFolders' => false,
'CheckMailInterval' => 15 'CheckMailInterval' => \max(15, $minRefreshInterval)
]; ];
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
if ($oSettingsLocal instanceof \RainLoop\Settings) { if ($oSettingsLocal instanceof \RainLoop\Settings) {
@ -229,7 +230,7 @@ trait Accounts
$aResult['HideDeleted'] = (bool)$oSettingsLocal->GetConf('HideDeleted', $aResult['HideDeleted']); $aResult['HideDeleted'] = (bool)$oSettingsLocal->GetConf('HideDeleted', $aResult['HideDeleted']);
$aResult['ShowUnreadCount'] = (bool)$oSettingsLocal->GetConf('ShowUnreadCount', $aResult['ShowUnreadCount']); $aResult['ShowUnreadCount'] = (bool)$oSettingsLocal->GetConf('ShowUnreadCount', $aResult['ShowUnreadCount']);
$aResult['UnhideKolabFolders'] = (bool)$oSettingsLocal->GetConf('UnhideKolabFolders', $aResult['UnhideKolabFolders']); $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) { foreach ($oSettingsLocal->toArray() as $key => $value) {
$aResult[\lcfirst($key)] = $value; $aResult[\lcfirst($key)] = $value;

View file

@ -195,6 +195,8 @@ class Application extends \RainLoop\Config\AbstractConfig
'messages_per_page' => array(20, 'Number of messages displayed on page by default'), 'messages_per_page' => array(20, 'Number of messages displayed on page by default'),
'message_read_delay' => array(5, 'Mark message read after N seconds'), '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 'attachment_size_limit' => array(\min($upload_max_filesize, 25), 'File size limit (MB) for file upload on compose screen
0 for unlimited.'), 0 for unlimited.'),

View file

@ -39,7 +39,7 @@
<div class="control-group"> <div class="control-group">
<label data-i18n="SETTINGS_GENERAL/CHECK_MAIL_INTERVAL"></label> <label data-i18n="SETTINGS_GENERAL/CHECK_MAIL_INTERVAL"></label>
<div> <div>
<input type="number" min="5" max="60" step="1" class="span1" data-bind="textInput: checkMailInterval"> <input type="number" max="60" step="1" class="span1" data-bind="textInput: checkMailInterval, attr:{min:minRefreshInterval}">
<span data-i18n="SETTINGS_GENERAL/MINUTES"></span> <span data-i18n="SETTINGS_GENERAL/MINUTES"></span>
<span data-bind="saveTrigger: checkMailIntervalTrigger"></span> <span data-bind="saveTrigger: checkMailIntervalTrigger"></span>
</div> </div>