diff --git a/dev/Settings/User/Folders.js b/dev/Settings/User/Folders.js index e51ada363..7f30d88cb 100644 --- a/dev/Settings/User/Folders.js +++ b/dev/Settings/User/Folders.js @@ -2,6 +2,7 @@ import ko from 'ko'; import { Notification } from 'Common/Enums'; import { ClientSideKeyName } from 'Common/EnumsUser'; +import { Settings } from 'Common/Globals'; import { getNotification } from 'Common/Translator'; import { removeFolderFromCacheList } from 'Common/Cache'; @@ -9,6 +10,7 @@ import { removeFolderFromCacheList } from 'Common/Cache'; import * as Local from 'Storage/Client'; import { FolderUserStore } from 'Stores/User/Folder'; +import { SettingsUserStore } from 'Stores/User/Settings'; import Remote from 'Remote/User/Fetch'; @@ -23,6 +25,7 @@ export class FoldersUserSettings { this.folderList = FolderUserStore.folderList; this.folderListOptimized = FolderUserStore.folderListOptimized; this.folderListError = FolderUserStore.folderListError; + this.hideUnsubscribed = SettingsUserStore.hideUnsubscribed; this.loading = ko.computed(() => { const loading = FolderUserStore.foldersLoading(), @@ -36,6 +39,9 @@ export class FoldersUserSettings { this.folderForDeletion = ko.observable(null).deleteAccessHelper(); this.folderForEdit = ko.observable(null).extend({ toggleSubscribeProperty: [this, 'edited'] }); + + this.useImapSubscribe = Settings.app('useImapSubscribe'); + this.hideUnsubscribed.subscribe(value => Remote.saveSetting('HideUnsubscribed', value ? 1 : 0)); } folderEditOnEnter(folder) { diff --git a/dev/Stores/User/Settings.js b/dev/Stores/User/Settings.js index cd157fb65..d3b20fd73 100644 --- a/dev/Stores/User/Settings.js +++ b/dev/Stores/User/Settings.js @@ -30,6 +30,7 @@ export const SettingsUserStore = new class { allowDraftAutosave: !!SettingsGet('AllowDraftAutosave'), useThreads: !!SettingsGet('UseThreads'), replySameFolder: !!SettingsGet('ReplySameFolder'), + hideUnsubscribed: !!SettingsGet('HideUnsubscribed'), autoLogout: pInt(SettingsGet('AutoLogout')) }); diff --git a/dev/Styles/SettingsFolders.less b/dev/Styles/SettingsFolders.less index 558cade17..41b6b87c3 100644 --- a/dev/Styles/SettingsFolders.less +++ b/dev/Styles/SettingsFolders.less @@ -6,7 +6,7 @@ } .list-table { - margin-top: 40px; + margin-top: 1em; .folder-padding { display: inline-block; 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 54d5e9b3f..20246cd4a 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -1090,6 +1090,7 @@ class Actions '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), + 'HideUnsubscribed' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true), 'EnableTwoFactor' => false, 'ParentEmail' => '', 'InterfaceAnimation' => true, @@ -1224,6 +1225,7 @@ class Actions $aResult['SpamFolder'] = (string)$oSettingsLocal->GetConf('SpamFolder', ''); $aResult['TrashFolder'] = (string)$oSettingsLocal->GetConf('TrashFolder', ''); $aResult['ArchiveFolder'] = (string)$oSettingsLocal->GetConf('ArchiveFolder', ''); + $aResult['HideUnsubscribed'] = (bool)$oSettingsLocal->GetConf('HideUnsubscribed', $aResult['HideUnsubscribed']); } if ($this->GetCapa(false, Enumerations\Capa::SETTINGS, $oAccount)) { diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Folders.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Folders.php index b6834246f..f1af24421 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Folders.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Folders.php @@ -17,11 +17,17 @@ trait Folders $oFolderCollection = null; $this->Plugins()->RunHook('filter.folders-before', array($oAccount, $oFolderCollection)); + $HideUnsubscribed = $this->Config()->Get('labs', 'use_imap_list_subscribe', true); + $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); + if ($oSettingsLocal instanceof \RainLoop\Settings) { + $HideUnsubscribed = (bool) $oSettingsLocal->GetConf('HideUnsubscribed', $HideUnsubscribed); + } + if (null === $oFolderCollection) { $oFolderCollection = $this->MailClient()->Folders('', '*', - !!$this->Config()->Get('labs', 'use_imap_list_subscribe', true), + $HideUnsubscribed, (int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200) ); } @@ -127,7 +133,7 @@ trait Folders if ($bDoItAgain) { $oFolderCollection = $this->MailClient()->Folders('', '*', - !!$this->Config()->Get('labs', 'use_imap_list_subscribe', true), + $HideUnsubscribed, (int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200) ); @@ -465,14 +471,14 @@ trait Folders private function recFoldersTypes(\RainLoop\Model\Account $oAccount, \MailSo\Mail\FolderCollection $oFolders, array &$aResult, bool $bListFolderTypes = true) : void { - if ($oFolders && $oFolders->Count()) + if ($oFolders->Count()) { if ($bListFolderTypes) { foreach ($oFolders as $oFolder) { - $iFolderListType = $oFolder->GetFolderListType(); - if (!isset($aResult[$iFolderListType]) && \in_array($iFolderListType, array( + $iFolderType = $oFolder->GetFolderListType(); + if (!isset($aResult[$iFolderType]) && \in_array($iFolderType, array( FolderType::INBOX, FolderType::SENT, FolderType::DRAFTS, @@ -481,14 +487,14 @@ trait Folders FolderType::ALL ))) { - $aResult[$iFolderListType] = $oFolder->FullNameRaw(); + $aResult[$iFolderType] = $oFolder->FullNameRaw(); } } foreach ($oFolders as $oFolder) { $oSub = $oFolder->SubFolders(); - if ($oSub && 0 < $oSub->Count()) + if ($oSub && $oSub->Count()) { $this->recFoldersTypes($oAccount, $oSub, $aResult, true); } @@ -521,7 +527,7 @@ trait Folders foreach ($oFolders as $oFolder) { $oSub = $oFolder->SubFolders(); - if ($oSub && 0 < $oSub->Count()) + if ($oSub && $oSub->Count()) { $this->recFoldersTypes($oAccount, $oSub, $aResult, false); } 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 2b02d12fb..e56044690 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 @@ -368,6 +368,7 @@ trait User $this->setSettingsFromParams($oSettingsLocal, 'UseThreads', 'bool'); $this->setSettingsFromParams($oSettingsLocal, 'ReplySameFolder', 'bool'); + $this->setSettingsFromParams($oSettingsLocal, 'HideUnsubscribed', 'bool'); return $this->DefaultResponse(__FUNCTION__, $this->SettingsProvider()->Save($oAccount, $oSettings) && 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 b1e32a6e5..0548107fe 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 @@ -306,7 +306,7 @@ Enables caching in the system'), ), 'labs' => array( - 'ignore_folders_subscription' => array(false), +// 'ignore_folders_subscription' => array(false), 'update_channel' => array('stable'), 'allow_prefetch' => array(true), 'allow_smart_html_links' => array(true), diff --git a/snappymail/v/0.0.0/app/localization/webmail/_source.en.yml b/snappymail/v/0.0.0/app/localization/webmail/_source.en.yml index e5e8a3bde..e608f2a84 100644 --- a/snappymail/v/0.0.0/app/localization/webmail/_source.en.yml +++ b/snappymail/v/0.0.0/app/localization/webmail/_source.en.yml @@ -439,6 +439,7 @@ en: HELP_DELETE_FOLDER: "Delete folder" HELP_SHOW_HIDE_FOLDER: "Show/hide folder" HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages" + HIDE_UNSUBSCRIBED: "Hide unsubscribed folders" SETTINGS_ACCOUNTS: LEGEND_ACCOUNTS: "Accounts" LEGEND_IDENTITIES: "Identities" diff --git a/snappymail/v/0.0.0/app/localization/webmail/de_DE.yml b/snappymail/v/0.0.0/app/localization/webmail/de_DE.yml index a042e84b7..0f9dd3792 100644 --- a/snappymail/v/0.0.0/app/localization/webmail/de_DE.yml +++ b/snappymail/v/0.0.0/app/localization/webmail/de_DE.yml @@ -440,6 +440,7 @@ de_DE: HELP_DELETE_FOLDER: "Ordner löschen" HELP_SHOW_HIDE_FOLDER: "Ordner ein-/ausblenden" HELP_CHECK_FOR_NEW_MESSAGES: "Auf neue Nachrichten prüfen/nicht prüfen" + HIDE_UNSUBSCRIBED: "Nicht abonnierte Ordner ausblenden" SETTINGS_ACCOUNTS: LEGEND_ACCOUNTS: "Konten" LEGEND_IDENTITIES: "Identitäten" diff --git a/snappymail/v/0.0.0/app/localization/webmail/en_GB.yml b/snappymail/v/0.0.0/app/localization/webmail/en_GB.yml index 840950b7c..34fe9bf3b 100644 --- a/snappymail/v/0.0.0/app/localization/webmail/en_GB.yml +++ b/snappymail/v/0.0.0/app/localization/webmail/en_GB.yml @@ -439,6 +439,7 @@ en_GB: HELP_DELETE_FOLDER: "Delete folder" HELP_SHOW_HIDE_FOLDER: "Show/hide folder" HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages" + HIDE_UNSUBSCRIBED: "Hide unsubscribed folders" SETTINGS_ACCOUNTS: LEGEND_ACCOUNTS: "Accounts" LEGEND_IDENTITIES: "Identities" diff --git a/snappymail/v/0.0.0/app/localization/webmail/en_US.yml b/snappymail/v/0.0.0/app/localization/webmail/en_US.yml index b1bedc535..e98b6a44a 100644 --- a/snappymail/v/0.0.0/app/localization/webmail/en_US.yml +++ b/snappymail/v/0.0.0/app/localization/webmail/en_US.yml @@ -439,6 +439,7 @@ en_US: HELP_DELETE_FOLDER: "Delete folder" HELP_SHOW_HIDE_FOLDER: "Show/hide folder" HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages" + HIDE_UNSUBSCRIBED: "Hide unsubscribed folders" SETTINGS_ACCOUNTS: LEGEND_ACCOUNTS: "Accounts" LEGEND_IDENTITIES: "Identities" diff --git a/snappymail/v/0.0.0/app/localization/webmail/es_ES.yml b/snappymail/v/0.0.0/app/localization/webmail/es_ES.yml index 8b0d43ede..bd0532e45 100644 --- a/snappymail/v/0.0.0/app/localization/webmail/es_ES.yml +++ b/snappymail/v/0.0.0/app/localization/webmail/es_ES.yml @@ -441,6 +441,7 @@ es_ES: HELP_DELETE_FOLDER: "Eliminar carpeta" HELP_SHOW_HIDE_FOLDER: "Mostrar/ocultar carpeta" HELP_CHECK_FOR_NEW_MESSAGES: "Chequear/no chequear nuevos mensajes" + HIDE_UNSUBSCRIBED: "Ocultar carpetas dadas de baja" SETTINGS_ACCOUNTS: LEGEND_ACCOUNTS: "Lista de cuentas" LEGEND_IDENTITIES: "Identidades" diff --git a/snappymail/v/0.0.0/app/localization/webmail/fr_FR.yml b/snappymail/v/0.0.0/app/localization/webmail/fr_FR.yml index f67640847..c3d81dcc5 100644 --- a/snappymail/v/0.0.0/app/localization/webmail/fr_FR.yml +++ b/snappymail/v/0.0.0/app/localization/webmail/fr_FR.yml @@ -440,6 +440,7 @@ fr_FR: HELP_DELETE_FOLDER: "Supprimer le dossier" HELP_SHOW_HIDE_FOLDER: "Afficher/masquer le dossier" HELP_CHECK_FOR_NEW_MESSAGES: "Cocher/Décocher pour les nouveaux messages" + HIDE_UNSUBSCRIBED: "Masquer les dossiers désabonnés" SETTINGS_ACCOUNTS: LEGEND_ACCOUNTS: "Liste des comptes" LEGEND_IDENTITIES: "Identités" diff --git a/snappymail/v/0.0.0/app/localization/webmail/nl_NL.yml b/snappymail/v/0.0.0/app/localization/webmail/nl_NL.yml index 8a37c4761..e1f5cf445 100644 --- a/snappymail/v/0.0.0/app/localization/webmail/nl_NL.yml +++ b/snappymail/v/0.0.0/app/localization/webmail/nl_NL.yml @@ -439,6 +439,7 @@ nl_NL: HELP_DELETE_FOLDER: "Verwijder map" HELP_SHOW_HIDE_FOLDER: "Toon/verberg map" HELP_CHECK_FOR_NEW_MESSAGES: "Controleer wel of niet op nieuwe berichten" + HIDE_UNSUBSCRIBED: "Verberg niet geabonneerde mappen" SETTINGS_ACCOUNTS: LEGEND_ACCOUNTS: "Account Lijst" LEGEND_IDENTITIES: "Identiteiten" diff --git a/snappymail/v/0.0.0/app/localization/webmail/zh_CN.yml b/snappymail/v/0.0.0/app/localization/webmail/zh_CN.yml index 2ff83d1d1..1889a9f28 100644 --- a/snappymail/v/0.0.0/app/localization/webmail/zh_CN.yml +++ b/snappymail/v/0.0.0/app/localization/webmail/zh_CN.yml @@ -437,6 +437,7 @@ zh_CN: HELP_DELETE_FOLDER: "删除文件夹" HELP_SHOW_HIDE_FOLDER: "显示/隐藏文件夹" HELP_CHECK_FOR_NEW_MESSAGES: "检查/不检查新邮件" + HIDE_UNSUBSCRIBED: "隐藏未订阅的文件夹" SETTINGS_ACCOUNTS: LEGEND_ACCOUNTS: "账户列表" LEGEND_IDENTITIES: "身份" diff --git a/snappymail/v/0.0.0/app/templates/Views/User/SettingsFolders.html b/snappymail/v/0.0.0/app/templates/Views/User/SettingsFolders.html index 3251c6634..438aa0cd9 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/SettingsFolders.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/SettingsFolders.html @@ -6,6 +6,13 @@ +