Added "subscribe" option to create folder popup

This commit is contained in:
the-djmaze 2022-01-12 11:15:04 +01:00
parent a568c3f4f8
commit 661e937fd1
3 changed files with 19 additions and 6 deletions

View file

@ -5,8 +5,10 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { defaultOptionsAfterRender } from 'Common/Utils';
import { folderListOptionsBuilder, sortFolders } from 'Common/UtilsUser';
import { getNotification } from 'Common/Translator';
import { Settings } from 'Common/Globals';
import { FolderUserStore } from 'Stores/User/Folder';
import { SettingsUserStore } from 'Stores/User/Settings';
import Remote from 'Remote/User/Fetch';
@ -20,8 +22,11 @@ class FolderCreatePopupView extends AbstractViewPopup {
constructor() {
super('FolderCreate');
this.useImapSubscribe = Settings.app('useImapSubscribe');
this.addObservables({
folderName: '',
folderSubscribe: this.useImapSubscribe && SettingsUserStore.hideUnsubscribed,
selectedParentValue: UNUSED_OPTION_VALUE
});
@ -54,7 +59,8 @@ class FolderCreatePopupView extends AbstractViewPopup {
Remote.abort('Folders').post('FolderCreate', FolderUserStore.foldersCreating, {
Folder: this.folderName(),
Parent: parentFolderName
Parent: parentFolderName,
Subscribe: this.folderSubscribe() ? 1 : 0
})
.then(
data => {

View file

@ -223,11 +223,11 @@ trait Folders
try
{
$sFolderNameInUtf = $this->GetActionParam('Folder', '');
$sFolderParentFullName = $this->GetActionParam('Parent', '');
$oFolder = $this->MailClient()->FolderCreate($sFolderNameInUtf, $sFolderParentFullName,
!!$this->Config()->Get('labs', 'use_imap_list_subscribe', true));
$oFolder = $this->MailClient()->FolderCreate(
$this->GetActionParam('Folder', ''),
$this->GetActionParam('Parent', ''),
!!$this->GetActionParam('Subscribe', !!$this->Config()->Get('labs', 'use_imap_list_subscribe', true))
);
// FolderInformation(string $sFolderName, int $iPrevUidNext = 0, array $aUids = array())
return $this->DefaultResponse(__FUNCTION__, $oFolder);

View file

@ -15,6 +15,13 @@
autofocus="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: folderName, onEnter: createFolderCommand" />
</div>
<div class="control-group" data-bind="visible: useImapSubscribe, component: {
name: 'Checkbox',
params: {
label: 'SETTINGS_FOLDERS/BUTTON_SUBSCRIBE',
value: folderSubscribe
}
}"></div>
</div>
</div>
<footer>