Remove capa.Folders and always allow mailbox folders

This commit is contained in:
djmaze 2021-03-06 10:07:54 +01:00
parent 1ac96c93d6
commit e8deb4ff16
16 changed files with 21 additions and 105 deletions

View file

@ -18,7 +18,6 @@ export const Capa = {
TwoFactorForce: 'TWO_FACTOR_FORCE', TwoFactorForce: 'TWO_FACTOR_FORCE',
OpenPGP: 'OPEN_PGP', OpenPGP: 'OPEN_PGP',
Prefetch: 'PREFETCH', Prefetch: 'PREFETCH',
Folders: 'FOLDERS',
Composer: 'COMPOSER', Composer: 'COMPOSER',
Contacts: 'CONTACTS', Contacts: 'CONTACTS',
Reload: 'RELOAD', Reload: 'RELOAD',

View file

@ -13,7 +13,6 @@ export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 });
export const moveAction = ko.observable(false); export const moveAction = ko.observable(false);
export const leftPanelDisabled = ko.observable(false); export const leftPanelDisabled = ko.observable(false);
export const leftPanelType = ko.observable('');
export const createElement = (name, attr) => { export const createElement = (name, attr) => {
let el = doc.createElement(name); let el = doc.createElement(name);
@ -26,11 +25,6 @@ leftPanelDisabled.subscribe(value => {
$htmlCL.toggle('rl-left-panel-disabled', value); $htmlCL.toggle('rl-left-panel-disabled', value);
}); });
leftPanelType.subscribe(sValue => {
$htmlCL.toggle('rl-left-panel-none', 'none' === sValue);
$htmlCL.toggle('rl-left-panel-short', 'short' === sValue);
});
moveAction.subscribe(value => value && leftPanelDisabled() && leftPanelDisabled(false)); moveAction.subscribe(value => value && leftPanelDisabled() && leftPanelDisabled(false));
// keys // keys

View file

