mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Merge branch 'master' into UserMailTemplates
# Conflicts: # dev/App/User.js # dev/Common/Enums.js # dev/Screen/User/Settings.js # dev/Settings/Admin/General.js # snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php # snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Admin.php # snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php
This commit is contained in:
commit
f7f56b3789
794 changed files with 96444 additions and 74188 deletions
|
|
@ -1,29 +1,32 @@
|
|||
import { Scope } from 'Common/Enums';
|
||||
import { doc, leftPanelDisabled, moveAction, Settings } from 'Common/Globals';
|
||||
import { Layout, ClientSideKeyNameMessageListSize } from 'Common/EnumsUser';
|
||||
import { doc, leftPanelDisabled, moveAction, Settings, elementById } from 'Common/Globals';
|
||||
import { pString, pInt } from 'Common/Utils';
|
||||
import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache';
|
||||
import { setLayoutResizer } from 'Common/UtilsUser';
|
||||
import { getFolderFromCacheList, getFolderFullName, getFolderInboxName } from 'Common/Cache';
|
||||
import { i18n } from 'Common/Translator';
|
||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
|
||||
import { AppUserStore } from 'Stores/User/App';
|
||||
import { AccountUserStore } from 'Stores/User/Account';
|
||||
import { FolderUserStore } from 'Stores/User/Folder';
|
||||
import { MessageUserStore } from 'Stores/User/Message';
|
||||
import { MessagelistUserStore } from 'Stores/User/Messagelist';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
import { SystemDropDownMailBoxUserView } from 'View/User/MailBox/SystemDropDown';
|
||||
import { FolderListMailBoxUserView } from 'View/User/MailBox/FolderList';
|
||||
import { MessageListMailBoxUserView } from 'View/User/MailBox/MessageList';
|
||||
import { MessageViewMailBoxUserView } from 'View/User/MailBox/MessageView';
|
||||
import { SystemDropDownUserView } from 'View/User/SystemDropDown';
|
||||
import { MailFolderList } from 'View/User/MailBox/FolderList';
|
||||
import { MailMessageList } from 'View/User/MailBox/MessageList';
|
||||
import { MailMessageView } from 'View/User/MailBox/MessageView';
|
||||
|
||||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
export class MailBoxUserScreen extends AbstractScreen {
|
||||
constructor() {
|
||||
super('mailbox', [
|
||||
SystemDropDownMailBoxUserView,
|
||||
FolderListMailBoxUserView,
|
||||
MessageListMailBoxUserView,
|
||||
MessageViewMailBoxUserView
|
||||
SystemDropDownUserView,
|
||||
MailFolderList,
|
||||
MailMessageList,
|
||||
MailMessageView
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +51,7 @@ export class MailBoxUserScreen extends AbstractScreen {
|
|||
onShow() {
|
||||
this.updateWindowTitle();
|
||||
|
||||
AppUserStore.focusedState(Scope.None);
|
||||
AppUserStore.focusedState('none');
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
|
|
@ -61,17 +64,17 @@ export class MailBoxUserScreen extends AbstractScreen {
|
|||
* @returns {void}
|
||||
*/
|
||||
onRoute(folderHash, page, search) {
|
||||
const folder = getFolderFromCacheList(getFolderFullNameRaw(folderHash.replace(/~([\d]+)$/, '')));
|
||||
const folder = getFolderFromCacheList(getFolderFullName(folderHash.replace(/~([\d]+)$/, '')));
|
||||
if (folder) {
|
||||
let threadUid = folderHash.replace(/^.+~(\d+)$/, '$1');
|
||||
|
||||
FolderUserStore.currentFolder(folder);
|
||||
|
||||
MessageUserStore.listPage(1 > page ? 1 : page);
|
||||
MessageUserStore.listSearch(search);
|
||||
MessageUserStore.listThreadUid((folderHash === threadUid) ? 0 : pInt(threadUid));
|
||||
MessagelistUserStore.page(1 > page ? 1 : page);
|
||||
MessagelistUserStore.listSearch(search);
|
||||
MessagelistUserStore.threadUid((folderHash === threadUid) ? 0 : pInt(threadUid));
|
||||
|
||||
rl.app.reloadMessageList();
|
||||
MessagelistUserStore.reload();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,27 +82,41 @@ export class MailBoxUserScreen extends AbstractScreen {
|
|||
* @returns {void}
|
||||
*/
|
||||
onStart() {
|
||||
if (!this.__started) {
|
||||
super.onStart();
|
||||
super.onStart();
|
||||
|
||||
addEventListener('mailbox.inbox-unread-count', e => {
|
||||
FolderUserStore.foldersInboxUnreadCount(e.detail);
|
||||
|
||||
const email = AccountUserStore.email();
|
||||
AccountUserStore.accounts.forEach(item =>
|
||||
item && email === item.email && item.count(e.detail)
|
||||
);
|
||||
|
||||
this.updateWindowTitle();
|
||||
});
|
||||
}
|
||||
addEventListener('mailbox.inbox-unread-count', e => {
|
||||
FolderUserStore.foldersInboxUnreadCount(e.detail);
|
||||
/* // Disabled in SystemDropDown.html
|
||||
const email = AccountUserStore.email();
|
||||
AccountUserStore.accounts.forEach(item =>
|
||||
item && email === item.email && item.count(e.detail)
|
||||
);
|
||||
*/
|
||||
this.updateWindowTitle();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
onBuild() {
|
||||
setTimeout(() => rl.app.initHorizontalLayoutResizer(), 1);
|
||||
setTimeout(() => {
|
||||
// initMailboxLayoutResizer
|
||||
const top = elementById('V-MailMessageList'),
|
||||
bottom = elementById('V-MailMessageView'),
|
||||
fToggle = () => {
|
||||
let layout = SettingsUserStore.layout();
|
||||
setLayoutResizer(top, bottom, ClientSideKeyNameMessageListSize,
|
||||
(ThemeStore.isMobile() || Layout.NoPreview === layout)
|
||||
? 0
|
||||
: (Layout.SidePreview === layout ? 'Width' : 'Height')
|
||||
);
|
||||
};
|
||||
if (top && bottom) {
|
||||
fToggle();
|
||||
addEventListener('rl-layout', fToggle);
|
||||
}
|
||||
}, 1);
|
||||
|
||||
doc.addEventListener('click', event =>
|
||||
event.target.closest('#rl-right') && moveAction(false)
|
||||
|
|
@ -107,19 +124,23 @@ export class MailBoxUserScreen extends AbstractScreen {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse link as generated by mailBox()
|
||||
* @returns {Array}
|
||||
*/
|
||||
routes() {
|
||||
const
|
||||
folder = (request, vals) => request ? decodeURI(pString(vals[0])) : getFolderInboxName(),
|
||||
folder = (request, vals) => request ? pString(vals[0]) : getFolderInboxName(),
|
||||
fNormS = (request, vals) => [folder(request, vals), request ? pInt(vals[1]) : 1, decodeURI(pString(vals[2]))];
|
||||
|
||||
return [
|
||||
// Folder: INBOX | INBOX.sub | Sent | fullNameHash
|
||||
[/^([^/]*)$/, { normalize_: fNormS }],
|
||||
[/^([a-zA-Z0-9~]+)\/(.+)\/?$/, { normalize_: (request, vals) =>
|
||||
// Search: {folder}/{string}
|
||||
[/^([a-zA-Z0-9.~_-]+)\/(.+)\/?$/, { normalize_: (request, vals) =>
|
||||
[folder(request, vals), 1, decodeURI(pString(vals[1]))]
|
||||
}],
|
||||
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)(?:\/(.+)\/?)?$/, { normalize_: fNormS }]
|
||||
// Page: {folder}/p{int}(/{search})?
|
||||
[/^([a-zA-Z0-9.~_-]+)\/p([1-9][0-9]*)(?:\/(.+))?$/, { normalize_: fNormS }]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Capa, Scope } from 'Common/Enums';
|
||||
import { keyScope, leftPanelDisabled, Settings } from 'Common/Globals';
|
||||
import { Scope } from 'Common/Enums';
|
||||
import { keyScope, leftPanelDisabled, SettingsCapa } from 'Common/Globals';
|
||||
import { runSettingsViewModelHooks } from 'Common/Plugins';
|
||||
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
||||
|
||||
|
|
@ -9,23 +9,59 @@ import { ThemeStore } from 'Stores/Theme';
|
|||
|
||||
import { AbstractSettingsScreen, settingsAddViewModel } from 'Screen/AbstractSettings';
|
||||
|
||||
import { GeneralUserSettings } from 'Settings/User/General';
|
||||
import { ContactsUserSettings } from 'Settings/User/Contacts';
|
||||
import { AccountsUserSettings } from 'Settings/User/Accounts';
|
||||
import { FiltersUserSettings } from 'Settings/User/Filters';
|
||||
import { SecurityUserSettings } from 'Settings/User/Security';
|
||||
import { TemplatesUserSettings } from 'Settings/User/Templates';
|
||||
import { FoldersUserSettings } from 'Settings/User/Folders';
|
||||
import { ThemesUserSettings } from 'Settings/User/Themes';
|
||||
import { OpenPgpUserSettings } from 'Settings/User/OpenPgp';
|
||||
import { UserSettingsGeneral } from 'Settings/User/General';
|
||||
import { UserSettingsContacts } from 'Settings/User/Contacts';
|
||||
import { UserSettingsAccounts } from 'Settings/User/Accounts';
|
||||
import { UserSettingsFilters } from 'Settings/User/Filters';
|
||||
import { UserSettingsSecurity } from 'Settings/User/Security';
|
||||
import { UserSettingsFolders } from 'Settings/User/Folders';
|
||||
import { UserSettingsThemes } from 'Settings/User/Themes';
|
||||
|
||||
import { SystemDropDownSettingsUserView } from 'View/User/Settings/SystemDropDown';
|
||||
import { MenuSettingsUserView } from 'View/User/Settings/Menu';
|
||||
import { PaneSettingsUserView } from 'View/User/Settings/Pane';
|
||||
import { UserSettingsTemplates } from 'Settings/User/Templates';
|
||||
|
||||
import { SystemDropDownUserView } from 'View/User/SystemDropDown';
|
||||
import { SettingsMenuUserView } from 'View/User/Settings/Menu';
|
||||
import { SettingsPaneUserView } from 'View/User/Settings/Pane';
|
||||
|
||||
export class SettingsUserScreen extends AbstractSettingsScreen {
|
||||
constructor() {
|
||||
super([SystemDropDownSettingsUserView, MenuSettingsUserView, PaneSettingsUserView]);
|
||||
super([SystemDropDownUserView, SettingsMenuUserView, SettingsPaneUserView]);
|
||||
|
||||
const views = [
|
||||
UserSettingsGeneral
|
||||
];
|
||||
|
||||
if (AppUserStore.allowContacts()) {
|
||||
views.push(UserSettingsContacts);
|
||||
}
|
||||
|
||||
if (SettingsCapa('AdditionalAccounts') || SettingsCapa('Identities')) {
|
||||
views.push(UserSettingsAccounts);
|
||||
}
|
||||
|
||||
if (SettingsCapa('Sieve')) {
|
||||
views.push(UserSettingsFilters);
|
||||
}
|
||||
|
||||
if (SettingsCapa('AutoLogout') || SettingsCapa('OpenPGP') || SettingsCapa('GnuPG')) {
|
||||
views.push(UserSettingsSecurity);
|
||||
}
|
||||
|
||||
if (SettingsCapa('Templates')) {
|
||||
views.push(UserSettingsTemplates);
|
||||
}
|
||||
|
||||
views.push(UserSettingsFolders);
|
||||
|
||||
if (SettingsCapa('Themes')) {
|
||||
views.push(UserSettingsThemes);
|
||||
}
|
||||
|
||||
views.forEach((item, index) =>
|
||||
settingsAddViewModel(item, item.name.replace('User', ''), 0, 0, 0 === index)
|
||||
);
|
||||
|
||||
runSettingsViewModelHooks(false);
|
||||
|
||||
initOnStartOrLangChange(
|
||||
() => this.sSettingsTitle = i18n('TITLES/SETTINGS'),
|
||||
|
|
@ -33,67 +69,6 @@ export class SettingsUserScreen extends AbstractSettingsScreen {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function=} fCallback
|
||||
*/
|
||||
setupSettings(fCallback = null) {
|
||||
if (!Settings.capa(Capa.Settings)) {
|
||||
fCallback && fCallback();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
settingsAddViewModel(GeneralUserSettings, 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
|
||||
|
||||
if (AppUserStore.allowContacts()) {
|
||||
settingsAddViewModel(ContactsUserSettings, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.AdditionalAccounts) || Settings.capa(Capa.Identities)) {
|
||||
settingsAddViewModel(
|
||||
AccountsUserSettings,
|
||||
'SettingsAccounts',
|
||||
Settings.capa(Capa.AdditionalAccounts)
|
||||
? 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME'
|
||||
: 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME',
|
||||
'accounts'
|
||||
);
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.Sieve)) {
|
||||
settingsAddViewModel(FiltersUserSettings, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.AutoLogout)) {
|
||||
settingsAddViewModel(SecurityUserSettings, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.Templates)) {
|
||||
settingsAddViewModel(
|
||||
TemplatesUserSettings,
|
||||
'SettingsTemplates',
|
||||
'SETTINGS_LABELS/LABEL_TEMPLATES_NAME',
|
||||
'templates'
|
||||
);
|
||||
}
|
||||
|
||||
settingsAddViewModel(FoldersUserSettings, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
|
||||
|
||||
if (Settings.capa(Capa.Themes)) {
|
||||
settingsAddViewModel(ThemesUserSettings, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
|
||||
}
|
||||
|
||||
if (Settings.capa(Capa.OpenPGP)) {
|
||||
settingsAddViewModel(OpenPgpUserSettings, 'SettingsOpenPGP', 'OpenPGP', 'openpgp');
|
||||
}
|
||||
|
||||
runSettingsViewModelHooks(false);
|
||||
|
||||
fCallback && fCallback();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
onShow() {
|
||||
this.setSettingsTitle();
|
||||
keyScope(Scope.Settings);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue