Added feature request #69

This commit is contained in:
djmaze 2021-03-29 12:08:52 +02:00
parent 0dbc534305
commit 5eb7c7515a
16 changed files with 41 additions and 10 deletions

View file

@ -2,6 +2,7 @@ import ko from 'ko';
import { Notification } from 'Common/Enums'; import { Notification } from 'Common/Enums';
import { ClientSideKeyName } from 'Common/EnumsUser'; import { ClientSideKeyName } from 'Common/EnumsUser';
import { Settings } from 'Common/Globals';
import { getNotification } from 'Common/Translator'; import { getNotification } from 'Common/Translator';
import { removeFolderFromCacheList } from 'Common/Cache'; import { removeFolderFromCacheList } from 'Common/Cache';
@ -9,6 +10,7 @@ import { removeFolderFromCacheList } from 'Common/Cache';
import * as Local from 'Storage/Client'; import * as Local from 'Storage/Client';
import { FolderUserStore } from 'Stores/User/Folder'; import { FolderUserStore } from 'Stores/User/Folder';
import { SettingsUserStore } from 'Stores/User/Settings';
import Remote from 'Remote/User/Fetch'; import Remote from 'Remote/User/Fetch';
@ -23,6 +25,7 @@ export class FoldersUserSettings {
this.folderList = FolderUserStore.folderList; this.folderList = FolderUserStore.folderList;
this.folderListOptimized = FolderUserStore.folderListOptimized; this.folderListOptimized = FolderUserStore.folderListOptimized;
this.folderListError = FolderUserStore.folderListError; this.folderListError = FolderUserStore.folderListError;
this.hideUnsubscribed = SettingsUserStore.hideUnsubscribed;
this.loading = ko.computed(() => { this.loading = ko.computed(() => {
const loading = FolderUserStore.foldersLoading(), const loading = FolderUserStore.foldersLoading(),
@ -36,6 +39,9 @@ export class FoldersUserSettings {
this.folderForDeletion = ko.observable(null).deleteAccessHelper(); this.folderForDeletion = ko.observable(null).deleteAccessHelper();
this.folderForEdit = ko.observable(null).extend({ toggleSubscribeProperty: [this, 'edited'] }); 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) { folderEditOnEnter(folder) {

View file

@ -30,6 +30,7 @@ export const SettingsUserStore = new class {
allowDraftAutosave: !!SettingsGet('AllowDraftAutosave'), allowDraftAutosave: !!SettingsGet('AllowDraftAutosave'),
useThreads: !!SettingsGet('UseThreads'), useThreads: !!SettingsGet('UseThreads'),
replySameFolder: !!SettingsGet('ReplySameFolder'), replySameFolder: !!SettingsGet('ReplySameFolder'),
hideUnsubscribed: !!SettingsGet('HideUnsubscribed'),
autoLogout: pInt(SettingsGet('AutoLogout')) autoLogout: pInt(SettingsGet('AutoLogout'))
}); });

View file

@ -6,7 +6,7 @@
} }
.list-table { .list-table {
margin-top: 40px; margin-top: 1em;
.folder-padding { .folder-padding {
display: inline-block; display: inline-block;

View file

@ -1090,6 +1090,7 @@ class Actions
'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), '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' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
'EnableTwoFactor' => false, 'EnableTwoFactor' => false,
'ParentEmail' => '', 'ParentEmail' => '',
'InterfaceAnimation' => true, 'InterfaceAnimation' => true,
@ -1224,6 +1225,7 @@ class Actions
$aResult['SpamFolder'] = (string)$oSettingsLocal->GetConf('SpamFolder', ''); $aResult['SpamFolder'] = (string)$oSettingsLocal->GetConf('SpamFolder', '');
$aResult['TrashFolder'] = (string)$oSettingsLocal->GetConf('TrashFolder', ''); $aResult['TrashFolder'] = (string)$oSettingsLocal->GetConf('TrashFolder', '');
$aResult['ArchiveFolder'] = (string)$oSettingsLocal->GetConf('ArchiveFolder', ''); $aResult['ArchiveFolder'] = (string)$oSettingsLocal->GetConf('ArchiveFolder', '');
$aResult['HideUnsubscribed'] = (bool)$oSettingsLocal->GetConf('HideUnsubscribed', $aResult['HideUnsubscribed']);
} }
if ($this->GetCapa(false, Enumerations\Capa::SETTINGS, $oAccount)) { if ($this->GetCapa(false, Enumerations\Capa::SETTINGS, $oAccount)) {

View file

@ -17,11 +17,17 @@ trait Folders
$oFolderCollection = null; $oFolderCollection = null;
$this->Plugins()->RunHook('filter.folders-before', array($oAccount, $oFolderCollection)); $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) if (null === $oFolderCollection)
{ {
$oFolderCollection = $this->MailClient()->Folders('', $oFolderCollection = $this->MailClient()->Folders('',
'*', '*',
!!$this->Config()->Get('labs', 'use_imap_list_subscribe', true), $HideUnsubscribed,
(int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200) (int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200)
); );
} }
@ -127,7 +133,7 @@ trait Folders
if ($bDoItAgain) if ($bDoItAgain)
{ {
$oFolderCollection = $this->MailClient()->Folders('', '*', $oFolderCollection = $this->MailClient()->Folders('', '*',
!!$this->Config()->Get('labs', 'use_imap_list_subscribe', true), $HideUnsubscribed,
(int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200) (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 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) if ($bListFolderTypes)
{ {
foreach ($oFolders as $oFolder) foreach ($oFolders as $oFolder)
{ {
$iFolderListType = $oFolder->GetFolderListType(); $iFolderType = $oFolder->GetFolderListType();
if (!isset($aResult[$iFolderListType]) && \in_array($iFolderListType, array( if (!isset($aResult[$iFolderType]) && \in_array($iFolderType, array(
FolderType::INBOX, FolderType::INBOX,
FolderType::SENT, FolderType::SENT,
FolderType::DRAFTS, FolderType::DRAFTS,
@ -481,14 +487,14 @@ trait Folders
FolderType::ALL FolderType::ALL
))) )))
{ {
$aResult[$iFolderListType] = $oFolder->FullNameRaw(); $aResult[$iFolderType] = $oFolder->FullNameRaw();
} }
} }
foreach ($oFolders as $oFolder) foreach ($oFolders as $oFolder)
{ {
$oSub = $oFolder->SubFolders(); $oSub = $oFolder->SubFolders();
if ($oSub && 0 < $oSub->Count()) if ($oSub && $oSub->Count())
{ {
$this->recFoldersTypes($oAccount, $oSub, $aResult, true); $this->recFoldersTypes($oAccount, $oSub, $aResult, true);
} }
@ -521,7 +527,7 @@ trait Folders
foreach ($oFolders as $oFolder) foreach ($oFolders as $oFolder)
{ {
$oSub = $oFolder->SubFolders(); $oSub = $oFolder->SubFolders();
if ($oSub && 0 < $oSub->Count()) if ($oSub && $oSub->Count())
{ {
$this->recFoldersTypes($oAccount, $oSub, $aResult, false); $this->recFoldersTypes($oAccount, $oSub, $aResult, false);
} }

View file

@ -368,6 +368,7 @@ trait User
$this->setSettingsFromParams($oSettingsLocal, 'UseThreads', 'bool'); $this->setSettingsFromParams($oSettingsLocal, 'UseThreads', 'bool');
$this->setSettingsFromParams($oSettingsLocal, 'ReplySameFolder', 'bool'); $this->setSettingsFromParams($oSettingsLocal, 'ReplySameFolder', 'bool');
$this->setSettingsFromParams($oSettingsLocal, 'HideUnsubscribed', 'bool');
return $this->DefaultResponse(__FUNCTION__, return $this->DefaultResponse(__FUNCTION__,
$this->SettingsProvider()->Save($oAccount, $oSettings) && $this->SettingsProvider()->Save($oAccount, $oSettings) &&

View file

@ -306,7 +306,7 @@ Enables caching in the system'),
), ),
'labs' => array( 'labs' => array(
'ignore_folders_subscription' => array(false), // 'ignore_folders_subscription' => array(false),
'update_channel' => array('stable'), 'update_channel' => array('stable'),
'allow_prefetch' => array(true), 'allow_prefetch' => array(true),
'allow_smart_html_links' => array(true), 'allow_smart_html_links' => array(true),

View file

@ -439,6 +439,7 @@ en:
HELP_DELETE_FOLDER: "Delete folder" HELP_DELETE_FOLDER: "Delete folder"
HELP_SHOW_HIDE_FOLDER: "Show/hide folder" HELP_SHOW_HIDE_FOLDER: "Show/hide folder"
HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages" HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages"
HIDE_UNSUBSCRIBED: "Hide unsubscribed folders"
SETTINGS_ACCOUNTS: SETTINGS_ACCOUNTS:
LEGEND_ACCOUNTS: "Accounts" LEGEND_ACCOUNTS: "Accounts"
LEGEND_IDENTITIES: "Identities" LEGEND_IDENTITIES: "Identities"

View file

@ -440,6 +440,7 @@ de_DE:
HELP_DELETE_FOLDER: "Ordner löschen" HELP_DELETE_FOLDER: "Ordner löschen"
HELP_SHOW_HIDE_FOLDER: "Ordner ein-/ausblenden" HELP_SHOW_HIDE_FOLDER: "Ordner ein-/ausblenden"
HELP_CHECK_FOR_NEW_MESSAGES: "Auf neue Nachrichten prüfen/nicht prüfen" HELP_CHECK_FOR_NEW_MESSAGES: "Auf neue Nachrichten prüfen/nicht prüfen"
HIDE_UNSUBSCRIBED: "Nicht abonnierte Ordner ausblenden"
SETTINGS_ACCOUNTS: SETTINGS_ACCOUNTS:
LEGEND_ACCOUNTS: "Konten" LEGEND_ACCOUNTS: "Konten"
LEGEND_IDENTITIES: "Identitäten" LEGEND_IDENTITIES: "Identitäten"

View file

@ -439,6 +439,7 @@ en_GB:
HELP_DELETE_FOLDER: "Delete folder" HELP_DELETE_FOLDER: "Delete folder"
HELP_SHOW_HIDE_FOLDER: "Show/hide folder" HELP_SHOW_HIDE_FOLDER: "Show/hide folder"
HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages" HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages"
HIDE_UNSUBSCRIBED: "Hide unsubscribed folders"
SETTINGS_ACCOUNTS: SETTINGS_ACCOUNTS:
LEGEND_ACCOUNTS: "Accounts" LEGEND_ACCOUNTS: "Accounts"
LEGEND_IDENTITIES: "Identities" LEGEND_IDENTITIES: "Identities"

View file

@ -439,6 +439,7 @@ en_US:
HELP_DELETE_FOLDER: "Delete folder" HELP_DELETE_FOLDER: "Delete folder"
HELP_SHOW_HIDE_FOLDER: "Show/hide folder" HELP_SHOW_HIDE_FOLDER: "Show/hide folder"
HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages" HELP_CHECK_FOR_NEW_MESSAGES: "Check/don't check for new messages"
HIDE_UNSUBSCRIBED: "Hide unsubscribed folders"
SETTINGS_ACCOUNTS: SETTINGS_ACCOUNTS:
LEGEND_ACCOUNTS: "Accounts" LEGEND_ACCOUNTS: "Accounts"
LEGEND_IDENTITIES: "Identities" LEGEND_IDENTITIES: "Identities"

View file

@ -441,6 +441,7 @@ es_ES:
HELP_DELETE_FOLDER: "Eliminar carpeta" HELP_DELETE_FOLDER: "Eliminar carpeta"
HELP_SHOW_HIDE_FOLDER: "Mostrar/ocultar carpeta" HELP_SHOW_HIDE_FOLDER: "Mostrar/ocultar carpeta"
HELP_CHECK_FOR_NEW_MESSAGES: "Chequear/no chequear nuevos mensajes" HELP_CHECK_FOR_NEW_MESSAGES: "Chequear/no chequear nuevos mensajes"
HIDE_UNSUBSCRIBED: "Ocultar carpetas dadas de baja"
SETTINGS_ACCOUNTS: SETTINGS_ACCOUNTS:
LEGEND_ACCOUNTS: "Lista de cuentas" LEGEND_ACCOUNTS: "Lista de cuentas"
LEGEND_IDENTITIES: "Identidades" LEGEND_IDENTITIES: "Identidades"

View file

@ -440,6 +440,7 @@ fr_FR:
HELP_DELETE_FOLDER: "Supprimer le dossier" HELP_DELETE_FOLDER: "Supprimer le dossier"
HELP_SHOW_HIDE_FOLDER: "Afficher/masquer le dossier" HELP_SHOW_HIDE_FOLDER: "Afficher/masquer le dossier"
HELP_CHECK_FOR_NEW_MESSAGES: "Cocher/Décocher pour les nouveaux messages" HELP_CHECK_FOR_NEW_MESSAGES: "Cocher/Décocher pour les nouveaux messages"
HIDE_UNSUBSCRIBED: "Masquer les dossiers désabonnés"
SETTINGS_ACCOUNTS: SETTINGS_ACCOUNTS:
LEGEND_ACCOUNTS: "Liste des comptes" LEGEND_ACCOUNTS: "Liste des comptes"
LEGEND_IDENTITIES: "Identités" LEGEND_IDENTITIES: "Identités"

View file

@ -439,6 +439,7 @@ nl_NL:
HELP_DELETE_FOLDER: "Verwijder map" HELP_DELETE_FOLDER: "Verwijder map"
HELP_SHOW_HIDE_FOLDER: "Toon/verberg map" HELP_SHOW_HIDE_FOLDER: "Toon/verberg map"
HELP_CHECK_FOR_NEW_MESSAGES: "Controleer wel of niet op nieuwe berichten" HELP_CHECK_FOR_NEW_MESSAGES: "Controleer wel of niet op nieuwe berichten"
HIDE_UNSUBSCRIBED: "Verberg niet geabonneerde mappen"
SETTINGS_ACCOUNTS: SETTINGS_ACCOUNTS:
LEGEND_ACCOUNTS: "Account Lijst" LEGEND_ACCOUNTS: "Account Lijst"
LEGEND_IDENTITIES: "Identiteiten" LEGEND_IDENTITIES: "Identiteiten"

View file

@ -437,6 +437,7 @@ zh_CN:
HELP_DELETE_FOLDER: "删除文件夹" HELP_DELETE_FOLDER: "删除文件夹"
HELP_SHOW_HIDE_FOLDER: "显示/隐藏文件夹" HELP_SHOW_HIDE_FOLDER: "显示/隐藏文件夹"
HELP_CHECK_FOR_NEW_MESSAGES: "检查/不检查新邮件" HELP_CHECK_FOR_NEW_MESSAGES: "检查/不检查新邮件"
HIDE_UNSUBSCRIBED: "隐藏未订阅的文件夹"
SETTINGS_ACCOUNTS: SETTINGS_ACCOUNTS:
LEGEND_ACCOUNTS: "账户列表" LEGEND_ACCOUNTS: "账户列表"
LEGEND_IDENTITIES: "身份" LEGEND_IDENTITIES: "身份"

View file

@ -6,6 +6,13 @@
<i class="icon-spinner" style="margin-top: 5px" data-bind="visible: loading"></i> <i class="icon-spinner" style="margin-top: 5px" data-bind="visible: loading"></i>
</div> </div>
</div> </div>
<div style="border-bottom: 1px solid rgba(128,128,128,0.5);margin-bottom:20px;" data-bind="visible: useImapSubscribe, component: {
name: 'Checkbox',
params: {
label: 'SETTINGS_FOLDERS/HIDE_UNSUBSCRIBED',
value: hideUnsubscribed
}
}"></div>
<a class="btn" data-bind="click: createFolder"> <a class="btn" data-bind="click: createFolder">
<i class="icon-folder-add"></i> <i class="icon-folder-add"></i>
<span data-i18n="SETTINGS_FOLDERS/BUTTON_CREATE"></span> <span data-i18n="SETTINGS_FOLDERS/BUTTON_CREATE"></span>