prettier --write

This commit is contained in:
RainLoop Team 2019-07-04 22:19:24 +03:00
parent 450528ff00
commit 8a0be3212d
164 changed files with 7053 additions and 9008 deletions

View file

@ -1,15 +1,14 @@
import ko from 'ko';
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
import {appSettingsGet, settingsGet} from 'Storage/Settings';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import { appSettingsGet, settingsGet } from 'Storage/Settings';
import AppStore from 'Stores/Admin/App';
import CoreStore from 'Stores/Admin/Core';
import {getApp} from 'Helper/Apps/Admin';
import { getApp } from 'Helper/Apps/Admin';
class AboutAdminSettings
{
class AboutAdminSettings {
constructor() {
this.version = ko.observable(appSettingsGet('version'));
this.access = ko.observable(!!settingsGet('CoreAccess'));
@ -32,35 +31,25 @@ class AboutAdminSettings
this.coreRemoteVersionHtmlDesc = ko.computed(() => {
translatorTrigger();
return i18n('TAB_ABOUT/HTML_NEW_VERSION', {'VERSION': this.coreRemoteVersion()});
return i18n('TAB_ABOUT/HTML_NEW_VERSION', { 'VERSION': this.coreRemoteVersion() });
});
this.statusType = ko.computed(() => {
let type = '';
const
versionToCompare = this.coreVersionCompare(),
const versionToCompare = this.coreVersionCompare(),
isChecking = this.coreChecking(),
isUpdating = this.coreUpdating(),
isReal = this.coreReal();
if (isChecking)
{
if (isChecking) {
type = 'checking';
}
else if (isUpdating)
{
} else if (isUpdating) {
type = 'updating';
}
else if (isReal && 0 === versionToCompare)
{
} else if (isReal && 0 === versionToCompare) {
type = 'up-to-date';
}
else if (isReal && -1 === versionToCompare)
{
} else if (isReal && -1 === versionToCompare) {
type = 'available';
}
else if (!isReal)
{
} else if (!isReal) {
type = 'error';
this.errorDesc('Cannot access the repository at the moment.');
}
@ -70,18 +59,16 @@ class AboutAdminSettings
}
onBuild() {
if (this.access() && !this.community)
{
if (this.access() && !this.community) {
getApp().reloadCoreData();
}
}
updateCoreData() {
if (!this.coreUpdating() && !this.community)
{
if (!this.coreUpdating() && !this.community) {
getApp().updateCoreData();
}
}
}
export {AboutAdminSettings, AboutAdminSettings as default};
export { AboutAdminSettings, AboutAdminSettings as default };

View file

@ -1,18 +1,16 @@
import _ from '_';
import ko from 'ko';
import {Magics} from 'Common/Enums';
import {settingsSaveHelperSimpleFunction, trim} from 'Common/Utils';
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
import { Magics } from 'Common/Enums';
import { settingsSaveHelperSimpleFunction, trim } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import Remote from 'Remote/Admin/Ajax';
import AppStore from 'Stores/Admin/App';
import {settingsGet} from 'Storage/Settings';
import { settingsGet } from 'Storage/Settings';
class BrandingAdminSettings
{
class BrandingAdminSettings {
constructor() {
this.capa = AppStore.prem;
@ -33,9 +31,9 @@ class BrandingAdminSettings
this.welcomePageDisplay.options = ko.computed(() => {
translatorTrigger();
return [
{optValue: 'none', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
{optValue: 'once', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
{optValue: 'always', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
{ optValue: 'none', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE') },
{ optValue: 'once', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE') },
{ optValue: 'always', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS') }
];
});
@ -45,8 +43,7 @@ class BrandingAdminSettings
onBuild() {
_.delay(() => {
const
f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
const f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
f2 = settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this),
f3 = settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this);
@ -71,4 +68,4 @@ class BrandingAdminSettings
}
}
export {BrandingAdminSettings, BrandingAdminSettings as default};
export { BrandingAdminSettings, BrandingAdminSettings as default };

View file

@ -1,32 +1,24 @@
import _ from '_';
import ko from 'ko';
import {
settingsSaveHelperSimpleFunction,
defautOptionsAfterRender,
inArray, trim, boolToAjax
} from 'Common/Utils';
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender, inArray, trim, boolToAjax } from 'Common/Utils';
import {SaveSettingsStep, StorageResultType, Magics} from 'Common/Enums';
import {i18n} from 'Common/Translator';
import {settingsGet} from 'Storage/Settings';
import { SaveSettingsStep, StorageResultType, Magics } from 'Common/Enums';
import { i18n } from 'Common/Translator';
import { settingsGet } from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
import {command} from 'Knoin/Knoin';
import { command } from 'Knoin/Knoin';
class ContactsAdminSettings
{
class ContactsAdminSettings {
constructor() {
this.defautOptionsAfterRender = defautOptionsAfterRender;
this.enableContacts = ko.observable(!!settingsGet('ContactsEnable'));
this.contactsSync = ko.observable(!!settingsGet('ContactsSync'));
const
supportedTypes = [],
const supportedTypes = [],
types = ['sqlite', 'mysql', 'pgsql'],
getTypeName = (name) => {
switch (name)
{
switch (name) {
case 'sqlite':
name = 'SQLite';
break;
@ -42,16 +34,13 @@ class ContactsAdminSettings
return name;
};
if (settingsGet('SQLiteIsSupported'))
{
if (settingsGet('SQLiteIsSupported')) {
supportedTypes.push('sqlite');
}
if (settingsGet('MySqlIsSupported'))
{
if (settingsGet('MySqlIsSupported')) {
supportedTypes.push('mysql');
}
if (settingsGet('PostgreSqlIsSupported'))
{
if (settingsGet('PostgreSqlIsSupported')) {
supportedTypes.push('pgsql');
}
@ -70,26 +59,22 @@ class ContactsAdminSettings
this.contactsTypes(types);
this.contactsType = ko.observable('');
this.mainContactsType = ko.computed({
read: this.contactsType,
write: (value) => {
if (value !== this.contactsType())
{
if (-1 < inArray(value, supportedTypes))
{
this.contactsType(value);
}
else if (0 < supportedTypes.length)
{
this.contactsType('');
this.mainContactsType = ko
.computed({
read: this.contactsType,
write: (value) => {
if (value !== this.contactsType()) {
if (-1 < inArray(value, supportedTypes)) {
this.contactsType(value);
} else if (0 < supportedTypes.length) {
this.contactsType('');
}
} else {
this.contactsType.valueHasMutated();
}
}
else
{
this.contactsType.valueHasMutated();
}
}
}).extend({notify: 'always'});
})
.extend({ notify: 'always' });
this.contactsType.subscribe(() => {
this.testContactsSuccess(false);
@ -136,19 +121,13 @@ class ContactsAdminSettings
this.testContactsError(false);
this.testContactsErrorMessage('');
if (StorageResultType.Success === result && data && data.Result && data.Result.Result)
{
if (StorageResultType.Success === result && data && data.Result && data.Result.Result) {
this.testContactsSuccess(true);
}
else
{
} else {
this.testContactsError(true);
if (data && data.Result)
{
if (data && data.Result) {
this.testContactsErrorMessage(data.Result.Message || '');
}
else
{
} else {
this.testContactsErrorMessage('');
}
}
@ -164,8 +143,7 @@ class ContactsAdminSettings
onBuild() {
_.delay(() => {
const
f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this),
const f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this),
f3 = settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this),
f4 = settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this),
f5 = settingsSaveHelperSimpleFunction(this.contactsTypeTrigger, this);
@ -211,4 +189,4 @@ class ContactsAdminSettings
}
}
export {ContactsAdminSettings, ContactsAdminSettings as default};
export { ContactsAdminSettings, ContactsAdminSettings as default };

View file

@ -1,17 +1,15 @@
import _ from '_';
import ko from 'ko';
import {StorageResultType} from 'Common/Enums';
import {showScreenPopup} from 'Knoin/Knoin';
import { StorageResultType } from 'Common/Enums';
import { showScreenPopup } from 'Knoin/Knoin';
import DomainStore from 'Stores/Admin/Domain';
import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin';
import { getApp } from 'Helper/Apps/Admin';
class DomainsAdminSettings
{
class DomainsAdminSettings {
constructor() {
this.domains = DomainStore.domains;
@ -43,21 +41,19 @@ class DomainsAdminSettings
onBuild(oDom) {
const self = this;
oDom
.on('click', '.b-admin-domains-list-table .e-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
const domainItem = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (domainItem)
{
Remote.domain(self.onDomainLoadRequest, domainItem.name);
}
});
oDom.on('click', '.b-admin-domains-list-table .e-item .e-action', function() {
// eslint-disable-line prefer-arrow-callback
const domainItem = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (domainItem) {
Remote.domain(self.onDomainLoadRequest, domainItem.name);
}
});
getApp().reloadDomainList();
}
onDomainLoadRequest(sResult, oData) {
if (StorageResultType.Success === sResult && oData && oData.Result)
{
if (StorageResultType.Success === sResult && oData && oData.Result) {
showScreenPopup(require('View/Popup/Domain'), [oData.Result]);
}
}
@ -67,4 +63,4 @@ class DomainsAdminSettings
}
}
export {DomainsAdminSettings, DomainsAdminSettings as default};
export { DomainsAdminSettings, DomainsAdminSettings as default };

View file

@ -1,18 +1,22 @@
import _ from '_';
import ko from 'ko';
import {
trim, pInt, boolToAjax, settingsSaveHelperSimpleFunction,
changeTheme, convertThemeName, convertLangName
trim,
pInt,
boolToAjax,
settingsSaveHelperSimpleFunction,
changeTheme,
convertThemeName,
convertLangName
} from 'Common/Utils';
import {SaveSettingsStep, Magics} from 'Common/Enums';
import {reload as translatorReload} from 'Common/Translator';
import {phpInfo} from 'Common/Links';
import { SaveSettingsStep, Magics } from 'Common/Enums';
import { reload as translatorReload } from 'Common/Translator';
import { phpInfo } from 'Common/Links';
import {settingsGet} from 'Storage/Settings';
import {showScreenPopup} from 'Knoin/Knoin';
import { settingsGet } from 'Storage/Settings';
import { showScreenPopup } from 'Knoin/Knoin';
import Remote from 'Remote/Admin/Ajax';
@ -21,8 +25,7 @@ import LanguageStore from 'Stores/Language';
import AppAdminStore from 'Stores/Admin/App';
import CapaAdminStore from 'Stores/Admin/Capa';
class GeneralAdminSettings
{
class GeneralAdminSettings {
constructor() {
this.language = LanguageStore.language;
this.languages = LanguageStore.languages;
@ -46,29 +49,37 @@ class GeneralAdminSettings
this.dataFolderAccess = AppAdminStore.dataFolderAccess;
this.mainAttachmentLimit = ko.observable(pInt(settingsGet('AttachmentLimit')) / (Magics.BitLength1024 * Magics.BitLength1024)).extend({posInterer: 25});
this.mainAttachmentLimit = ko
.observable(pInt(settingsGet('AttachmentLimit')) / (Magics.BitLength1024 * Magics.BitLength1024))
.extend({ posInterer: 25 });
this.uploadData = settingsGet('PhpUploadSizes');
this.uploadDataDesc = this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size) ? [
this.uploadData.upload_max_filesize ? 'upload_max_filesize = ' + this.uploadData.upload_max_filesize + '; ' : '',
this.uploadData.post_max_size ? 'post_max_size = ' + this.uploadData.post_max_size : ''
].join('') : '';
this.uploadDataDesc =
this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size)
? [
this.uploadData.upload_max_filesize
? 'upload_max_filesize = ' + this.uploadData.upload_max_filesize + '; '
: '',
this.uploadData.post_max_size ? 'post_max_size = ' + this.uploadData.post_max_size : ''
].join('')
: '';
this.themesOptions = ko.computed(() => _.map(this.themes(), (theme) => ({optValue: theme, optText: convertThemeName(theme)})));
this.themesOptions = ko.computed(() =>
_.map(this.themes(), (theme) => ({ optValue: theme, optText: convertThemeName(theme) }))
);
this.languageFullName = ko.computed(() => convertLangName(this.language()));
this.languageAdminFullName = ko.computed(() => convertLangName(this.languageAdmin()));
this.attachmentLimitTrigger = ko.observable(SaveSettingsStep.Idle);
this.languageTrigger = ko.observable(SaveSettingsStep.Idle);
this.languageAdminTrigger = ko.observable(SaveSettingsStep.Idle).extend({throttle: Magics.Time100ms});
this.languageAdminTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: Magics.Time100ms });
this.themeTrigger = ko.observable(SaveSettingsStep.Idle);
}
onBuild() {
_.delay(() => {
const
f1 = settingsSaveHelperSimpleFunction(this.attachmentLimitTrigger, this),
const f1 = settingsSaveHelperSimpleFunction(this.attachmentLimitTrigger, this),
f2 = settingsSaveHelperSimpleFunction(this.languageTrigger, this),
f3 = settingsSaveHelperSimpleFunction(this.themeTrigger, this),
fReloadLanguageHelper = (saveSettingsStep) => () => {
@ -90,14 +101,13 @@ class GeneralAdminSettings
this.languageAdmin.subscribe((value) => {
this.languageAdminTrigger(SaveSettingsStep.Animate);
translatorReload(true, value).then(
fReloadLanguageHelper(SaveSettingsStep.TrueResult),
fReloadLanguageHelper(SaveSettingsStep.FalseResult)
).then(() => {
Remote.saveAdminConfig(null, {
'LanguageAdmin': trim(value)
translatorReload(true, value)
.then(fReloadLanguageHelper(SaveSettingsStep.TrueResult), fReloadLanguageHelper(SaveSettingsStep.FalseResult))
.then(() => {
Remote.saveAdminConfig(null, {
'LanguageAdmin': trim(value)
});
});
});
});
this.theme.subscribe((value) => {
@ -164,14 +174,14 @@ class GeneralAdminSettings
}
selectLanguage() {
showScreenPopup(require('View/Popup/Languages'), [
this.language, this.languages(), LanguageStore.userLanguage()
]);
showScreenPopup(require('View/Popup/Languages'), [this.language, this.languages(), LanguageStore.userLanguage()]);
}
selectLanguageAdmin() {
showScreenPopup(require('View/Popup/Languages'), [
this.languageAdmin, this.languagesAdmin(), LanguageStore.userLanguageAdmin()
this.languageAdmin,
this.languagesAdmin(),
LanguageStore.userLanguageAdmin()
]);
}
@ -183,4 +193,4 @@ class GeneralAdminSettings
}
}
export {GeneralAdminSettings, GeneralAdminSettings as default};
export { GeneralAdminSettings, GeneralAdminSettings as default };

View file

@ -1,16 +1,14 @@
import _ from '_';
import ko from 'ko';
import {settingsSaveHelperSimpleFunction, boolToAjax, trim} from 'Common/Utils';
import {settingsGet} from 'Storage/Settings';
import { settingsSaveHelperSimpleFunction, boolToAjax, trim } from 'Common/Utils';
import { settingsGet } from 'Storage/Settings';
import AppStore from 'Stores/Admin/App';
import Remote from 'Remote/Admin/Ajax';
class LoginAdminSettings
{
class LoginAdminSettings {
constructor() {
this.determineUserLanguage = AppStore.determineUserLanguage;
this.determineUserDomain = AppStore.determineUserDomain;
@ -52,4 +50,4 @@ class LoginAdminSettings
}
}
export {LoginAdminSettings, LoginAdminSettings as default};
export { LoginAdminSettings, LoginAdminSettings as default };

View file

@ -1,18 +1,16 @@
import window from 'window';
import _ from '_';
import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {getNotification} from 'Common/Translator';
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
import PackageStore from 'Stores/Admin/Package';
import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin';
import { getApp } from 'Helper/Apps/Admin';
class PackagesAdminSettings
{
class PackagesAdminSettings {
constructor() {
this.packagesError = ko.observable('');
@ -37,54 +35,44 @@ class PackagesAdminSettings
requestHelper(packageToRequest, install) {
return (result, data) => {
if (StorageResultType.Success !== result || !data || !data.Result)
{
if (data && data.ErrorCode)
{
if (StorageResultType.Success !== result || !data || !data.Result) {
if (data && data.ErrorCode) {
this.packagesError(getNotification(data.ErrorCode));
}
else
{
this.packagesError(getNotification(
install ? Notification.CantInstallPackage : Notification.CantDeletePackage));
} else {
this.packagesError(
getNotification(install ? Notification.CantInstallPackage : Notification.CantDeletePackage)
);
}
}
_.each(this.packages(), (item) => {
if (item && packageToRequest && item.loading && item.loading() && packageToRequest.file === item.file)
{
if (item && packageToRequest && item.loading && item.loading() && packageToRequest.file === item.file) {
packageToRequest.loading(false);
item.loading(false);
}
});
if (StorageResultType.Success === result && data && data.Result && data.Result.Reload)
{
if (StorageResultType.Success === result && data && data.Result && data.Result.Reload) {
window.location.reload();
}
else
{
} else {
getApp().reloadPackagesList();
}
};
}
deletePackage(packageToDelete) {
if (packageToDelete)
{
if (packageToDelete) {
packageToDelete.loading(true);
Remote.packageDelete(this.requestHelper(packageToDelete, false), packageToDelete);
}
}
installPackage(packageToInstall) {
if (packageToInstall)
{
if (packageToInstall) {
packageToInstall.loading(true);
Remote.packageInstall(this.requestHelper(packageToInstall, true), packageToInstall);
}
}
}
export {PackagesAdminSettings, PackagesAdminSettings as default};
export { PackagesAdminSettings, PackagesAdminSettings as default };

View file

@ -1,22 +1,21 @@
import _ from '_';
import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {getNotification} from 'Common/Translator';
import {boolToAjax} from 'Common/Utils';
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
import { boolToAjax } from 'Common/Utils';
import {settingsGet} from 'Storage/Settings';
import {showScreenPopup} from 'Knoin/Knoin';
import { settingsGet } from 'Storage/Settings';
import { showScreenPopup } from 'Knoin/Knoin';
import AppStore from 'Stores/Admin/App';
import PluginStore from 'Stores/Admin/Plugin';
import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin';
import { getApp } from 'Helper/Apps/Admin';
class PluginsAdminSettings
{
class PluginsAdminSettings {
constructor() {
this.enabledPlugins = ko.observable(!!settingsGet('EnabledPlugins'));
@ -41,21 +40,20 @@ class PluginsAdminSettings
}
onBuild(oDom) {
const self = this;
oDom
.on('click', '.e-item .configure-plugin-action', function() { // eslint-disable-line prefer-arrow-callback
.on('click', '.e-item .configure-plugin-action', function() {
// eslint-disable-line prefer-arrow-callback
const plugin = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (plugin)
{
if (plugin) {
self.configurePlugin(plugin);
}
})
.on('click', '.e-item .disabled-plugin', function() { // eslint-disable-line prefer-arrow-callback
.on('click', '.e-item .disabled-plugin', function() {
// eslint-disable-line prefer-arrow-callback
const plugin = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (plugin)
{
if (plugin) {
self.disablePlugin(plugin);
}
});
@ -73,23 +71,17 @@ class PluginsAdminSettings
}
onPluginLoadRequest(result, data) {
if (StorageResultType.Success === result && data && data.Result)
{
if (StorageResultType.Success === result && data && data.Result) {
showScreenPopup(require('View/Popup/Plugin'), [data.Result]);
}
}
onPluginDisableRequest(result, data) {
if (StorageResultType.Success === result && data)
{
if (!data.Result && data.ErrorCode)
{
if (Notification.UnsupportedPluginPackage === data.ErrorCode && data.ErrorMessage && '' !== data.ErrorMessage)
{
if (StorageResultType.Success === result && data) {
if (!data.Result && data.ErrorCode) {
if (Notification.UnsupportedPluginPackage === data.ErrorCode && data.ErrorMessage && '' !== data.ErrorMessage) {
PluginStore.plugins.error(data.ErrorMessage);
}
else
{
} else {
PluginStore.plugins.error(getNotification(data.ErrorCode));
}
}
@ -99,4 +91,4 @@ class PluginsAdminSettings
}
}
export {PluginsAdminSettings, PluginsAdminSettings as default};
export { PluginsAdminSettings, PluginsAdminSettings as default };

View file

@ -1,23 +1,18 @@
import _ from '_';
import {settingsSaveHelperSimpleFunction, trim, boolToAjax} from 'Common/Utils';
import {Magics} from 'Common/Enums';
import { settingsSaveHelperSimpleFunction, trim, boolToAjax } from 'Common/Utils';
import { Magics } from 'Common/Enums';
import Remote from 'Remote/Admin/Ajax';
import {BrandingAdminSettings} from 'Settings/Admin/Branding';
import { BrandingAdminSettings } from 'Settings/Admin/Branding';
class BrandingPremAdminSettings extends BrandingAdminSettings
{
class BrandingPremAdminSettings extends BrandingAdminSettings {
onBuild(dom) {
super.onBuild(dom);
if (this.capa && this.capa() && !this.community)
{
if (this.capa && this.capa() && !this.community) {
_.delay(() => {
const
f1 = settingsSaveHelperSimpleFunction(this.loginLogo.trigger, this),
const f1 = settingsSaveHelperSimpleFunction(this.loginLogo.trigger, this),
f2 = settingsSaveHelperSimpleFunction(this.loginDescription.trigger, this),
f3 = settingsSaveHelperSimpleFunction(this.loginCss.trigger, this),
f4 = settingsSaveHelperSimpleFunction(this.userLogo.trigger, this),
@ -100,10 +95,9 @@ class BrandingPremAdminSettings extends BrandingAdminSettings
'LoginPowered': boolToAjax(value)
});
});
}, Magics.Time50ms);
}
}
}
export {BrandingPremAdminSettings, BrandingPremAdminSettings as default};
export { BrandingPremAdminSettings, BrandingPremAdminSettings as default };

View file

@ -1,16 +1,14 @@
import ko from 'ko';
import moment from 'moment';
import {settingsGet} from 'Storage/Settings';
import {showScreenPopup} from 'Knoin/Knoin';
import { settingsGet } from 'Storage/Settings';
import { showScreenPopup } from 'Knoin/Knoin';
import LicenseStore from 'Stores/Admin/License';
import {getApp} from 'Helper/Apps/Admin';
import { getApp } from 'Helper/Apps/Admin';
class LicensingPremAdminSettings
{
class LicensingPremAdminSettings {
constructor() {
this.licensing = LicenseStore.licensing;
this.licensingProcess = LicenseStore.licensingProcess;
@ -23,16 +21,14 @@ class LicensingPremAdminSettings
this.subscriptionEnabled = ko.observable(!!settingsGet('SubscriptionEnabled'));
this.licenseTrigger.subscribe(() => {
if (this.subscriptionEnabled())
{
if (this.subscriptionEnabled()) {
getApp().reloadLicensing(true);
}
});
}
onBuild() {
if (this.subscriptionEnabled())
{
if (this.subscriptionEnabled()) {
getApp().reloadLicensing(false);
}
}
@ -60,12 +56,11 @@ class LicensingPremAdminSettings
* @returns {string}
*/
licenseExpiredMomentValue() {
const
time = this.licenseExpired(),
const time = this.licenseExpired(),
momentUnix = moment.unix(time);
return this.licenseIsUnlim() ? 'Never' : (time && (momentUnix.format('LL') + ' (' + momentUnix.from(moment()) + ')'));
return this.licenseIsUnlim() ? 'Never' : time && momentUnix.format('LL') + ' (' + momentUnix.from(moment()) + ')';
}
}
export {LicensingPremAdminSettings, LicensingPremAdminSettings as default};
export { LicensingPremAdminSettings, LicensingPremAdminSettings as default };

View file

@ -1,22 +1,20 @@
import _ from '_';
import ko from 'ko';
import {trim, boolToAjax} from 'Common/Utils';
import {phpInfo} from 'Common/Links';
import {StorageResultType, Magics} from 'Common/Enums';
import { trim, boolToAjax } from 'Common/Utils';
import { phpInfo } from 'Common/Links';
import { StorageResultType, Magics } from 'Common/Enums';
import {settingsGet} from 'Storage/Settings';
import { settingsGet } from 'Storage/Settings';
import AppAdminStore from 'Stores/Admin/App';
import CapaAdminStore from 'Stores/Admin/Capa';
import Remote from 'Remote/Admin/Ajax';
import {command} from 'Knoin/Knoin';
import { command } from 'Knoin/Knoin';
class SecurityAdminSettings
{
class SecurityAdminSettings {
constructor() {
this.useLocalProxyForExternalImages = AppAdminStore.useLocalProxyForExternalImages;
@ -28,8 +26,7 @@ class SecurityAdminSettings
this.capaTwoFactorAuthForce = CapaAdminStore.twoFactorAuthForce;
this.capaTwoFactorAuth.subscribe((value) => {
if (!value)
{
if (!value) {
this.capaTwoFactorAuthForce(false);
}
});
@ -38,8 +35,7 @@ class SecurityAdminSettings
this.allowSelfSigned = ko.observable(!!settingsGet('AllowSelfSigned'));
this.verifySslCertificate.subscribe((value) => {
if (!value)
{
if (!value) {
this.allowSelfSigned(true);
}
});
@ -84,15 +80,12 @@ class SecurityAdminSettings
@command((self) => '' !== trim(self.adminLogin()) && '' !== self.adminPassword())
saveNewAdminPasswordCommand() {
if ('' === trim(this.adminLogin()))
{
if ('' === trim(this.adminLogin())) {
this.adminLoginError(true);
return false;
}
if (this.adminPasswordNew() !== this.adminPasswordNew2())
{
if (this.adminPasswordNew() !== this.adminPasswordNew2()) {
this.adminPasswordNewError(true);
return false;
}
@ -119,8 +112,7 @@ class SecurityAdminSettings
}
onNewAdminPasswordResponse(result, data) {
if (StorageResultType.Success === result && data && data.Result)
{
if (StorageResultType.Success === result && data && data.Result) {
this.adminPassword('');
this.adminPasswordNew('');
this.adminPasswordNew2('');
@ -128,9 +120,7 @@ class SecurityAdminSettings
this.adminPasswordUpdateSuccess(true);
this.weakPassword(!!data.Result.Weak);
}
else
{
} else {
this.adminPasswordUpdateError(true);
}
}
@ -191,4 +181,4 @@ class SecurityAdminSettings
}
}
export {SecurityAdminSettings, SecurityAdminSettings as default};
export { SecurityAdminSettings, SecurityAdminSettings as default };

View file

@ -1,16 +1,14 @@
import _ from '_';
import ko from 'ko';
import {SaveSettingsStep, Magics} from 'Common/Enums';
import {settingsSaveHelperSimpleFunction, trim, boolToAjax} from 'Common/Utils';
import { SaveSettingsStep, Magics } from 'Common/Enums';
import { settingsSaveHelperSimpleFunction, trim, boolToAjax } from 'Common/Utils';
import SocialStore from 'Stores/Social';
import Remote from 'Remote/Admin/Ajax';
class SocialAdminSettings
{
class SocialAdminSettings {
constructor() {
this.googleEnable = SocialStore.google.enabled;
this.googleEnableAuth = SocialStore.google.capa.auth;
@ -52,8 +50,7 @@ class SocialAdminSettings
onBuild() {
_.delay(() => {
const
f1 = settingsSaveHelperSimpleFunction(this.facebookTrigger1, this),
const f1 = settingsSaveHelperSimpleFunction(this.facebookTrigger1, this),
f2 = settingsSaveHelperSimpleFunction(this.facebookTrigger2, this),
f3 = settingsSaveHelperSimpleFunction(this.twitterTrigger1, this),
f4 = settingsSaveHelperSimpleFunction(this.twitterTrigger2, this),
@ -63,8 +60,7 @@ class SocialAdminSettings
f8 = settingsSaveHelperSimpleFunction(this.dropboxTrigger1, this);
this.facebookEnable.subscribe((value) => {
if (this.facebookSupported())
{
if (this.facebookSupported()) {
Remote.saveAdminConfig(null, {
'FacebookEnable': boolToAjax(value)
});
@ -72,8 +68,7 @@ class SocialAdminSettings
});
this.facebookAppID.subscribe((value) => {
if (this.facebookSupported())
{
if (this.facebookSupported()) {
Remote.saveAdminConfig(f1, {
'FacebookAppID': trim(value)
});
@ -81,8 +76,7 @@ class SocialAdminSettings
});
this.facebookAppSecret.subscribe((value) => {
if (this.facebookSupported())
{
if (this.facebookSupported()) {
Remote.saveAdminConfig(f2, {
'FacebookAppSecret': trim(value)
});
@ -107,4 +101,4 @@ class SocialAdminSettings
}
}
export {SocialAdminSettings, SocialAdminSettings as default};
export { SocialAdminSettings, SocialAdminSettings as default };

View file

@ -1,23 +1,21 @@
import window from 'window';
import _ from '_';
import ko from 'ko';
import {Capa, StorageResultType} from 'Common/Enums';
import {root} from 'Common/Links';
import { Capa, StorageResultType } from 'Common/Enums';
import { root } from 'Common/Links';
import {capa} from 'Storage/Settings';
import { capa } from 'Storage/Settings';
import AccountStore from 'Stores/User/Account';
import IdentityStore from 'Stores/User/Identity';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import { getApp } from 'Helper/Apps/User';
import {showScreenPopup, routeOff, setHash} from 'Knoin/Knoin';
import { showScreenPopup, routeOff, setHash } from 'Knoin/Knoin';
class AccountsUserSettings
{
class AccountsUserSettings {
constructor() {
this.allowAdditionalAccount = capa(Capa.AdditionalAccounts);
this.allowIdentities = capa(Capa.Identities);
@ -42,8 +40,7 @@ class AccountsUserSettings
}
editAccount(account) {
if (account && account.canBeEdit())
{
if (account && account.canBeEdit()) {
showScreenPopup(require('View/Popup/Account'), [account]);
}
}
@ -61,28 +58,21 @@ class AccountsUserSettings
* @returns {void}
*/
deleteAccount(accountToRemove) {
if (accountToRemove && accountToRemove.deleteAccess())
{
if (accountToRemove && accountToRemove.deleteAccess()) {
this.accountForDeletion(null);
if (accountToRemove)
{
if (accountToRemove) {
this.accounts.remove((account) => accountToRemove === account);
Remote.accountDelete((result, data) => {
if (StorageResultType.Success === result && data && data.Result && data.Reload)
{
if (StorageResultType.Success === result && data && data.Result && data.Reload) {
routeOff();
setHash(root(), true);
routeOff();
_.defer(() => window.location.reload());
}
else
{
} else {
getApp().accountsAndIdentities();
}
}, accountToRemove.email);
}
}
@ -93,12 +83,10 @@ class AccountsUserSettings
* @returns {void}
*/
deleteIdentity(identityToRemove) {
if (identityToRemove && identityToRemove.deleteAccess())
{
if (identityToRemove && identityToRemove.deleteAccess()) {
this.identityForDeletion(null);
if (identityToRemove)
{
if (identityToRemove) {
IdentityStore.identities.remove((oIdentity) => identityToRemove === oIdentity);
Remote.identityDelete(() => {
@ -109,30 +97,28 @@ class AccountsUserSettings
}
accountsAndIdentitiesAfterMove() {
Remote.accountsAndIdentitiesSortOrder(null,
AccountStore.accountsEmails.peek(), IdentityStore.identitiesIDS.peek());
Remote.accountsAndIdentitiesSortOrder(null, AccountStore.accountsEmails.peek(), IdentityStore.identitiesIDS.peek());
}
onBuild(oDom) {
const self = this;
oDom
.on('click', '.accounts-list .account-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
.on('click', '.accounts-list .account-item .e-action', function() {
// eslint-disable-line prefer-arrow-callback
const account = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (account)
{
if (account) {
self.editAccount(account);
}
})
.on('click', '.identities-list .identity-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
.on('click', '.identities-list .identity-item .e-action', function() {
// eslint-disable-line prefer-arrow-callback
const identity = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (identity)
{
if (identity) {
self.editIdentity(identity);
}
});
}
}
export {AccountsUserSettings, AccountsUserSettings as default};
export { AccountsUserSettings, AccountsUserSettings as default };

View file

@ -1,17 +1,15 @@
import _ from '_';
import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {getNotificationFromResponse, i18n} from 'Common/Translator';
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotificationFromResponse, i18n } from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {command} from 'Knoin/Knoin';
import { getApp } from 'Helper/Apps/User';
import { command } from 'Knoin/Knoin';
class ChangePasswordUserSettings
{
class ChangePasswordUserSettings {
constructor() {
this.changeProcess = ko.observable(false);
@ -46,15 +44,15 @@ class ChangePasswordUserSettings
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
}
@command((self) => !self.changeProcess() && '' !== self.currentPassword() && '' !== self.newPassword() && '' !== self.newPassword2())
@command(
(self) =>
!self.changeProcess() && '' !== self.currentPassword() && '' !== self.newPassword() && '' !== self.newPassword2()
)
saveNewPasswordCommand() {
if (this.newPassword() !== this.newPassword2())
{
if (this.newPassword() !== this.newPassword2()) {
this.passwordMismatch(true);
this.errorDescription(i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
}
else
{
} else {
this.changeProcess(true);
this.passwordUpdateError(false);
@ -83,8 +81,7 @@ class ChangePasswordUserSettings
this.errorDescription('');
this.currentPassword.error(false);
if (StorageResultType.Success === result && data && data.Result)
{
if (StorageResultType.Success === result && data && data.Result) {
this.currentPassword('');
this.newPassword('');
this.newPassword2('');
@ -93,11 +90,8 @@ class ChangePasswordUserSettings
this.currentPassword.error(false);
getApp().setClientSideToken(data.Result);
}
else
{
if (data && Notification.CurrentPasswordIncorrect === data.ErrorCode)
{
} else {
if (data && Notification.CurrentPasswordIncorrect === data.ErrorCode) {
this.currentPassword.error(true);
}
@ -107,4 +101,4 @@ class ChangePasswordUserSettings
}
}
export {ChangePasswordUserSettings, ChangePasswordUserSettings as default};
export { ChangePasswordUserSettings, ChangePasswordUserSettings as default };

View file

@ -1,15 +1,13 @@
import ko from 'ko';
import {Magics} from 'Common/Enums';
import {boolToAjax} from 'Common/Utils';
import { Magics } from 'Common/Enums';
import { boolToAjax } from 'Common/Utils';
import AppStore from 'Stores/User/App';
import ContactStore from 'Stores/User/Contact';
import Remote from 'Remote/User/Ajax';
class ContactsUserSettings
{
class ContactsUserSettings {
constructor() {
this.contactsAutosave = AppStore.contactsAutosave;
@ -19,12 +17,16 @@ class ContactsUserSettings
this.contactsSyncUser = ContactStore.contactsSyncUser;
this.contactsSyncPass = ContactStore.contactsSyncPass;
this.saveTrigger = ko.computed(() => [
this.enableContactsSync() ? '1' : '0',
this.contactsSyncUrl(),
this.contactsSyncUser(),
this.contactsSyncPass()
].join('|')).extend({throttle: Magics.Time500ms});
this.saveTrigger = ko
.computed(() =>
[
this.enableContactsSync() ? '1' : '0',
this.contactsSyncUrl(),
this.contactsSyncUser(),
this.contactsSyncPass()
].join('|')
)
.extend({ throttle: Magics.Time500ms });
}
onBuild() {
@ -35,7 +37,8 @@ class ContactsUserSettings
});
this.saveTrigger.subscribe(() => {
Remote.saveContactsSyncData(null,
Remote.saveContactsSyncData(
null,
this.enableContactsSync(),
this.contactsSyncUrl(),
this.contactsSyncUser(),
@ -45,4 +48,4 @@ class ContactsUserSettings
}
}
export {ContactsUserSettings, ContactsUserSettings as default};
export { ContactsUserSettings, ContactsUserSettings as default };

View file

@ -1,20 +1,18 @@
import _ from '_';
import ko from 'ko';
import {windowResizeCallback, isArray, trim, delegateRunOnDestroy} from 'Common/Utils';
import {StorageResultType, Notification} from 'Common/Enums';
import {getNotification} from 'Common/Translator';
import { windowResizeCallback, isArray, trim, delegateRunOnDestroy } from 'Common/Utils';
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
import FilterStore from 'Stores/User/Filter';
import Remote from 'Remote/User/Ajax';
import {FilterModel} from 'Model/Filter';
import { FilterModel } from 'Model/Filter';
import {showScreenPopup, command} from 'Knoin/Knoin';
import { showScreenPopup, command } from 'Knoin/Knoin';
class FiltersUserSettings
{
class FiltersUserSettings {
constructor() {
this.modules = FilterStore.modules;
this.filters = FilterStore.filters;
@ -29,8 +27,7 @@ class FiltersUserSettings
this.filters.subscribe(windowResizeCallback);
this.serverError.subscribe((value) => {
if (!value)
{
if (!value) {
this.serverErrorDesc('');
}
}, this);
@ -64,10 +61,8 @@ class FiltersUserSettings
@command((self) => self.haveChanges())
saveChangesCommand() {
if (!this.filters.saving())
{
if (this.filterRaw.active() && '' === trim(this.filterRaw()))
{
if (!this.filters.saving()) {
if (this.filterRaw.active() && '' === trim(this.filterRaw())) {
this.filterRaw.error(true);
return false;
}
@ -75,24 +70,23 @@ class FiltersUserSettings
this.filters.saving(true);
this.saveErrorText('');
Remote.filtersSave((result, data) => {
this.filters.saving(false);
Remote.filtersSave(
(result, data) => {
this.filters.saving(false);
if (StorageResultType.Success === result && data && data.Result)
{
this.haveChanges(false);
this.updateList();
}
else if (data && data.ErrorCode)
{
this.saveErrorText(data.ErrorMessageAdditional || getNotification(data.ErrorCode));
}
else
{
this.saveErrorText(getNotification(Notification.CantSaveFilters));
}
}, this.filters(), this.filterRaw(), this.filterRaw.active());
if (StorageResultType.Success === result && data && data.Result) {
this.haveChanges(false);
this.updateList();
} else if (data && data.ErrorCode) {
this.saveErrorText(data.ErrorMessageAdditional || getNotification(data.ErrorCode));
} else {
this.saveErrorText(getNotification(Notification.CantSaveFilters));
}
},
this.filters(),
this.filterRaw(),
this.filterRaw.active()
);
}
return true;
@ -107,24 +101,25 @@ class FiltersUserSettings
}
updateList() {
if (!this.filters.loading())
{
if (!this.filters.loading()) {
this.filters.loading(true);
Remote.filtersGet((result, data) => {
this.filters.loading(false);
this.serverError(false);
if (StorageResultType.Success === result && data && data.Result && isArray(data.Result.Filters))
{
if (StorageResultType.Success === result && data && data.Result && isArray(data.Result.Filters)) {
this.inited(true);
this.serverError(false);
this.filters(_.compact(_.map(data.Result.Filters, (aItem) => {
const filter = new FilterModel();
return (filter && filter.parse(aItem)) ? filter : null;
})));
this.filters(
_.compact(
_.map(data.Result.Filters, (aItem) => {
const filter = new FilterModel();
return filter && filter.parse(aItem) ? filter : null;
})
)
);
this.modules(data.Result.Modules ? data.Result.Modules : {});
@ -132,16 +127,16 @@ class FiltersUserSettings
this.filterRaw.capa(isArray(data.Result.Capa) ? data.Result.Capa.join(' ') : '');
this.filterRaw.active(!!data.Result.RawIsActive);
this.filterRaw.allow(!!data.Result.RawIsAllow);
}
else
{
} else {
this.filters([]);
this.modules({});
this.filterRaw('');
this.filterRaw.capa({});
this.serverError(true);
this.serverErrorDesc(data && data.ErrorCode ? getNotification(data.ErrorCode) : getNotification(Notification.CantGetFilters));
this.serverErrorDesc(
data && data.ErrorCode ? getNotification(data.ErrorCode) : getNotification(Notification.CantGetFilters)
);
}
this.haveChanges(false);
@ -158,43 +153,47 @@ class FiltersUserSettings
const filter = new FilterModel();
filter.generateID();
showScreenPopup(require('View/Popup/Filter'), [filter, () => {
this.filters.push(filter);
this.filterRaw.active(false);
}, false]);
showScreenPopup(require('View/Popup/Filter'), [
filter,
() => {
this.filters.push(filter);
this.filterRaw.active(false);
},
false
]);
}
editFilter(filter) {
const clonedFilter = filter.cloneSelf();
showScreenPopup(require('View/Popup/Filter'), [clonedFilter, () => {
const
filters = this.filters(),
index = filters.indexOf(filter);
showScreenPopup(require('View/Popup/Filter'), [
clonedFilter,
() => {
const filters = this.filters(),
index = filters.indexOf(filter);
if (-1 < index && filters[index])
{
delegateRunOnDestroy(filters[index]);
filters[index] = clonedFilter;
if (-1 < index && filters[index]) {
delegateRunOnDestroy(filters[index]);
filters[index] = clonedFilter;
this.filters(filters);
this.haveChanges(true);
}
}, true]);
this.filters(filters);
this.haveChanges(true);
}
},
true
]);
}
onBuild(oDom) {
const self = this;
oDom
.on('click', '.filter-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
const filter = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (filter)
{
self.editFilter(filter);
}
});
oDom.on('click', '.filter-item .e-action', function() {
// eslint-disable-line prefer-arrow-callback
const filter = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (filter) {
self.editFilter(filter);
}
});
}
onShow() {
@ -202,4 +201,4 @@ class FiltersUserSettings
}
}
export {FiltersUserSettings, FiltersUserSettings as default};
export { FiltersUserSettings, FiltersUserSettings as default };

View file

@ -1,13 +1,12 @@
import ko from 'ko';
import {ClientSideKeyName, Notification, Magics} from 'Common/Enums';
import {trim, noop} from 'Common/Utils';
import {getNotification, i18n} from 'Common/Translator';
import { ClientSideKeyName, Notification, Magics } from 'Common/Enums';
import { trim, noop } from 'Common/Utils';
import { getNotification, i18n } from 'Common/Translator';
import {removeFolderFromCacheList} from 'Common/Cache';
import { removeFolderFromCacheList } from 'Common/Cache';
import {appSettingsGet} from 'Storage/Settings';
import { appSettingsGet } from 'Storage/Settings';
import * as Local from 'Storage/Client';
import FolderStore from 'Stores/User/Folder';
@ -15,21 +14,19 @@ import FolderStore from 'Stores/User/Folder';
import Promises from 'Promises/User/Ajax';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import { getApp } from 'Helper/Apps/User';
import {showScreenPopup} from 'Knoin/Knoin';
import { showScreenPopup } from 'Knoin/Knoin';
class FoldersUserSettings
{
class FoldersUserSettings {
constructor() {
this.displaySpecSetting = FolderStore.displaySpecSetting;
this.folderList = FolderStore.folderList;
this.folderListHelp = ko.observable('').extend({throttle: Magics.Time100ms});
this.folderListHelp = ko.observable('').extend({ throttle: Magics.Time100ms });
this.loading = ko.computed(() => {
const
loading = FolderStore.foldersLoading(),
const loading = FolderStore.foldersLoading(),
creating = FolderStore.foldersCreating(),
deleting = FolderStore.foldersDeleting(),
renaming = FolderStore.foldersRenaming();
@ -39,7 +36,7 @@ class FoldersUserSettings
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 = !!appSettingsGet('useImapSubscribe');
}
@ -47,8 +44,7 @@ class FoldersUserSettings
folderEditOnEnter(folder) {
const nameToEdit = folder ? trim(folder.nameForEdit()) : '';
if ('' !== nameToEdit && folder.name() !== nameToEdit)
{
if ('' !== nameToEdit && folder.name() !== nameToEdit) {
Local.set(ClientSideKeyName.FoldersLashHash, '');
getApp().foldersPromisesActionHelper(
@ -65,8 +61,7 @@ class FoldersUserSettings
}
folderEditOnEsc(folder) {
if (folder)
{
if (folder) {
folder.edited(false);
}
}
@ -100,22 +95,22 @@ class FoldersUserSettings
}
deleteFolder(folderToRemove) {
if (folderToRemove && folderToRemove.canBeDeleted() && folderToRemove.deleteAccess() &&
0 === folderToRemove.privateMessageCountAll())
{
if (
folderToRemove &&
folderToRemove.canBeDeleted() &&
folderToRemove.deleteAccess() &&
0 === folderToRemove.privateMessageCountAll()
) {
this.folderForDeletion(null);
if (folderToRemove)
{
const
fRemoveFolder = function(folder) {
if (folderToRemove === folder)
{
return true;
}
folder.subFolders.remove(fRemoveFolder);
return false;
};
if (folderToRemove) {
const fRemoveFolder = function(folder) {
if (folderToRemove === folder) {
return true;
}
folder.subFolders.remove(fRemoveFolder);
return false;
};
Local.set(ClientSideKeyName.FoldersLashHash, '');
@ -128,9 +123,7 @@ class FoldersUserSettings
removeFolderFromCacheList(folderToRemove.fullNameRaw);
}
}
else if (0 < folderToRemove.privateMessageCountAll())
{
} else if (0 < folderToRemove.privateMessageCountAll()) {
FolderStore.folderList.error(getNotification(Notification.CantDeleteNonEmptyFolder));
}
}
@ -158,4 +151,4 @@ class FoldersUserSettings
}
}
export {FoldersUserSettings, FoldersUserSettings as default};
export { FoldersUserSettings, FoldersUserSettings as default };

View file

@ -1,20 +1,16 @@
import _ from '_';
import ko from 'ko';
import {MESSAGES_PER_PAGE_VALUES} from 'Common/Consts';
import {bAnimationSupported} from 'Common/Globals';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { bAnimationSupported } from 'Common/Globals';
import {SaveSettingsStep, Magics, EditorDefaultType, Layout} from 'Common/Enums';
import { SaveSettingsStep, Magics, EditorDefaultType, Layout } from 'Common/Enums';
import {
settingsSaveHelperSimpleFunction,
convertLangName, isArray, timeOutAction, boolToAjax
} from 'Common/Utils';
import { settingsSaveHelperSimpleFunction, convertLangName, isArray, timeOutAction, boolToAjax } from 'Common/Utils';
import {i18n, trigger as translatorTrigger, reload as translatorReload} from 'Common/Translator';
import { i18n, trigger as translatorTrigger, reload as translatorReload } from 'Common/Translator';
import {showScreenPopup} from 'Knoin/Knoin';
import { showScreenPopup } from 'Knoin/Knoin';
import AppStore from 'Stores/User/App';
import LanguageStore from 'Stores/Language';
@ -25,8 +21,7 @@ import MessageStore from 'Stores/User/Message';
import Remote from 'Remote/User/Ajax';
class GeneralUserSettings
{
class GeneralUserSettings {
constructor() {
this.language = LanguageStore.language;
this.languages = LanguageStore.languages;
@ -52,7 +47,7 @@ class GeneralUserSettings
this.allowLanguagesOnSettings = AppStore.allowLanguagesOnSettings;
this.languageFullName = ko.computed(() => convertLangName(this.language()));
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({throttle: Magics.Time100ms});
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: Magics.Time100ms });
this.mppTrigger = ko.observable(SaveSettingsStep.Idle);
this.editorDefaultTypeTrigger = ko.observable(SaveSettingsStep.Idle);
@ -75,27 +70,26 @@ class GeneralUserSettings
this.editorDefaultTypes = ko.computed(() => {
translatorTrigger();
return [
{'id': EditorDefaultType.Html, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
{'id': EditorDefaultType.Plain, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
{'id': EditorDefaultType.HtmlForced, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
{'id': EditorDefaultType.PlainForced, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
{ 'id': EditorDefaultType.Html, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML') },
{ 'id': EditorDefaultType.Plain, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN') },
{ 'id': EditorDefaultType.HtmlForced, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED') },
{ 'id': EditorDefaultType.PlainForced, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED') }
];
});
this.layoutTypes = ko.computed(() => {
translatorTrigger();
return [
{'id': Layout.NoPreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
{'id': Layout.SidePreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
{'id': Layout.BottomPreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
{ 'id': Layout.NoPreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT') },
{ 'id': Layout.SidePreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT') },
{ 'id': Layout.BottomPreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT') }
];
});
}
editMainIdentity() {
const identity = this.identityMain();
if (identity)
{
if (identity) {
showScreenPopup(require('View/Popup/Identity'), [identity]);
}
}
@ -106,8 +100,7 @@ class GeneralUserSettings
onBuild() {
_.delay(() => {
const
f0 = settingsSaveHelperSimpleFunction(this.editorDefaultTypeTrigger, this),
const f0 = settingsSaveHelperSimpleFunction(this.editorDefaultTypeTrigger, this),
f1 = settingsSaveHelperSimpleFunction(this.mppTrigger, this),
f2 = settingsSaveHelperSimpleFunction(this.layoutTrigger, this),
fReloadLanguageHelper = (saveSettingsStep) => () => {
@ -117,15 +110,13 @@ class GeneralUserSettings
this.language.subscribe((value) => {
this.languageTrigger(SaveSettingsStep.Animate);
translatorReload(false, value).then(
fReloadLanguageHelper(SaveSettingsStep.TrueResult),
fReloadLanguageHelper(SaveSettingsStep.FalseResult)
).then(() => {
Remote.saveSettings(null, {
'Language': value
translatorReload(false, value)
.then(fReloadLanguageHelper(SaveSettingsStep.TrueResult), fReloadLanguageHelper(SaveSettingsStep.FalseResult))
.then(() => {
Remote.saveSettings(null, {
'Language': value
});
});
});
});
this.editorDefaultType.subscribe(Remote.saveSettingsHelper('EditorDefaultType', null, f0));
@ -135,27 +126,39 @@ class GeneralUserSettings
this.useCheckboxesInList.subscribe(Remote.saveSettingsHelper('UseCheckboxesInList', boolToAjax));
this.enableDesktopNotification.subscribe((value) => {
timeOutAction('SaveDesktopNotifications', () => {
Remote.saveSettings(null, {
'DesktopNotifications': boolToAjax(value)
});
}, Magics.Time3s);
timeOutAction(
'SaveDesktopNotifications',
() => {
Remote.saveSettings(null, {
'DesktopNotifications': boolToAjax(value)
});
},
Magics.Time3s
);
});
this.enableSoundNotification.subscribe((value) => {
timeOutAction('SaveSoundNotification', () => {
Remote.saveSettings(null, {
'SoundNotification': boolToAjax(value)
});
}, Magics.Time3s);
timeOutAction(
'SaveSoundNotification',
() => {
Remote.saveSettings(null, {
'SoundNotification': boolToAjax(value)
});
},
Magics.Time3s
);
});
this.replySameFolder.subscribe((value) => {
timeOutAction('SaveReplySameFolder', () => {
Remote.saveSettings(null, {
'ReplySameFolder': boolToAjax(value)
});
}, Magics.Time3s);
timeOutAction(
'SaveReplySameFolder',
() => {
Remote.saveSettings(null, {
'ReplySameFolder': boolToAjax(value)
});
},
Magics.Time3s
);
});
this.useThreads.subscribe((value) => {
@ -179,10 +182,8 @@ class GeneralUserSettings
}
selectLanguage() {
showScreenPopup(require('View/Popup/Languages'), [
this.language, this.languages(), LanguageStore.userLanguage()
]);
showScreenPopup(require('View/Popup/Languages'), [this.language, this.languages(), LanguageStore.userLanguage()]);
}
}
export {GeneralUserSettings, GeneralUserSettings as default};
export { GeneralUserSettings, GeneralUserSettings as default };

View file

@ -1,22 +1,20 @@
import _ from '_';
import ko from 'ko';
import {delegateRunOnDestroy, boolToAjax} from 'Common/Utils';
import {Magics} from 'Common/Enums';
import {bIsHttps} from 'Common/Globals';
import { delegateRunOnDestroy, boolToAjax } from 'Common/Utils';
import { Magics } from 'Common/Enums';
import { bIsHttps } from 'Common/Globals';
import PgpStore from 'Stores/User/Pgp';
import SettingsStore from 'Stores/User/Settings';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import { getApp } from 'Helper/Apps/User';
import {showScreenPopup} from 'Knoin/Knoin';
import { showScreenPopup } from 'Knoin/Knoin';
class OpenPgpUserSettings
{
class OpenPgpUserSettings {
constructor() {
this.openpgpkeys = PgpStore.openpgpkeys;
this.openpgpkeysPublic = PgpStore.openpgpkeysPublic;
@ -38,8 +36,7 @@ class OpenPgpUserSettings
}
viewOpenPgpKey(openPgpKey) {
if (openPgpKey)
{
if (openPgpKey) {
showScreenPopup(require('View/Popup/ViewOpenPgpKey'), [openPgpKey]);
}
}
@ -49,21 +46,16 @@ class OpenPgpUserSettings
* @returns {void}
*/
deleteOpenPgpKey(openPgpKeyToRemove) {
if (openPgpKeyToRemove && openPgpKeyToRemove.deleteAccess())
{
if (openPgpKeyToRemove && openPgpKeyToRemove.deleteAccess()) {
this.openPgpKeyForDeletion(null);
if (openPgpKeyToRemove && PgpStore.openpgpKeyring)
{
if (openPgpKeyToRemove && PgpStore.openpgpKeyring) {
const findedItem = _.find(PgpStore.openpgpkeys(), (key) => openPgpKeyToRemove === key);
if (findedItem)
{
if (findedItem) {
PgpStore.openpgpkeys.remove(findedItem);
delegateRunOnDestroy(findedItem);
PgpStore
.openpgpKeyring[findedItem.isPrivate ? 'privateKeys' : 'publicKeys']
.removeForId(findedItem.guid);
PgpStore.openpgpKeyring[findedItem.isPrivate ? 'privateKeys' : 'publicKeys'].removeForId(findedItem.guid);
PgpStore.openpgpKeyring.store();
}
@ -75,13 +67,9 @@ class OpenPgpUserSettings
onBuild() {
_.delay(() => {
this.allowDraftAutosave.subscribe(
Remote.saveSettingsHelper('AllowDraftAutosave', boolToAjax)
);
this.allowDraftAutosave.subscribe(Remote.saveSettingsHelper('AllowDraftAutosave', boolToAjax));
}, Magics.Time50ms);
}
}
export {OpenPgpUserSettings, OpenPgpUserSettings as default};
export { OpenPgpUserSettings, OpenPgpUserSettings as default };

View file

@ -1,21 +1,19 @@
import _ from '_';
import ko from 'ko';
import {pInt, settingsSaveHelperSimpleFunction} from 'Common/Utils';
import {Capa, SaveSettingsStep} from 'Common/Enums';
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { Capa, SaveSettingsStep } from 'Common/Enums';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import {capa} from 'Storage/Settings';
import { capa } from 'Storage/Settings';
import {showScreenPopup} from 'Knoin/Knoin';
import { showScreenPopup } from 'Knoin/Knoin';
import SettinsStore from 'Stores/User/Settings';
import Remote from 'Remote/User/Ajax';
class SecurityUserSettings
{
class SecurityUserSettings {
constructor() {
this.capaAutoLogout = capa(Capa.AutoLogout);
this.capaTwoFactor = capa(Capa.TwoFactor);
@ -26,14 +24,14 @@ class SecurityUserSettings
this.autoLogoutOptions = ko.computed(() => {
translatorTrigger();
return [
{'id': 0, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_NEVER_OPTION_NAME')},
{'id': 5, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 5})},
{'id': 10, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 10})},
{'id': 30, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 30})},
{'id': 60, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 60})},
{'id': 60 * 2, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 2})},
{'id': 60 * 5, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 5})},
{'id': 60 * 10, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 10})}
{ 'id': 0, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_NEVER_OPTION_NAME') },
{ 'id': 5, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 5 }) },
{ 'id': 10, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 10 }) },
{ 'id': 30, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 30 }) },
{ 'id': 60, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', { 'MINUTES': 60 }) },
{ 'id': 60 * 2, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 2 }) },
{ 'id': 60 * 5, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 5 }) },
{ 'id': 60 * 10, 'name': i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', { 'HOURS': 10 }) }
];
});
}
@ -43,8 +41,7 @@ class SecurityUserSettings
}
onBuild() {
if (this.capaAutoLogout)
{
if (this.capaAutoLogout) {
_.delay(() => {
const f0 = settingsSaveHelperSimpleFunction(this.autoLogout.trigger, this);
@ -54,4 +51,4 @@ class SecurityUserSettings
}
}
export {SecurityUserSettings, SecurityUserSettings as default};
export { SecurityUserSettings, SecurityUserSettings as default };

View file

@ -1,12 +1,10 @@
import SocialStore from 'Stores/Social';
import {getApp} from 'Helper/Apps/User';
import { getApp } from 'Helper/Apps/User';
import {command} from 'Knoin/Knoin';
import { command } from 'Knoin/Knoin';
class SocialUserSettings
{
class SocialUserSettings {
constructor() {
this.googleEnable = SocialStore.google.enabled;
this.googleEnableAuth = SocialStore.google.capa.auth;
@ -33,8 +31,7 @@ class SocialUserSettings
@command((self) => !self.googleLoggined() && !self.googleActions())
connectGoogleCommand() {
if (!this.googleLoggined())
{
if (!this.googleLoggined()) {
getApp().googleConnect();
}
}
@ -46,8 +43,7 @@ class SocialUserSettings
@command((self) => !self.facebookLoggined() && !self.facebookActions())
connectFacebookCommand() {
if (!this.facebookLoggined())
{
if (!this.facebookLoggined()) {
getApp().facebookConnect();
}
}
@ -59,8 +55,7 @@ class SocialUserSettings
@command((self) => !self.twitterLoggined() && !self.twitterActions())
connectTwitterCommand() {
if (!this.twitterLoggined())
{
if (!this.twitterLoggined()) {
getApp().twitterConnect();
}
}
@ -71,4 +66,4 @@ class SocialUserSettings
}
}
export {SocialUserSettings, SocialUserSettings as default};
export { SocialUserSettings, SocialUserSettings as default };

View file

@ -1,21 +1,21 @@
import ko from 'ko';
import {i18n} from 'Common/Translator';
import { i18n } from 'Common/Translator';
import TemplateStore from 'Stores/User/Template';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import { getApp } from 'Helper/Apps/User';
import {showScreenPopup} from 'Knoin/Knoin';
import { showScreenPopup } from 'Knoin/Knoin';
class TemplatesUserSettings
{
class TemplatesUserSettings {
constructor() {
this.templates = TemplateStore.templates;
this.processText = ko.computed(() => (TemplateStore.templates.loading() ? i18n('SETTINGS_TEMPLETS/LOADING_PROCESS') : ''));
this.processText = ko.computed(() =>
TemplateStore.templates.loading() ? i18n('SETTINGS_TEMPLETS/LOADING_PROCESS') : ''
);
this.visibility = ko.computed(() => ('' === this.processText() ? 'hidden' : 'visible'));
this.templateForDeletion = ko.observable(null).deleteAccessHelper();
@ -34,19 +34,16 @@ class TemplatesUserSettings
}
editTemplate(oTemplateItem) {
if (oTemplateItem)
{
if (oTemplateItem) {
showScreenPopup(require('View/Popup/Template'), [oTemplateItem]);
}
}
deleteTemplate(templateToRemove) {
if (templateToRemove && templateToRemove.deleteAccess())
{
if (templateToRemove && templateToRemove.deleteAccess()) {
this.templateForDeletion(null);
if (templateToRemove)
{
if (templateToRemove) {
this.templates.remove((template) => templateToRemove === template);
Remote.templateDelete(() => {
@ -61,20 +58,18 @@ class TemplatesUserSettings
}
onBuild(oDom) {
const self = this;
oDom
.on('click', '.templates-list .template-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
const template = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (template)
{
self.editTemplate(template);
}
});
oDom.on('click', '.templates-list .template-item .e-action', function() {
// eslint-disable-line prefer-arrow-callback
const template = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (template) {
self.editTemplate(template);
}
});
this.reloadTemplates();
}
}
export {TemplatesUserSettings, TemplatesUserSettings as default};
export { TemplatesUserSettings, TemplatesUserSettings as default };

View file

@ -1,23 +1,21 @@
import _ from '_';
import $ from '$';
import ko from 'ko';
import Jua from 'Jua';
import {SaveSettingsStep, UploadErrorCode, Capa, Magics} from 'Common/Enums';
import {changeTheme, convertThemeName} from 'Common/Utils';
import {userBackground, themePreviewLink, uploadBackground} from 'Common/Links';
import {i18n} from 'Common/Translator';
import { SaveSettingsStep, UploadErrorCode, Capa, Magics } from 'Common/Enums';
import { changeTheme, convertThemeName } from 'Common/Utils';
import { userBackground, themePreviewLink, uploadBackground } from 'Common/Links';
import { i18n } from 'Common/Translator';
import {capa} from 'Storage/Settings';
import { capa } from 'Storage/Settings';
import ThemeStore from 'Stores/Theme';
import Remote from 'Remote/User/Ajax';
class ThemesUserSettings
{
class ThemesUserSettings {
constructor() {
this.theme = ThemeStore.theme;
this.themes = ThemeStore.themes;
@ -32,7 +30,7 @@ class ThemesUserSettings
this.capaUserBackground = ko.observable(capa(Capa.UserBackground));
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({throttle: Magics.Time100ms});
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: Magics.Time100ms });
this.iTimer = 0;
this.oThemeAjaxRequest = null;
@ -51,18 +49,19 @@ class ThemesUserSettings
this.background.hash.subscribe((value) => {
const $bg = $('#rl-bg');
if (!value)
{
if ($bg.data('backstretch'))
{
if (!value) {
if ($bg.data('backstretch')) {
$bg.backstretch('destroy').attr('style', '');
}
}
else
{
$bg.attr('style', 'background-image: none !important;').backstretch(userBackground(value), {
fade: Magics.Time1s, centeredX: true, centeredY: true
}).removeAttr('style');
} else {
$bg
.attr('style', 'background-image: none !important;')
.backstretch(userBackground(value), {
fade: Magics.Time1s,
centeredX: true,
centeredY: true
})
.removeAttr('style');
}
});
}
@ -70,12 +69,14 @@ class ThemesUserSettings
onBuild() {
const currentTheme = this.theme();
this.themesObjects(_.map(this.themes(), (theme) => ({
name: theme,
nameDisplay: convertThemeName(theme),
selected: ko.observable(theme === currentTheme),
themePreviewSrc: themePreviewLink(theme)
})));
this.themesObjects(
_.map(this.themes(), (theme) => ({
name: theme,
nameDisplay: convertThemeName(theme),
selected: ko.observable(theme === currentTheme),
themePreviewSrc: themePreviewLink(theme)
}))
);
this.initUploader();
}
@ -85,8 +86,7 @@ class ThemesUserSettings
}
clearBackground() {
if (this.capaUserBackground())
{
if (this.capaUserBackground()) {
Remote.clearUserBackground(() => {
this.background.name('');
this.background.hash('');
@ -95,18 +95,16 @@ class ThemesUserSettings
}
initUploader() {
if (this.background.uploaderButton() && this.capaUserBackground())
{
const
oJua = new Jua({
'action': uploadBackground(),
'name': 'uploader',
'queueSize': 1,
'multipleSizeLimit': 1,
'disableDragAndDrop': true,
'disableMultiple': true,
'clickElement': this.background.uploaderButton()
});
if (this.background.uploaderButton() && this.capaUserBackground()) {
const oJua = new Jua({
'action': uploadBackground(),
'name': 'uploader',
'queueSize': 1,
'multipleSizeLimit': 1,
'disableDragAndDrop': true,
'disableMultiple': true,
'clickElement': this.background.uploaderButton()
});
oJua
.on('onStart', () => {
@ -117,21 +115,16 @@ class ThemesUserSettings
.on('onComplete', (id, result, data) => {
this.background.loading(false);
if (result && id && data && data.Result && data.Result.Name && data.Result.Hash)
{
if (result && id && data && data.Result && data.Result.Name && data.Result.Hash) {
this.background.name(data.Result.Name);
this.background.hash(data.Result.Hash);
}
else
{
} else {
this.background.name('');
this.background.hash('');
let errorMsg = '';
if (data.ErrorCode)
{
switch (data.ErrorCode)
{
if (data.ErrorCode) {
switch (data.ErrorCode) {
case UploadErrorCode.FileIsTooBig:
errorMsg = i18n('SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG');
break;
@ -142,8 +135,7 @@ class ThemesUserSettings
}
}
if (!errorMsg && data.ErrorMessage)
{
if (!errorMsg && data.ErrorMessage) {
errorMsg = data.ErrorMessage;
}
@ -156,4 +148,4 @@ class ThemesUserSettings
}
}
export {ThemesUserSettings, ThemesUserSettings as default};
export { ThemesUserSettings, ThemesUserSettings as default };