@ -1,6 +1,5 @@
import { Capa } from 'Common/Enums';
import { Focused } from 'Common/EnumsUser'; import { Focused } from 'Common/EnumsUser';
import { doc, leftPanelDisabled, leftPanelType, moveAction, Settings } from 'Common/Globals'; import { doc, leftPanelDisabled, moveAction, Settings } from 'Common/Globals';
import { pString, pInt } from 'Common/Utils'; import { pString, pInt } from 'Common/Utils';
import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache'; import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
@ -58,12 +57,6 @@ export class MailBoxUserScreen extends AbstractScreen {
AppStore.focusedState(Focused.MessageList); AppStore.focusedState(Focused.MessageList);
ThemeStore.isMobile() && leftPanelDisabled(true); ThemeStore.isMobile() && leftPanelDisabled(true);
if (Settings.capa(Capa.Folders)) {
leftPanelType('');
} else {
leftPanelType(Settings.capa(Capa.Composer) || Settings.capa(Capa.Contacts) ? 'short' : 'none');
}
} }
/** /**

View file

@ -1,5 +1,5 @@
import { Capa, KeyState } from 'Common/Enums'; import { Capa, KeyState } from 'Common/Enums';
import { keyScope, leftPanelType, leftPanelDisabled, Settings } from 'Common/Globals'; import { keyScope, leftPanelDisabled, Settings } from 'Common/Globals';
import { runSettingsViewModelHooks } from 'Common/Plugins'; import { runSettingsViewModelHooks } from 'Common/Plugins';
import { initOnStartOrLangChange, i18n } from 'Common/Translator'; import { initOnStartOrLangChange, i18n } from 'Common/Translator';
@ -77,9 +77,7 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
); );
} }
if (Settings.capa(Capa.Folders)) {
settingsAddViewModel(FoldersUserSettings, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders'); settingsAddViewModel(FoldersUserSettings, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
}
if (Settings.capa(Capa.Themes)) { if (Settings.capa(Capa.Themes)) {
settingsAddViewModel(ThemesUserSettings, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes'); settingsAddViewModel(ThemesUserSettings, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
@ -99,8 +97,6 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
onShow() { onShow() {
this.setSettingsTitle(); this.setSettingsTitle();
keyScope(KeyState.Settings); keyScope(KeyState.Settings);
leftPanelType('');
ThemeStore.isMobile() && leftPanelDisabled(true); ThemeStore.isMobile() && leftPanelDisabled(true);
} }

View file

@ -258,7 +258,7 @@
} }
} }
html.rl-left-panel-disabled, html.rl-left-panel-short { html.rl-left-panel-disabled {
.buttonComposeText{ .buttonComposeText{
display: none; display: none;
} }

View file

@ -223,11 +223,6 @@ html:not(.rl-left-panel-disabled) #rl-left.resizable > .resizer,
} }
} }
.hidden-on-ctrl-btn,
.visible-on-ctrl-btn {
display: inline-block;
}
html:not(.rl-ctrl-key-pressed) .visible-on-ctrl-btn, html:not(.rl-ctrl-key-pressed) .visible-on-ctrl-btn,
html.rl-ctrl-key-pressed .hidden-on-ctrl-btn, html.rl-ctrl-key-pressed .hidden-on-ctrl-btn,
.show-on-panel-disabled { .show-on-panel-disabled {
@ -257,16 +252,6 @@ html.rl-left-panel-disabled {
} }
} }
html.rl-left-panel-short #rl-left,
html.rl-left-panel-short #rl-right {
width: 60px !important;
}
html.rl-left-panel-none #rl-left,
html.rl-left-panel-none #rl-right {
width: 10px !important;
}
html.rl-mobile, html.rl-mobile,
html.rl-no-preview-pane { html.rl-no-preview-pane {

View file

@ -1,7 +1,6 @@
import ko from 'ko'; import ko from 'ko';
import { import {
Capa,
KeyState, KeyState,
StorageResultType, StorageResultType,
Notification, Notification,
@ -128,7 +127,6 @@ class ComposePopupView extends AbstractViewPopup {
this.sLastFocusedField = 'to'; this.sLastFocusedField = 'to';
this.allowContacts = !!AppStore.contactsIsAllowed(); this.allowContacts = !!AppStore.contactsIsAllowed();
this.allowFolders = !!Settings.capa(Capa.Folders);
this.bSkipNextHide = false; this.bSkipNextHide = false;
this.composeInEdit = AppStore.composeInEdit; this.composeInEdit = AppStore.composeInEdit;
@ -398,10 +396,6 @@ class ComposePopupView extends AbstractViewPopup {
} }
} }
if (!this.allowFolders) {
sSentFolder = UNUSED_OPTION_VALUE;
}
if (!sSentFolder) { if (!sSentFolder) {
showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Sent]); showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Sent]);
} else { } else {
@ -437,10 +431,6 @@ class ComposePopupView extends AbstractViewPopup {
} }
saveCommand() { saveCommand() {
if (!this.allowFolders) {
return false;
}
if (FolderStore.draftFolderNotEnabled()) { if (FolderStore.draftFolderNotEnabled()) {
showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Draft]); showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Draft]);
} else { } else {
@ -1146,7 +1136,6 @@ class ComposePopupView extends AbstractViewPopup {
return false; return false;
}); });
if (this.allowFolders) {
shortcuts.add('s', 'meta', KeyState.Compose, () => { shortcuts.add('s', 'meta', KeyState.Compose, () => {
this.saveCommand(); this.saveCommand();
return false; return false;
@ -1155,7 +1144,6 @@ class ComposePopupView extends AbstractViewPopup {
this.saveCommand(); this.saveCommand();
return false; return false;
}); });
}
if (Settings.app('allowCtrlEnterOnCompose')) { if (Settings.app('allowCtrlEnterOnCompose')) {
shortcuts.add('enter', 'meta', KeyState.Compose, () => { shortcuts.add('enter', 'meta', KeyState.Compose, () => {

View file

@ -40,7 +40,6 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
this.allowComposer = !!Settings.capa(Capa.Composer); this.allowComposer = !!Settings.capa(Capa.Composer);
this.allowContacts = !!AppStore.contactsIsAllowed(); this.allowContacts = !!AppStore.contactsIsAllowed();
this.allowFolders = !!Settings.capa(Capa.Folders);
this.folderListFocused = ko.computed(() => Focused.FolderList === AppStore.focusedState()); this.folderListFocused = ko.computed(() => Focused.FolderList === AppStore.focusedState());

View file

@ -69,7 +69,6 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
this.allowComposer = !!Settings.capa(Capa.Composer); this.allowComposer = !!Settings.capa(Capa.Composer);
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions); this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
this.allowDangerousActions = !!Settings.capa(Capa.DangerousActions); this.allowDangerousActions = !!Settings.capa(Capa.DangerousActions);
this.allowFolders = !!Settings.capa(Capa.Folders);
this.popupVisibility = popupVisibility; this.popupVisibility = popupVisibility;

View file

@ -1220,8 +1220,6 @@ class Actions
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
if ($oSettingsLocal instanceof Settings) { if ($oSettingsLocal instanceof Settings) {
// if ($this->GetCapa(false, Enumerations\Capa::FOLDERS, $oAccount))
$aResult['SentFolder'] = (string)$oSettingsLocal->GetConf('SentFolder', ''); $aResult['SentFolder'] = (string)$oSettingsLocal->GetConf('SentFolder', '');
$aResult['DraftFolder'] = (string)$oSettingsLocal->GetConf('DraftFolder', ''); $aResult['DraftFolder'] = (string)$oSettingsLocal->GetConf('DraftFolder', '');
$aResult['SpamFolder'] = (string)$oSettingsLocal->GetConf('SpamFolder', ''); $aResult['SpamFolder'] = (string)$oSettingsLocal->GetConf('SpamFolder', '');
@ -2036,9 +2034,6 @@ class Actions
$aResult = array(); $aResult = array();
if ($oConfig->Get('capa', 'folders', true)) {
$aResult[] = Enumerations\Capa::FOLDERS;
if ($oConfig->Get('capa', 'messagelist_actions', true)) { if ($oConfig->Get('capa', 'messagelist_actions', true)) {
$aResult[] = Enumerations\Capa::MESSAGELIST_ACTIONS; $aResult[] = Enumerations\Capa::MESSAGELIST_ACTIONS;
@ -2046,7 +2041,6 @@ class Actions
$aResult[] = Enumerations\Capa::DANGEROUS_ACTIONS; $aResult[] = Enumerations\Capa::DANGEROUS_ACTIONS;
} }
} }
}
if ($oConfig->Get('capa', 'reload', true)) { if ($oConfig->Get('capa', 'reload', true)) {
$aResult[] = Enumerations\Capa::RELOAD; $aResult[] = Enumerations\Capa::RELOAD;

View file

@ -17,12 +17,10 @@ trait Folders
$oFolderCollection = null; $oFolderCollection = null;
$this->Plugins()->RunHook('filter.folders-before', array($oAccount, $oFolderCollection)); $this->Plugins()->RunHook('filter.folders-before', array($oAccount, $oFolderCollection));
$bUseFolders = $this->GetCapa(false, Capa::FOLDERS, $oAccount);
if (null === $oFolderCollection) if (null === $oFolderCollection)
{ {
$oFolderCollection = $this->MailClient()->Folders('', $oFolderCollection = $this->MailClient()->Folders('',
$bUseFolders ? '*' : 'INBOX', '*',
!!$this->Config()->Get('labs', 'use_imap_list_subscribe', true), !!$this->Config()->Get('labs', 'use_imap_list_subscribe', true),
(int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200) (int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200)
); );
@ -38,7 +36,7 @@ trait Folders
$this->recFoldersTypes($oAccount, $oFolderCollection, $aSystemFolders); $this->recFoldersTypes($oAccount, $oFolderCollection, $aSystemFolders);
$oFolderCollection->SystemFolders = $aSystemFolders; $oFolderCollection->SystemFolders = $aSystemFolders;
if ($bUseFolders && $this->Config()->Get('labs', 'autocreate_system_folders', true)) if ($this->Config()->Get('labs', 'autocreate_system_folders', true))
{ {
$bDoItAgain = false; $bDoItAgain = false;
@ -157,11 +155,6 @@ trait Folders
{ {
$oAccount = $this->initMailClientConnection(); $oAccount = $this->initMailClientConnection();
if (!$this->GetCapa(false, Capa::FOLDERS, $oAccount))
{
return $this->FalseResponse(__FUNCTION__);
}
try try
{ {
$sFolderNameInUtf = $this->GetActionParam('Folder', ''); $sFolderNameInUtf = $this->GetActionParam('Folder', '');
@ -182,11 +175,6 @@ trait Folders
{ {
$oAccount = $this->initMailClientConnection(); $oAccount = $this->initMailClientConnection();
if (!$this->GetCapa(false, Capa::FOLDERS, $oAccount))
{
return $this->FalseResponse(__FUNCTION__);
}
$sFolderFullNameRaw = $this->GetActionParam('Folder', ''); $sFolderFullNameRaw = $this->GetActionParam('Folder', '');
$bSubscribe = '1' === (string) $this->GetActionParam('Subscribe', '0'); $bSubscribe = '1' === (string) $this->GetActionParam('Subscribe', '0');
@ -213,11 +201,6 @@ trait Folders
{ {
$oAccount = $this->getAccountFromToken(); $oAccount = $this->getAccountFromToken();
if (!$this->GetCapa(false, Capa::FOLDERS, $oAccount))
{
return $this->FalseResponse(__FUNCTION__);
}
$sFolderFullNameRaw = $this->GetActionParam('Folder', ''); $sFolderFullNameRaw = $this->GetActionParam('Folder', '');
$bCheckable = '1' === (string) $this->GetActionParam('Checkable', '0'); $bCheckable = '1' === (string) $this->GetActionParam('Checkable', '0');
@ -263,11 +246,6 @@ trait Folders
{ {
$oAccount = $this->initMailClientConnection(); $oAccount = $this->initMailClientConnection();
if (!$this->GetCapa(false, Capa::FOLDERS, $oAccount))
{
return $this->FalseResponse(__FUNCTION__);
}
$sPrevFolderFullNameRaw = $this->GetActionParam('Folder', ''); $sPrevFolderFullNameRaw = $this->GetActionParam('Folder', '');
$sNewTopFolderNameInUtf = $this->GetActionParam('NewFolderName', ''); $sNewTopFolderNameInUtf = $this->GetActionParam('NewFolderName', '');
@ -291,11 +269,6 @@ trait Folders
{ {
$oAccount = $this->initMailClientConnection(); $oAccount = $this->initMailClientConnection();
if (!$this->GetCapa(false, Capa::FOLDERS, $oAccount))
{
return $this->FalseResponse(__FUNCTION__);
}
$sFolderFullNameRaw = $this->GetActionParam('Folder', ''); $sFolderFullNameRaw = $this->GetActionParam('Folder', '');
try try

View file

@ -178,7 +178,6 @@ class Application extends \RainLoop\Config\AbstractConfig
), ),
'capa' => array( 'capa' => array(
'folders' => array(true),
'composer' => array(true), 'composer' => array(true),
'contacts' => array(true), 'contacts' => array(true),
'settings' => array(true), 'settings' => array(true),

View file

@ -16,7 +16,6 @@ class Capa
const ATTACHMENT_THUMBNAILS = 'ATTACHMENT_THUMBNAILS'; const ATTACHMENT_THUMBNAILS = 'ATTACHMENT_THUMBNAILS';
const ADDITIONAL_ACCOUNTS = 'ADDITIONAL_ACCOUNTS'; const ADDITIONAL_ACCOUNTS = 'ADDITIONAL_ACCOUNTS';
const IDENTITIES = 'IDENTITIES'; const IDENTITIES = 'IDENTITIES';
const FOLDERS = 'FOLDERS';
const COMPOSER = 'COMPOSER'; const COMPOSER = 'COMPOSER';
const CONTACTS = 'CONTACTS'; const CONTACTS = 'CONTACTS';
const RELOAD = 'RELOAD'; const RELOAD = 'RELOAD';

View file

@ -6,7 +6,7 @@
</a> </a>
<a class="btn buttonContacts fontastic" data-bind="visible: allowContacts, click: contactsClick, tooltip: 'GLOBAL/CONTACTS'">📇</a> <a class="btn buttonContacts fontastic" data-bind="visible: allowContacts, click: contactsClick, tooltip: 'GLOBAL/CONTACTS'">📇</a>
</div> </div>
<div class="b-content opacity-on-panel-disabled" data-bind="visible: allowFolders, css: {'inbox-is-starred': isInboxStarred}"> <div class="b-content opacity-on-panel-disabled" data-bind="css: {'inbox-is-starred': isInboxStarred}">
<div class="content"> <div class="content">
<div class="content-wrapper"> <div class="content-wrapper">
<div class="b-folders-system" data-bind="template: { name: 'MailFolderListSystemItem', foreach: folderListSystem }"></div> <div class="b-folders-system" data-bind="template: { name: 'MailFolderListSystemItem', foreach: folderListSystem }"></div>
@ -17,7 +17,7 @@
</div> </div>
</div> </div>
<div class="b-content show-on-panel-disabled" data-bind="click: function () { leftPanelDisabled(false); }"></div> <div class="b-content show-on-panel-disabled" data-bind="click: function () { leftPanelDisabled(false); }"></div>
<div class="b-footer btn-toolbar hide-mobile" data-bind="visible: allowFolders"> <div class="b-footer btn-toolbar hide-mobile">
<div class="btn-group"> <div class="btn-group">
<a class="btn buttonResize" data-bind="click: function () { leftPanelDisabled(!leftPanelDisabled()); }"> <a class="btn buttonResize" data-bind="click: function () { leftPanelDisabled(!leftPanelDisabled()); }">
<i data-bind="css: {'icon-resize-out': leftPanelDisabled(), 'icon-resize-in': !leftPanelDisabled()}"></i> <i data-bind="css: {'icon-resize-out': leftPanelDisabled(), 'icon-resize-in': !leftPanelDisabled()}"></i>

View file

@ -3,10 +3,8 @@
data-bind="css: {'message-selected': isMessageSelected, 'message-focused': !messageListFocused(), 'hideMessageListCheckbox': !useCheckboxesInList() }"> data-bind="css: {'message-selected': isMessageSelected, 'message-focused': !messageListFocused(), 'hideMessageListCheckbox': !useCheckboxesInList() }">
<div class="toolbar"> <div class="toolbar">
<div class="btn-toolbar"> <div class="btn-toolbar">
<!-- ko if: allowFolders -->
<a class="btn btn-thin-2 fontastic show-mobile" data-bind="click: hideLeft, visible: !leftPanelDisabled()"></a> <a class="btn btn-thin-2 fontastic show-mobile" data-bind="click: hideLeft, visible: !leftPanelDisabled()"></a>
<a class="btn btn-thin-2 fontastic show-mobile" data-bind="click: showLeft, visible: leftPanelDisabled()"></a> <a class="btn btn-thin-2 fontastic show-mobile" data-bind="click: showLeft, visible: leftPanelDisabled()"></a>
<!-- /ko -->
<a class="btn buttonCompose show-mobile" data-bind="click: composeClick, tooltip: 'FOLDER_LIST/BUTTON_NEW_MESSAGE', css: {'btn-warning': composeInEdit, 'btn-success': !composeInEdit()}, visible: allowComposer && mobileCheckedStateHide()"> <a class="btn buttonCompose show-mobile" data-bind="click: composeClick, tooltip: 'FOLDER_LIST/BUTTON_NEW_MESSAGE', css: {'btn-warning': composeInEdit, 'btn-success': !composeInEdit()}, visible: allowComposer && mobileCheckedStateHide()">
<i class="icon-paper-plane"></i> <i class="icon-paper-plane"></i>
</a> </a>

View file

@ -4,7 +4,7 @@
<i data-bind="css: {'icon-paper-plane': !sending(), 'icon-spinner': sending()}"></i> <i data-bind="css: {'icon-paper-plane': !sending(), 'icon-spinner': sending()}"></i>
<span class="hide-mobile" data-i18n="COMPOSE/BUTTON_SEND"></span> <span class="hide-mobile" data-i18n="COMPOSE/BUTTON_SEND"></span>
</a> </a>
<a class="btn button-save" data-bind="visible: allowFolders, command: saveCommand, tooltipErrorTip: savedErrorDesc, css: {'btn-danger': savedError }"> <a class="btn button-save" data-bind="command: saveCommand, tooltipErrorTip: savedErrorDesc, css: {'btn-danger': savedError }">
<i class="fontastic" data-bind="css: {'icon-spinner': saving()}">💾</i> <i class="fontastic" data-bind="css: {'icon-spinner': saving()}">💾</i>
<span class="hide-mobile" data-i18n="GLOBAL/SAVE"></span> <span class="hide-mobile" data-i18n="GLOBAL/SAVE"></span>
</a> </a>