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',
OpenPGP: 'OPEN_PGP',
Prefetch: 'PREFETCH',
Folders: 'FOLDERS',
Composer: 'COMPOSER',
Contacts: 'CONTACTS',
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 leftPanelDisabled = ko.observable(false);
export const leftPanelType = ko.observable('');
export const createElement = (name, attr) => {
let el = doc.createElement(name);
@ -26,11 +25,6 @@ leftPanelDisabled.subscribe(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));
// keys

View file

@ -1,6 +1,5 @@
import { Capa } from 'Common/Enums';
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 { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache';
import { i18n } from 'Common/Translator';
@ -58,12 +57,6 @@ export class MailBoxUserScreen extends AbstractScreen {
AppStore.focusedState(Focused.MessageList);
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 { keyScope, leftPanelType, leftPanelDisabled, Settings } from 'Common/Globals';
import { keyScope, leftPanelDisabled, Settings } from 'Common/Globals';
import { runSettingsViewModelHooks } from 'Common/Plugins';
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)) {
settingsAddViewModel(ThemesUserSettings, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
@ -99,8 +97,6 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
onShow() {
this.setSettingsTitle();
keyScope(KeyState.Settings);
leftPanelType('');
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{
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.rl-ctrl-key-pressed .hidden-on-ctrl-btn,
.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-no-preview-pane {

View file

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

View file

@ -40,7 +40,6 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
this.allowComposer = !!Settings.capa(Capa.Composer);
this.allowContacts = !!AppStore.contactsIsAllowed();
this.allowFolders = !!Settings.capa(Capa.Folders);
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.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
this.allowDangerousActions = !!Settings.capa(Capa.DangerousActions);
this.allowFolders = !!Settings.capa(Capa.Folders);
this.popupVisibility = popupVisibility;

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
</a>
<a class="btn buttonContacts fontastic" data-bind="visible: allowContacts, click: contactsClick, tooltip: 'GLOBAL/CONTACTS'">📇</a>
</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-wrapper">
<div class="b-folders-system" data-bind="template: { name: 'MailFolderListSystemItem', foreach: folderListSystem }"></div>
@ -17,7 +17,7 @@
</div>
</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">
<a class="btn buttonResize" data-bind="click: function () { leftPanelDisabled(!leftPanelDisabled()); }">
<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() }">
<div class="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: 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()">
<i class="icon-paper-plane"></i>
</a>

View file

@ -4,7 +4,7 @@
<i data-bind="css: {'icon-paper-plane': !sending(), 'icon-spinner': sending()}"></i>
<span class="hide-mobile" data-i18n="COMPOSE/BUTTON_SEND"></span>
</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>
<span class="hide-mobile" data-i18n="GLOBAL/SAVE"></span>
</a>