mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Merge handling of local Account Settings
Found while investigating #1170
This commit is contained in:
parent
1dd0f546ce
commit
311dc7610f
2 changed files with 45 additions and 52 deletions
|
|
@ -701,15 +701,8 @@ class Actions
|
||||||
'UseCheckboxesInList' => (bool) $oConfig->Get('defaults', 'view_use_checkboxes', true),
|
'UseCheckboxesInList' => (bool) $oConfig->Get('defaults', 'view_use_checkboxes', true),
|
||||||
'showNextMessage' => false,
|
'showNextMessage' => false,
|
||||||
'AutoLogout' => (int) $oConfig->Get('defaults', 'autologout', 30),
|
'AutoLogout' => (int) $oConfig->Get('defaults', 'autologout', 30),
|
||||||
'UseThreads' => (bool) $oConfig->Get('defaults', 'mail_use_threads', false),
|
|
||||||
'AllowDraftAutosave' => (bool) $oConfig->Get('defaults', 'allow_draft_autosave', true),
|
'AllowDraftAutosave' => (bool) $oConfig->Get('defaults', 'allow_draft_autosave', true),
|
||||||
'ReplySameFolder' => (bool) $oConfig->Get('defaults', 'mail_reply_same_folder', false),
|
|
||||||
'ContactsAutosave' => (bool) $oConfig->Get('defaults', 'contacts_autosave', true),
|
'ContactsAutosave' => (bool) $oConfig->Get('defaults', 'contacts_autosave', true),
|
||||||
'HideUnsubscribed' => false,
|
|
||||||
'HideDeleted' => true,
|
|
||||||
'ShowUnreadCount' => false,
|
|
||||||
'UnhideKolabFolders' => false,
|
|
||||||
'CheckMailInterval' => 15,
|
|
||||||
'sieveAllowFileintoInbox' => (bool)$oConfig->Get('labs', 'sieve_allow_fileinto_inbox', false)
|
'sieveAllowFileintoInbox' => (bool)$oConfig->Get('labs', 'sieve_allow_fileinto_inbox', false)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -756,29 +749,7 @@ class Actions
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainAccount or AdditionalAccount
|
// MainAccount or AdditionalAccount
|
||||||
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
|
$aResult = \array_merge($aResult, $this->getAccountData($oAccount));
|
||||||
if ($oSettingsLocal instanceof Settings) {
|
|
||||||
/*
|
|
||||||
foreach ($oSettingsLocal->toArray() as $key => $value) {
|
|
||||||
$aResult[\lcfirst($key)] = $value;
|
|
||||||
}
|
|
||||||
$aResult['junkFolder'] = $aResult['spamFolder'];
|
|
||||||
unset($aResult['checkableFolder']);
|
|
||||||
unset($aResult['theme']);
|
|
||||||
*/
|
|
||||||
$aResult['SentFolder'] = (string)$oSettingsLocal->GetConf('SentFolder', '');
|
|
||||||
$aResult['DraftsFolder'] = (string)$oSettingsLocal->GetConf('DraftsFolder', '');
|
|
||||||
$aResult['JunkFolder'] = (string)$oSettingsLocal->GetConf('JunkFolder', '');
|
|
||||||
$aResult['TrashFolder'] = (string)$oSettingsLocal->GetConf('TrashFolder', '');
|
|
||||||
$aResult['ArchiveFolder'] = (string)$oSettingsLocal->GetConf('ArchiveFolder', '');
|
|
||||||
$aResult['HideUnsubscribed'] = (bool)$oSettingsLocal->GetConf('HideUnsubscribed', $aResult['HideUnsubscribed']);
|
|
||||||
$aResult['UseThreads'] = (bool)$oSettingsLocal->GetConf('UseThreads', $aResult['UseThreads']);
|
|
||||||
$aResult['ReplySameFolder'] = (bool)$oSettingsLocal->GetConf('ReplySameFolder', $aResult['ReplySameFolder']);
|
|
||||||
$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']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// MainAccount
|
// MainAccount
|
||||||
$oSettings = $this->SettingsProvider()->Load($oAccount);
|
$oSettings = $this->SettingsProvider()->Load($oAccount);
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,49 @@ trait Accounts
|
||||||
return $this->FalseResponse();
|
return $this->FalseResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAccountData(Account $oAccount): array
|
||||||
|
{
|
||||||
|
$oConfig = $this->Config();
|
||||||
|
$aResult = [
|
||||||
|
'Email' => $oAccount->Email(),
|
||||||
|
'accountHash' => $oAccount->Hash(),
|
||||||
|
'mainEmail' => ($oAccount instanceof AdditionalAccount)
|
||||||
|
? $oAccount->ParentEmail() : '',
|
||||||
|
'contactsAllowed' => $this->AddressBookProvider($oAccount)->IsActive(),
|
||||||
|
'HideUnsubscribed' => false,
|
||||||
|
'UseThreads' => (bool) $oConfig->Get('defaults', 'mail_use_threads', false),
|
||||||
|
'ReplySameFolder' => (bool) $oConfig->Get('defaults', 'mail_reply_same_folder', false),
|
||||||
|
'HideDeleted' => true,
|
||||||
|
'ShowUnreadCount' => false,
|
||||||
|
'UnhideKolabFolders' => false,
|
||||||
|
'CheckMailInterval' => 15
|
||||||
|
];
|
||||||
|
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
|
||||||
|
if ($oSettingsLocal instanceof \RainLoop\Settings) {
|
||||||
|
$aResult['SentFolder'] = (string) $oSettingsLocal->GetConf('SentFolder', '');
|
||||||
|
$aResult['DraftsFolder'] = (string) $oSettingsLocal->GetConf('DraftsFolder', '');
|
||||||
|
$aResult['JunkFolder'] = (string) $oSettingsLocal->GetConf('JunkFolder', '');
|
||||||
|
$aResult['TrashFolder'] = (string) $oSettingsLocal->GetConf('TrashFolder', '');
|
||||||
|
$aResult['ArchiveFolder'] = (string) $oSettingsLocal->GetConf('ArchiveFolder', '');
|
||||||
|
$aResult['HideUnsubscribed'] = (bool) $oSettingsLocal->GetConf('HideUnsubscribed', $aResult['HideUnsubscribed']);
|
||||||
|
$aResult['UseThreads'] = (bool) $oSettingsLocal->GetConf('UseThreads', $aResult['UseThreads']);
|
||||||
|
$aResult['ReplySameFolder'] = (bool) $oSettingsLocal->GetConf('ReplySameFolder', $aResult['ReplySameFolder']);
|
||||||
|
$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']);
|
||||||
|
/*
|
||||||
|
foreach ($oSettingsLocal->toArray() as $key => $value) {
|
||||||
|
$aResult[\lcfirst($key)] = $value;
|
||||||
|
}
|
||||||
|
$aResult['junkFolder'] = $aResult['spamFolder'];
|
||||||
|
unset($aResult['checkableFolder']);
|
||||||
|
unset($aResult['theme']);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
return $aResult;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \MailSo\RuntimeException
|
* @throws \MailSo\RuntimeException
|
||||||
*/
|
*/
|
||||||
|
|
@ -201,29 +244,8 @@ trait Accounts
|
||||||
{
|
{
|
||||||
if ($this->switchAccount(\trim($this->GetActionParam('Email', '')))) {
|
if ($this->switchAccount(\trim($this->GetActionParam('Email', '')))) {
|
||||||
$oAccount = $this->getAccountFromToken();
|
$oAccount = $this->getAccountFromToken();
|
||||||
$aResult['Email'] = $oAccount->Email();
|
$aResult = $this->getAccountData($oAccount);
|
||||||
$aResult['accountHash'] = $oAccount->Hash();
|
|
||||||
$aResult['mainEmail'] = ($oAccount instanceof AdditionalAccount)
|
|
||||||
? $oAccount->ParentEmail() : '';
|
|
||||||
$aResult['contactsAllowed'] = $this->AddressBookProvider($oAccount)->IsActive();
|
|
||||||
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
|
|
||||||
if ($oSettingsLocal instanceof \RainLoop\Settings) {
|
|
||||||
$oConfig = $this->Config();
|
|
||||||
$aResult['SentFolder'] = (string) $oSettingsLocal->GetConf('SentFolder', '');
|
|
||||||
$aResult['DraftsFolder'] = (string) $oSettingsLocal->GetConf('DraftsFolder', '');
|
|
||||||
$aResult['JunkFolder'] = (string) $oSettingsLocal->GetConf('JunkFolder', '');
|
|
||||||
$aResult['TrashFolder'] = (string) $oSettingsLocal->GetConf('TrashFolder', '');
|
|
||||||
$aResult['ArchiveFolder'] = (string) $oSettingsLocal->GetConf('ArchiveFolder', '');
|
|
||||||
$aResult['HideUnsubscribed'] = (bool) $oSettingsLocal->GetConf('HideUnsubscribed', false);
|
|
||||||
$aResult['UseThreads'] = (bool) $oSettingsLocal->GetConf('UseThreads', $oConfig->Get('defaults', 'mail_use_threads', false));
|
|
||||||
$aResult['ReplySameFolder'] = (bool) $oSettingsLocal->GetConf('ReplySameFolder', $oConfig->Get('defaults', 'mail_reply_same_folder', false));
|
|
||||||
$aResult['HideDeleted'] = (bool) $oSettingsLocal->GetConf('HideDeleted', true);
|
|
||||||
$aResult['ShowUnreadCount'] = (bool) $oSettingsLocal->GetConf('ShowUnreadCount', false);
|
|
||||||
$aResult['UnhideKolabFolders'] = (bool) $oSettingsLocal->GetConf('UnhideKolabFolders', false);
|
|
||||||
$aResult['CheckMailInterval'] = (int) $oSettingsLocal->GetConf('CheckMailInterval', 15);
|
|
||||||
}
|
|
||||||
// $this->Plugins()->InitAppData($bAdmin, $aResult, $oAccount);
|
// $this->Plugins()->InitAppData($bAdmin, $aResult, $oAccount);
|
||||||
|
|
||||||
return $this->DefaultResponse($aResult);
|
return $this->DefaultResponse($aResult);
|
||||||
}
|
}
|
||||||
return $this->FalseResponse();
|
return $this->FalseResponse();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue