mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Array.isArray to isArray
Array.isNotEmpty to isNonEmptyArray
This commit is contained in:
parent
986b8f056b
commit
0b64083543
30 changed files with 82 additions and 69 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import 'External/User/ko';
|
import 'External/User/ko';
|
||||||
|
|
||||||
import { pInt, pString } from 'Common/Utils';
|
import { isArray, isNonEmptyArray, pInt, pString } from 'Common/Utils';
|
||||||
import { isPosNumeric, delegateRunOnDestroy, mailToHelper } from 'Common/UtilsUser';
|
import { isPosNumeric, delegateRunOnDestroy, mailToHelper } from 'Common/UtilsUser';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -275,7 +275,7 @@ class AppUser extends AbstractApp {
|
||||||
|
|
||||||
moveOrDeleteResponseHelper(iError, oData) {
|
moveOrDeleteResponseHelper(iError, oData) {
|
||||||
if (!iError && FolderUserStore.currentFolder()) {
|
if (!iError && FolderUserStore.currentFolder()) {
|
||||||
if (oData && Array.isArray(oData.Result) && 2 === oData.Result.length) {
|
if (oData && isArray(oData.Result) && 2 === oData.Result.length) {
|
||||||
setFolderHash(oData.Result[0], oData.Result[1]);
|
setFolderHash(oData.Result[0], oData.Result[1]);
|
||||||
} else {
|
} else {
|
||||||
setFolderHash(FolderUserStore.currentFolderFullNameRaw(), '');
|
setFolderHash(FolderUserStore.currentFolderFullNameRaw(), '');
|
||||||
|
|
@ -367,7 +367,7 @@ class AppUser extends AbstractApp {
|
||||||
* @param {boolean=} bCopy = false
|
* @param {boolean=} bCopy = false
|
||||||
*/
|
*/
|
||||||
moveMessagesToFolder(sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy) {
|
moveMessagesToFolder(sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy) {
|
||||||
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Array.isArray(aUidForMove) && aUidForMove.length) {
|
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && isArray(aUidForMove) && aUidForMove.length) {
|
||||||
const oFromFolder = getFolderFromCacheList(sFromFolderFullNameRaw),
|
const oFromFolder = getFolderFromCacheList(sFromFolderFullNameRaw),
|
||||||
oToFolder = getFolderFromCacheList(sToFolderFullNameRaw);
|
oToFolder = getFolderFromCacheList(sToFolderFullNameRaw);
|
||||||
|
|
||||||
|
|
@ -479,7 +479,7 @@ class AppUser extends AbstractApp {
|
||||||
sAccountEmail = AccountUserStore.email();
|
sAccountEmail = AccountUserStore.email();
|
||||||
let parentEmail = SettingsGet('ParentEmail') || sAccountEmail;
|
let parentEmail = SettingsGet('ParentEmail') || sAccountEmail;
|
||||||
|
|
||||||
if (Array.isArray(oData.Result.Accounts)) {
|
if (isArray(oData.Result.Accounts)) {
|
||||||
AccountUserStore.accounts.forEach(oAccount =>
|
AccountUserStore.accounts.forEach(oAccount =>
|
||||||
counts[oAccount.email] = oAccount.count()
|
counts[oAccount.email] = oAccount.count()
|
||||||
);
|
);
|
||||||
|
|
@ -493,7 +493,7 @@ class AppUser extends AbstractApp {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(oData.Result.Identities)) {
|
if (isArray(oData.Result.Identities)) {
|
||||||
delegateRunOnDestroy(IdentityUserStore());
|
delegateRunOnDestroy(IdentityUserStore());
|
||||||
|
|
||||||
IdentityUserStore(
|
IdentityUserStore(
|
||||||
|
|
@ -522,7 +522,7 @@ class AppUser extends AbstractApp {
|
||||||
Remote.templates((iError, data) => {
|
Remote.templates((iError, data) => {
|
||||||
TemplateUserStore.templates.loading(false);
|
TemplateUserStore.templates.loading(false);
|
||||||
|
|
||||||
if (!iError && data.Result && Array.isArray(data.Result.Templates)) {
|
if (!iError && data.Result && isArray(data.Result.Templates)) {
|
||||||
delegateRunOnDestroy(TemplateUserStore.templates());
|
delegateRunOnDestroy(TemplateUserStore.templates());
|
||||||
|
|
||||||
TemplateUserStore.templates(
|
TemplateUserStore.templates(
|
||||||
|
|
@ -540,7 +540,7 @@ class AppUser extends AbstractApp {
|
||||||
!iError &&
|
!iError &&
|
||||||
data &&
|
data &&
|
||||||
data.Result &&
|
data.Result &&
|
||||||
Array.isArray(data.Result) &&
|
isArray(data.Result) &&
|
||||||
1 < data.Result.length &&
|
1 < data.Result.length &&
|
||||||
isPosNumeric(data.Result[0], true) &&
|
isPosNumeric(data.Result[0], true) &&
|
||||||
isPosNumeric(data.Result[1], true)
|
isPosNumeric(data.Result[1], true)
|
||||||
|
|
@ -635,9 +635,9 @@ class AppUser extends AbstractApp {
|
||||||
*/
|
*/
|
||||||
folderInformationMultiply(boot = false) {
|
folderInformationMultiply(boot = false) {
|
||||||
const folders = FolderUserStore.getNextFolderNames();
|
const folders = FolderUserStore.getNextFolderNames();
|
||||||
if (Array.isNotEmpty(folders)) {
|
if (isNonEmptyArray(folders)) {
|
||||||
Remote.folderInformationMultiply((iError, oData) => {
|
Remote.folderInformationMultiply((iError, oData) => {
|
||||||
if (!iError && oData && oData.Result && oData.Result.List && Array.isNotEmpty(oData.Result.List)) {
|
if (!iError && oData && oData.Result && oData.Result.List && isNonEmptyArray(oData.Result.List)) {
|
||||||
const utc = Date.now();
|
const utc = Date.now();
|
||||||
oData.Result.List.forEach(item => {
|
oData.Result.List.forEach(item => {
|
||||||
const hash = getFolderHash(item.Folder),
|
const hash = getFolderHash(item.Folder),
|
||||||
|
|
@ -760,7 +760,7 @@ class AppUser extends AbstractApp {
|
||||||
*/
|
*/
|
||||||
getAutocomplete(query, autocompleteCallback) {
|
getAutocomplete(query, autocompleteCallback) {
|
||||||
Remote.suggestions((iError, data) => {
|
Remote.suggestions((iError, data) => {
|
||||||
if (!iError && data && Array.isArray(data.Result)) {
|
if (!iError && data && isArray(data.Result)) {
|
||||||
autocompleteCallback(
|
autocompleteCallback(
|
||||||
data.Result.map(item => (item && item[0] ? new EmailModel(item[0], item[1]) : null)).filter(v => v)
|
data.Result.map(item => (item && item[0] ? new EmailModel(item[0], item[1]) : null)).filter(v => v)
|
||||||
);
|
);
|
||||||
|
|
@ -776,7 +776,7 @@ class AppUser extends AbstractApp {
|
||||||
*/
|
*/
|
||||||
setExpandedFolder(sFullNameHash, bExpanded) {
|
setExpandedFolder(sFullNameHash, bExpanded) {
|
||||||
let aExpandedList = Local.get(ClientSideKeyName.ExpandedFolders);
|
let aExpandedList = Local.get(ClientSideKeyName.ExpandedFolders);
|
||||||
if (!Array.isArray(aExpandedList)) {
|
if (!isArray(aExpandedList)) {
|
||||||
aExpandedList = [];
|
aExpandedList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { MessageSetAction } from 'Common/EnumsUser';
|
import { MessageSetAction } from 'Common/EnumsUser';
|
||||||
import { pInt } from 'Common/Utils';
|
import { isNonEmptyArray, pInt } from 'Common/Utils';
|
||||||
|
|
||||||
let FOLDERS_CACHE = {},
|
let FOLDERS_CACHE = {},
|
||||||
FOLDERS_NAME_CACHE = {},
|
FOLDERS_NAME_CACHE = {},
|
||||||
|
|
@ -255,7 +255,7 @@ export class MessageFlagsCache
|
||||||
* @param {Array} flags
|
* @param {Array} flags
|
||||||
*/
|
*/
|
||||||
static storeByFolderAndUid(folder, uid, flags) {
|
static storeByFolderAndUid(folder, uid, flags) {
|
||||||
if (Array.isNotEmpty(flags)) {
|
if (isNonEmptyArray(flags)) {
|
||||||
this.setFor(folder, uid, flags);
|
this.setFor(folder, uid, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,7 +269,7 @@ export class MessageFlagsCache
|
||||||
let unread = 0;
|
let unread = 0;
|
||||||
const flags = this.getFor(folder, uid);
|
const flags = this.getFor(folder, uid);
|
||||||
|
|
||||||
if (Array.isNotEmpty(flags)) {
|
if (isNonEmptyArray(flags)) {
|
||||||
if (flags[0]) {
|
if (flags[0]) {
|
||||||
unread = 1;
|
unread = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* eslint key-spacing: 0 */
|
/* eslint key-spacing: 0 */
|
||||||
/* eslint quote-props: 0 */
|
/* eslint quote-props: 0 */
|
||||||
|
|
||||||
|
import { isNonEmptyArray } from 'Common/Utils';
|
||||||
|
|
||||||
const
|
const
|
||||||
cache = {},
|
cache = {},
|
||||||
app = 'application/',
|
app = 'application/',
|
||||||
|
|
@ -279,7 +281,7 @@ export const FileInfo = {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
getCombinedIconClass: data => {
|
getCombinedIconClass: data => {
|
||||||
if (Array.isNotEmpty(data)) {
|
if (isNonEmptyArray(data)) {
|
||||||
let icons = data
|
let icons = data
|
||||||
.map(item => item ? FileInfo.getIconClass(FileInfo.getExtension(item[0]), item[1])[0] : '')
|
.map(item => item ? FileInfo.getIconClass(FileInfo.getExtension(item[0]), item[1])[0] : '')
|
||||||
.validUnique();
|
.validUnique();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
import { isArray } from 'Common/Utils';
|
||||||
|
|
||||||
export class Selector {
|
export class Selector {
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,7 +80,7 @@ export class Selector {
|
||||||
|
|
||||||
this.list.subscribe(
|
this.list.subscribe(
|
||||||
items => {
|
items => {
|
||||||
if (Array.isArray(items)) {
|
if (isArray(items)) {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
if (item) {
|
if (item) {
|
||||||
const uid = this.getItemUid(item);
|
const uid = this.getItemUid(item);
|
||||||
|
|
@ -115,7 +116,7 @@ export class Selector {
|
||||||
this.focusedItem(null);
|
this.focusedItem(null);
|
||||||
this.selectedItem(null);
|
this.selectedItem(null);
|
||||||
|
|
||||||
if (Array.isArray(aItems)) {
|
if (isArray(aItems)) {
|
||||||
len = aCheckedCache.length;
|
len = aCheckedCache.length;
|
||||||
|
|
||||||
aItems.forEach(item => {
|
aItems.forEach(item => {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { doc, elementById } from 'Common/Globals';
|
||||||
|
|
||||||
export const
|
export const
|
||||||
isArray = Array.isArray,
|
isArray = Array.isArray,
|
||||||
isNonEmptyArray = Array.isNotEmpty;
|
isNonEmptyArray = array => isArray(array) && array.length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {*} value
|
* @param {*} value
|
||||||
|
|
@ -116,7 +116,7 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
|
||||||
}
|
}
|
||||||
rl.fetchJSON(url, init)
|
rl.fetchJSON(url, init)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data && Array.isArray(data) && 2 === data.length) {
|
if (data && isArray(data) && 2 === data.length) {
|
||||||
if (themeLink && !themeStyle) {
|
if (themeLink && !themeStyle) {
|
||||||
themeStyle = doc.createElement('style');
|
themeStyle = doc.createElement('style');
|
||||||
themeStyle.id = 'app-theme-style';
|
themeStyle.id = 'app-theme-style';
|
||||||
|
|
@ -139,7 +139,7 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
|
||||||
|
|
||||||
export function addObservablesTo(target, observables) {
|
export function addObservablesTo(target, observables) {
|
||||||
Object.entries(observables).forEach(([key, value]) =>
|
Object.entries(observables).forEach(([key, value]) =>
|
||||||
target[key] = /*Array.isArray(value) ? ko.observableArray(value) :*/ ko.observable(value) );
|
target[key] = /*isArray(value) ? ko.observableArray(value) :*/ ko.observable(value) );
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addComputablesTo(target, computables) {
|
export function addComputablesTo(target, computables) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { doc, createElement } from 'Common/Globals';
|
import { doc, createElement } from 'Common/Globals';
|
||||||
|
import { isArray } from 'Common/Utils';
|
||||||
import { EmailModel } from 'Model/Email';
|
import { EmailModel } from 'Model/Email';
|
||||||
|
|
||||||
const contentType = 'snappymail/emailaddress',
|
const contentType = 'snappymail/emailaddress',
|
||||||
|
|
@ -204,7 +205,7 @@ export class EmailAddressesComponent {
|
||||||
_setChosen(valArr) {
|
_setChosen(valArr) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (!Array.isArray(valArr)){
|
if (!isArray(valArr)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
3
dev/External/User/ko.js
vendored
3
dev/External/User/ko.js
vendored
|
|
@ -3,6 +3,7 @@ import ko from 'ko';
|
||||||
import { HtmlEditor } from 'Common/Html';
|
import { HtmlEditor } from 'Common/Html';
|
||||||
import { timeToNode } from 'Common/Momentor';
|
import { timeToNode } from 'Common/Momentor';
|
||||||
import { elementById } from 'Common/Globals';
|
import { elementById } from 'Common/Globals';
|
||||||
|
import { isArray } from 'Common/Utils';
|
||||||
import { EmailAddressesComponent } from 'Component/EmailAddresses';
|
import { EmailAddressesComponent } from 'Component/EmailAddresses';
|
||||||
import { ThemeStore } from 'Stores/Theme';
|
import { ThemeStore } from 'Stores/Theme';
|
||||||
|
|
||||||
|
|
@ -144,7 +145,7 @@ ko.bindingHandlers.dropmessages = {
|
||||||
fnStop(e);
|
fnStop(e);
|
||||||
if ('messages' === getDragAction(e) && ['move','copy'].includes(e.dataTransfer.effectAllowed)) {
|
if ('messages' === getDragAction(e) && ['move','copy'].includes(e.dataTransfer.effectAllowed)) {
|
||||||
let data = dragData.data;
|
let data = dragData.data;
|
||||||
if (folder && data && data.folder && Array.isArray(data.uids)) {
|
if (folder && data && data.folder && isArray(data.uids)) {
|
||||||
rl.app.moveMessagesToFolder(data.folder, data.uids, folder.fullNameRaw, data.copy && e.ctrlKey);
|
rl.app.moveMessagesToFolder(data.folder, data.uids, folder.fullNameRaw, data.copy && e.ctrlKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
dev/External/ko.js
vendored
3
dev/External/ko.js
vendored
|
|
@ -1,6 +1,7 @@
|
||||||
import { i18n, i18nToNodes, trigger } from 'Common/Translator';
|
import { i18n, i18nToNodes, trigger } from 'Common/Translator';
|
||||||
import { doc, createElement } from 'Common/Globals';
|
import { doc, createElement } from 'Common/Globals';
|
||||||
import { SaveSettingsStep } from 'Common/Enums';
|
import { SaveSettingsStep } from 'Common/Enums';
|
||||||
|
import { isNonEmptyArray } from 'Common/Utils';
|
||||||
|
|
||||||
const
|
const
|
||||||
isFunction = v => typeof v === 'function',
|
isFunction = v => typeof v === 'function',
|
||||||
|
|
@ -146,7 +147,7 @@ ko.extenders.limitedList = (target, limitedList) => {
|
||||||
const currentValue = ko.unwrap(target),
|
const currentValue = ko.unwrap(target),
|
||||||
list = ko.unwrap(limitedList);
|
list = ko.unwrap(limitedList);
|
||||||
|
|
||||||
if (Array.isNotEmpty(list)) {
|
if (isNonEmptyArray(list)) {
|
||||||
if (list.includes(newValue)) {
|
if (list.includes(newValue)) {
|
||||||
target(newValue);
|
target(newValue);
|
||||||
} else if (list.includes(currentValue, list)) {
|
} else if (list.includes(currentValue, list)) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { addObservablesTo, addComputablesTo } from 'Common/Utils';
|
import { isArray, addObservablesTo, addComputablesTo } from 'Common/Utils';
|
||||||
|
|
||||||
function dispose(disposable) {
|
function dispose(disposable) {
|
||||||
if (disposable && 'function' === typeof disposable.dispose) {
|
if (disposable && 'function' === typeof disposable.dispose) {
|
||||||
|
|
@ -16,7 +16,7 @@ function typeCast(curValue, newValue) {
|
||||||
if (curValue.constructor.reviveFromJson) {
|
if (curValue.constructor.reviveFromJson) {
|
||||||
return curValue.constructor.reviveFromJson(newValue);
|
return curValue.constructor.reviveFromJson(newValue);
|
||||||
}
|
}
|
||||||
if (Array.isArray(curValue) && !Array.isArray(newValue))
|
if (isArray(curValue) && !isArray(newValue))
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
import { isArray, isNonEmptyArray } from 'Common/Utils';
|
||||||
|
|
||||||
export class AbstractScreen {
|
export class AbstractScreen {
|
||||||
constructor(screenName, viewModels = []) {
|
constructor(screenName, viewModels = []) {
|
||||||
this.oCross = null;
|
this.oCross = null;
|
||||||
this.sScreenName = screenName;
|
this.sScreenName = screenName;
|
||||||
this.aViewModels = Array.isArray(viewModels) ? viewModels : [];
|
this.aViewModels = isArray(viewModels) ? viewModels : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,7 +42,7 @@ export class AbstractScreen {
|
||||||
if (!this.__started) {
|
if (!this.__started) {
|
||||||
this.__started = true;
|
this.__started = true;
|
||||||
const routes = this.routes();
|
const routes = this.routes();
|
||||||
if (Array.isNotEmpty(routes)) {
|
if (isNonEmptyArray(routes)) {
|
||||||
let route = new Crossroads(),
|
let route = new Crossroads(),
|
||||||
fMatcher = (this.onRoute || (()=>{})).bind(this);
|
fMatcher = (this.onRoute || (()=>{})).bind(this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isArray } from 'Common/Utils';
|
||||||
|
|
||||||
export class AbstractCollectionModel extends Array
|
export class AbstractCollectionModel extends Array
|
||||||
{
|
{
|
||||||
|
|
@ -27,7 +28,7 @@ export class AbstractCollectionModel extends Array
|
||||||
// json[@Count]
|
// json[@Count]
|
||||||
json = json['@Collection'];
|
json = json['@Collection'];
|
||||||
}
|
}
|
||||||
if (Array.isArray(json)) {
|
if (isArray(json)) {
|
||||||
json.forEach(item => {
|
json.forEach(item => {
|
||||||
item && itemCallback && (item = itemCallback(item, result));
|
item && itemCallback && (item = itemCallback(item, result));
|
||||||
item && result.push(item);
|
item && result.push(item);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { isNonEmptyArray } from 'Common/Utils';
|
||||||
import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty';
|
import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty';
|
||||||
|
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
||||||
export class ContactModel extends AbstractModel {
|
export class ContactModel extends AbstractModel {
|
||||||
|
|
@ -26,7 +26,7 @@ export class ContactModel extends AbstractModel {
|
||||||
let name = '',
|
let name = '',
|
||||||
email = '';
|
email = '';
|
||||||
|
|
||||||
if (Array.isNotEmpty(this.properties)) {
|
if (isNonEmptyArray(this.properties)) {
|
||||||
this.properties.forEach(property => {
|
this.properties.forEach(property => {
|
||||||
if (property) {
|
if (property) {
|
||||||
if (ContactPropertyType.FirstName === property.type()) {
|
if (ContactPropertyType.FirstName === property.type()) {
|
||||||
|
|
@ -52,7 +52,7 @@ export class ContactModel extends AbstractModel {
|
||||||
const contact = super.reviveFromJson(json);
|
const contact = super.reviveFromJson(json);
|
||||||
if (contact) {
|
if (contact) {
|
||||||
let list = [];
|
let list = [];
|
||||||
if (Array.isNotEmpty(json.properties)) {
|
if (isNonEmptyArray(json.properties)) {
|
||||||
json.properties.forEach(property => {
|
json.properties.forEach(property => {
|
||||||
property = ContactPropertyModel.reviveFromJson(property);
|
property = ContactPropertyModel.reviveFromJson(property);
|
||||||
property && list.push(property);
|
property && list.push(property);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { pString } from 'Common/Utils';
|
import { isNonEmptyArray, pString } from 'Common/Utils';
|
||||||
import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
import { getFolderFromCacheList } from 'Common/Cache';
|
import { getFolderFromCacheList } from 'Common/Cache';
|
||||||
|
|
@ -230,7 +230,7 @@ export class FilterModel extends AbstractModel {
|
||||||
|
|
||||||
filter.conditions([]);
|
filter.conditions([]);
|
||||||
|
|
||||||
if (Array.isNotEmpty(json.Conditions)) {
|
if (isNonEmptyArray(json.Conditions)) {
|
||||||
filter.conditions(
|
filter.conditions(
|
||||||
json.Conditions.map(aData => FilterConditionModel.reviveFromJson(aData)).filter(v => v)
|
json.Conditions.map(aData => FilterConditionModel.reviveFromJson(aData)).filter(v => v)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { AbstractCollectionModel } from 'Model/AbstractCollection';
|
import { AbstractCollectionModel } from 'Model/AbstractCollection';
|
||||||
|
|
||||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||||
import { pInt } from 'Common/Utils';
|
import { isArray, pInt } from 'Common/Utils';
|
||||||
import { ClientSideKeyName, FolderType } from 'Common/EnumsUser';
|
import { ClientSideKeyName, FolderType } from 'Common/EnumsUser';
|
||||||
import * as Cache from 'Common/Cache';
|
import * as Cache from 'Common/Cache';
|
||||||
import { Settings, SettingsGet } from 'Common/Globals';
|
import { Settings, SettingsGet } from 'Common/Globals';
|
||||||
|
|
@ -75,7 +75,7 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||||
|
|
||||||
if (oCacheFolder) {
|
if (oCacheFolder) {
|
||||||
oCacheFolder.collapsed(!expandedFolders
|
oCacheFolder.collapsed(!expandedFolders
|
||||||
|| !Array.isArray(expandedFolders)
|
|| !isArray(expandedFolders)
|
||||||
|| !expandedFolders.includes(oCacheFolder.fullNameHash));
|
|| !expandedFolders.includes(oCacheFolder.fullNameHash));
|
||||||
|
|
||||||
if (oFolder.Extended) {
|
if (oFolder.Extended) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { MessagePriority } from 'Common/EnumsUser';
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
|
|
||||||
import { encodeHtml } from 'Common/Html';
|
import { encodeHtml } from 'Common/Html';
|
||||||
import { isArray } from 'Common/Utils';
|
import { isArray, isNonEmptyArray } from 'Common/Utils';
|
||||||
|
|
||||||
import { serverRequestRaw } from 'Common/Links';
|
import { serverRequestRaw } from 'Common/Links';
|
||||||
|
|
||||||
|
|
@ -223,7 +223,7 @@ export class MessageModel extends AbstractModel {
|
||||||
*/
|
*/
|
||||||
fromDkimData() {
|
fromDkimData() {
|
||||||
let result = ['none', ''];
|
let result = ['none', ''];
|
||||||
if (Array.isNotEmpty(this.from) && 1 === this.from.length && this.from[0] && this.from[0].dkimStatus) {
|
if (isNonEmptyArray(this.from) && 1 === this.from.length && this.from[0] && this.from[0].dkimStatus) {
|
||||||
result = [this.from[0].dkimStatus, this.from[0].dkimValue || ''];
|
result = [this.from[0].dkimStatus, this.from[0].dkimValue || ''];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
|
import { isNonEmptyArray } from 'Common/Utils';
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
||||||
import { PgpUserStore } from 'Stores/User/Pgp';
|
import { PgpUserStore } from 'Stores/User/Pgp';
|
||||||
|
|
||||||
export class OpenPgpKeyModel extends AbstractModel {
|
export class OpenPgpKeyModel extends AbstractModel {
|
||||||
|
|
@ -21,7 +21,7 @@ export class OpenPgpKeyModel extends AbstractModel {
|
||||||
|
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.id = ID;
|
this.id = ID;
|
||||||
this.ids = Array.isNotEmpty(IDs) ? IDs : [ID];
|
this.ids = isNonEmptyArray(IDs) ? IDs : [ID];
|
||||||
this.guid = guID;
|
this.guid = guID;
|
||||||
this.user = '';
|
this.user = '';
|
||||||
this.users = userIDs;
|
this.users = userIDs;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
||||||
|
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
import { FilterModel } from 'Model/Filter';
|
import { FilterModel } from 'Model/Filter';
|
||||||
import { pString } from 'Common/Utils';
|
import { isNonEmptyArray, pString } from 'Common/Utils';
|
||||||
|
|
||||||
const SIEVE_FILE_NAME = 'rainloop.user';
|
const SIEVE_FILE_NAME = 'rainloop.user';
|
||||||
|
|
||||||
|
|
@ -327,7 +327,7 @@ export class SieveScriptModel extends AbstractModel
|
||||||
if (script) {
|
if (script) {
|
||||||
if (script.allowFilters()) {
|
if (script.allowFilters()) {
|
||||||
script.filters(
|
script.filters(
|
||||||
Array.isNotEmpty(json.filters)
|
isNonEmptyArray(json.filters)
|
||||||
? json.filters.map(aData => FilterModel.reviveFromJson(aData)).filter(v => v)
|
? json.filters.map(aData => FilterModel.reviveFromJson(aData)).filter(v => v)
|
||||||
: sieveScriptToFilters(script.body())
|
: sieveScriptToFilters(script.body())
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Notification } from 'Common/Enums';
|
import { Notification } from 'Common/Enums';
|
||||||
import { Settings } from 'Common/Globals';
|
import { Settings } from 'Common/Globals';
|
||||||
import { pInt, pString } from 'Common/Utils';
|
import { isArray, pInt, pString } from 'Common/Utils';
|
||||||
import { serverRequest } from 'Common/Links';
|
import { serverRequest } from 'Common/Links';
|
||||||
|
|
||||||
let iJsonErrorCount = 0,
|
let iJsonErrorCount = 0,
|
||||||
|
|
@ -169,7 +169,7 @@ export class AbstractFetchRemote
|
||||||
setTrigger(trigger, value) {
|
setTrigger(trigger, value) {
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
value = !!value;
|
value = !!value;
|
||||||
(Array.isArray(trigger) ? trigger : [trigger]).forEach(fTrigger => {
|
(isArray(trigger) ? trigger : [trigger]).forEach(fTrigger => {
|
||||||
fTrigger && fTrigger(value);
|
fTrigger && fTrigger(value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { pString, pInt } from 'Common/Utils';
|
import { isArray, isNonEmptyArray, pString, pInt } from 'Common/Utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getFolderHash,
|
getFolderHash,
|
||||||
|
|
@ -440,7 +440,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
let request = true;
|
let request = true;
|
||||||
const uids = [];
|
const uids = [];
|
||||||
|
|
||||||
if (Array.isNotEmpty(list)) {
|
if (isNonEmptyArray(list)) {
|
||||||
request = false;
|
request = false;
|
||||||
list.forEach(messageListItem => {
|
list.forEach(messageListItem => {
|
||||||
if (!MessageFlagsCache.getFor(messageListItem.folder, messageListItem.uid)) {
|
if (!MessageFlagsCache.getFor(messageListItem.folder, messageListItem.uid)) {
|
||||||
|
|
@ -464,7 +464,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
if (request) {
|
if (request) {
|
||||||
this.defaultRequest(fCallback, 'FolderInformation', {
|
this.defaultRequest(fCallback, 'FolderInformation', {
|
||||||
Folder: folder,
|
Folder: folder,
|
||||||
FlagsUids: Array.isArray(uids) ? uids.join(',') : '',
|
FlagsUids: isArray(uids) ? uids.join(',') : '',
|
||||||
UidNext: getFolderInboxName() === folder ? getFolderUidNext(folder) : ''
|
UidNext: getFolderInboxName() === folder ? getFolderUidNext(folder) : ''
|
||||||
});
|
});
|
||||||
} else if (SettingsUserStore.useThreads()) {
|
} else if (SettingsUserStore.useThreads()) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
isArray,
|
||||||
pInt,
|
pInt,
|
||||||
settingsSaveHelperSimpleFunction,
|
settingsSaveHelperSimpleFunction,
|
||||||
changeTheme,
|
changeTheme,
|
||||||
|
|
@ -27,7 +28,7 @@ export class GeneralAdminSettings {
|
||||||
this.languages = LanguageStore.languages;
|
this.languages = LanguageStore.languages;
|
||||||
|
|
||||||
const aLanguagesAdmin = Settings.app('languagesAdmin');
|
const aLanguagesAdmin = Settings.app('languagesAdmin');
|
||||||
this.languagesAdmin = ko.observableArray(Array.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
this.languagesAdmin = ko.observableArray(isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
||||||
this.languageAdmin = ko
|
this.languageAdmin = ko
|
||||||
.observable(SettingsGet('LanguageAdmin'))
|
.observable(SettingsGet('LanguageAdmin'))
|
||||||
.extend({ limitedList: this.languagesAdmin });
|
.extend({ limitedList: this.languagesAdmin });
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
||||||
import { SaveSettingsStep } from 'Common/Enums';
|
import { SaveSettingsStep } from 'Common/Enums';
|
||||||
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
|
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
|
||||||
import { SettingsGet } from 'Common/Globals';
|
import { SettingsGet } from 'Common/Globals';
|
||||||
import { settingsSaveHelperSimpleFunction, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
import { isArray, settingsSaveHelperSimpleFunction, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||||
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
|
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
|
||||||
|
|
||||||
import { showScreenPopup } from 'Knoin/Knoin';
|
import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
|
|
@ -57,7 +57,7 @@ export class GeneralUserSettings {
|
||||||
|
|
||||||
this.identityMain = ko.computed(() => {
|
this.identityMain = ko.computed(() => {
|
||||||
const list = this.identities();
|
const list = this.identities();
|
||||||
return Array.isArray(list) ? list.find(item => item && !item.id()) : null;
|
return isArray(list) ? list.find(item => item && !item.id()) : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.identityMainDesc = ko.computed(() => {
|
this.identityMainDesc = ko.computed(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
import { isArray } from 'Common/Utils';
|
||||||
import Remote from 'Remote/Admin/Fetch';
|
import Remote from 'Remote/Admin/Fetch';
|
||||||
|
|
||||||
export const PackageAdminStore = ko.observableArray();
|
export const PackageAdminStore = ko.observableArray();
|
||||||
|
|
@ -23,7 +24,7 @@ PackageAdminStore.fetch = () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Array.isArray(data.Result.List)) {
|
if (isArray(data.Result.List)) {
|
||||||
list = data.Result.List.map(item => {
|
list = data.Result.List.map(item => {
|
||||||
if (item) {
|
if (item) {
|
||||||
item.loading = ko.observable(loading[item.file] !== undefined);
|
item.loading = ko.observable(loading[item.file] !== undefined);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { Settings, SettingsGet } from 'Common/Globals';
|
import { Settings, SettingsGet } from 'Common/Globals';
|
||||||
|
import { isArray } from 'Common/Utils';
|
||||||
|
|
||||||
export const LanguageStore = {
|
export const LanguageStore = {
|
||||||
languages: ko.observableArray(),
|
languages: ko.observableArray(),
|
||||||
|
|
@ -7,7 +8,7 @@ export const LanguageStore = {
|
||||||
|
|
||||||
populate: function() {
|
populate: function() {
|
||||||
const aLanguages = Settings.app('languages');
|
const aLanguages = Settings.app('languages');
|
||||||
this.languages(Array.isArray(aLanguages) ? aLanguages : []);
|
this.languages(isArray(aLanguages) ? aLanguages : []);
|
||||||
this.language(SettingsGet('Language'));
|
this.language(SettingsGet('Language'));
|
||||||
this.userLanguage(SettingsGet('UserLanguage'));
|
this.userLanguage(SettingsGet('UserLanguage'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { $htmlCL, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
|
import { $htmlCL, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
|
||||||
|
import { isArray } from 'Common/Utils';
|
||||||
|
|
||||||
export const ThemeStore = {
|
export const ThemeStore = {
|
||||||
themes: ko.observableArray(),
|
themes: ko.observableArray(),
|
||||||
|
|
@ -10,7 +11,7 @@ export const ThemeStore = {
|
||||||
populate: function(){
|
populate: function(){
|
||||||
const themes = Settings.app('themes');
|
const themes = Settings.app('themes');
|
||||||
|
|
||||||
this.themes(Array.isArray(themes) ? themes : []);
|
this.themes(isArray(themes) ? themes : []);
|
||||||
this.theme(SettingsGet('Theme'));
|
this.theme(SettingsGet('Theme'));
|
||||||
if (!this.isMobile()) {
|
if (!this.isMobile()) {
|
||||||
this.userBackgroundName(SettingsGet('UserBackgroundName'));
|
this.userBackgroundName(SettingsGet('UserBackgroundName'));
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import ko from 'ko';
|
||||||
import { Scope, Notification } from 'Common/Enums';
|
import { Scope, Notification } from 'Common/Enums';
|
||||||
import { MessageSetAction } from 'Common/EnumsUser';
|
import { MessageSetAction } from 'Common/EnumsUser';
|
||||||
import { doc, elementById } from 'Common/Globals';
|
import { doc, elementById } from 'Common/Globals';
|
||||||
import { pInt, pString, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
import { isNonEmptyArray, pInt, pString, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||||
import { plainToHtml } from 'Common/UtilsUser';
|
import { plainToHtml } from 'Common/UtilsUser';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -237,7 +237,7 @@ export const MessageUserStore = new class {
|
||||||
|
|
||||||
initUidNextAndNewMessages(folder, uidNext, newMessages) {
|
initUidNextAndNewMessages(folder, uidNext, newMessages) {
|
||||||
if (getFolderInboxName() === folder && uidNext) {
|
if (getFolderInboxName() === folder && uidNext) {
|
||||||
if (Array.isNotEmpty(newMessages)) {
|
if (isNonEmptyArray(newMessages)) {
|
||||||
newMessages.forEach(item => addNewMessageCache(folder, item.Uid));
|
newMessages.forEach(item => addNewMessageCache(folder, item.Uid));
|
||||||
|
|
||||||
NotificationUserStore.playSoundNotification();
|
NotificationUserStore.playSoundNotification();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
import { pString } from 'Common/Utils';
|
import { isArray, isNonEmptyArray, pString } from 'Common/Utils';
|
||||||
import { doc } from 'Common/Globals';
|
import { doc } from 'Common/Globals';
|
||||||
|
|
||||||
import { AccountUserStore } from 'Stores/User/Account';
|
import { AccountUserStore } from 'Stores/User/Account';
|
||||||
|
|
@ -54,7 +54,7 @@ function domControlEncryptedClickHelper(store, dom, armoredMessage, recipients)
|
||||||
decryptedMessage.getText()
|
decryptedMessage.getText()
|
||||||
);
|
);
|
||||||
} else if (validPrivateKey) {
|
} else if (validPrivateKey) {
|
||||||
const keyIds = Array.isNotEmpty(signingKeyIds) ? signingKeyIds : null,
|
const keyIds = isNonEmptyArray(signingKeyIds) ? signingKeyIds : null,
|
||||||
additional = keyIds
|
additional = keyIds
|
||||||
? keyIds.map(item => (item && item.toHex ? item.toHex() : null)).filter(v => v).join(', ')
|
? keyIds.map(item => (item && item.toHex ? item.toHex() : null)).filter(v => v).join(', ')
|
||||||
: '';
|
: '';
|
||||||
|
|
@ -110,7 +110,7 @@ function domControlSignedClickHelper(store, dom, armoredMessage) {
|
||||||
message.getText()
|
message.getText()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const keyIds = Array.isNotEmpty(signingKeyIds) ? signingKeyIds : null,
|
const keyIds = isNonEmptyArray(signingKeyIds) ? signingKeyIds : null,
|
||||||
additional = keyIds
|
additional = keyIds
|
||||||
? keyIds.map(item => (item && item.toHex ? item.toHex() : null)).filter(v => v).join(', ')
|
? keyIds.map(item => (item && item.toHex ? item.toHex() : null)).filter(v => v).join(', ')
|
||||||
: '';
|
: '';
|
||||||
|
|
@ -179,14 +179,14 @@ export const PgpUserStore = new class {
|
||||||
}
|
}
|
||||||
|
|
||||||
findPrivateKeysByEncryptionKeyIds(encryptionKeyIds, recipients, returnWrapKeys) {
|
findPrivateKeysByEncryptionKeyIds(encryptionKeyIds, recipients, returnWrapKeys) {
|
||||||
let result = Array.isArray(encryptionKeyIds)
|
let result = isArray(encryptionKeyIds)
|
||||||
? encryptionKeyIds.map(id => {
|
? encryptionKeyIds.map(id => {
|
||||||
const key = id && id.toHex ? this.findPrivateKeyByHex(id.toHex()) : null;
|
const key = id && id.toHex ? this.findPrivateKeyByHex(id.toHex()) : null;
|
||||||
return key ? (returnWrapKeys ? [key] : key.getNativeKeys()) : [null];
|
return key ? (returnWrapKeys ? [key] : key.getNativeKeys()) : [null];
|
||||||
}).flat().filter(v => v)
|
}).flat().filter(v => v)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
if (!result.length && Array.isNotEmpty(recipients)) {
|
if (!result.length && isNonEmptyArray(recipients)) {
|
||||||
result = recipients.map(sEmail => {
|
result = recipients.map(sEmail => {
|
||||||
const keys = sEmail ? this.findAllPrivateKeysByEmailNotNative(sEmail) : null;
|
const keys = sEmail ? this.findAllPrivateKeysByEmailNotNative(sEmail) : null;
|
||||||
return keys
|
return keys
|
||||||
|
|
@ -314,7 +314,7 @@ export const PgpUserStore = new class {
|
||||||
if (publicKeys && publicKeys.length) {
|
if (publicKeys && publicKeys.length) {
|
||||||
try {
|
try {
|
||||||
const result = message.verify(publicKeys),
|
const result = message.verify(publicKeys),
|
||||||
valid = (Array.isArray(result) ? result : []).find(item => item && item.valid && item.keyid);
|
valid = (isArray(result) ? result : []).find(item => item && item.valid && item.keyid);
|
||||||
|
|
||||||
if (valid && valid.keyid && valid.keyid && valid.keyid.toHex) {
|
if (valid && valid.keyid && valid.keyid && valid.keyid.toHex) {
|
||||||
fCallback(this.findPublicKeyByHex(valid.keyid.toHex()));
|
fCallback(this.findPublicKeyByHex(valid.keyid.toHex()));
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import {
|
||||||
|
|
||||||
import { ComposeType } from 'Common/EnumsUser';
|
import { ComposeType } from 'Common/EnumsUser';
|
||||||
|
|
||||||
import { pInt } from 'Common/Utils';
|
import { isNonEmptyArray, pInt } from 'Common/Utils';
|
||||||
import { delegateRunOnDestroy, computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
|
import { delegateRunOnDestroy, computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
|
||||||
|
|
||||||
import { Selector } from 'Common/Selector';
|
import { Selector } from 'Common/Selector';
|
||||||
|
|
@ -164,7 +164,7 @@ class ContactsPopupView extends AbstractViewPopup {
|
||||||
bccEmails = null;
|
bccEmails = null;
|
||||||
|
|
||||||
const aC = this.contactsCheckedOrSelected();
|
const aC = this.contactsCheckedOrSelected();
|
||||||
if (Array.isNotEmpty(aC)) {
|
if (isNonEmptyArray(aC)) {
|
||||||
aE = aC.map(oItem => {
|
aE = aC.map(oItem => {
|
||||||
if (oItem) {
|
if (oItem) {
|
||||||
const data = oItem.getNameAndEmailHelper(),
|
const data = oItem.getNameAndEmailHelper(),
|
||||||
|
|
@ -181,7 +181,7 @@ class ContactsPopupView extends AbstractViewPopup {
|
||||||
aE = aE.filter(value => !!value);
|
aE = aE.filter(value => !!value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isNotEmpty(aE)) {
|
if (isNonEmptyArray(aE)) {
|
||||||
this.bBackToCompose = false;
|
this.bBackToCompose = false;
|
||||||
|
|
||||||
hideScreenPopup(ContactsPopupView);
|
hideScreenPopup(ContactsPopupView);
|
||||||
|
|
@ -461,7 +461,7 @@ class ContactsPopupView extends AbstractViewPopup {
|
||||||
list = [];
|
list = [];
|
||||||
|
|
||||||
if (!iError && data && data.Result && data.Result.List) {
|
if (!iError && data && data.Result && data.Result.List) {
|
||||||
if (Array.isNotEmpty(data.Result.List)) {
|
if (isNonEmptyArray(data.Result.List)) {
|
||||||
data.Result.List.forEach(item => {
|
data.Result.List.forEach(item => {
|
||||||
item = ContactModel.reviveFromJson(item);
|
item = ContactModel.reviveFromJson(item);
|
||||||
item && list.push(item);
|
item && list.push(item);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import ko from 'ko';
|
||||||
|
|
||||||
import { Scope, Notification } from 'Common/Enums';
|
import { Scope, Notification } from 'Common/Enums';
|
||||||
import { getNotification, i18n } from 'Common/Translator';
|
import { getNotification, i18n } from 'Common/Translator';
|
||||||
|
import { isNonEmptyArray } from 'Common/Utils';
|
||||||
|
|
||||||
import Remote from 'Remote/Admin/Fetch';
|
import Remote from 'Remote/Admin/Fetch';
|
||||||
|
|
||||||
|
|
@ -75,7 +76,7 @@ class PluginPopupView extends AbstractViewPopup {
|
||||||
this.readme(oPlugin.Readme);
|
this.readme(oPlugin.Readme);
|
||||||
|
|
||||||
const config = oPlugin.Config;
|
const config = oPlugin.Config;
|
||||||
if (Array.isNotEmpty(config)) {
|
if (isNonEmptyArray(config)) {
|
||||||
this.configures(
|
this.configures(
|
||||||
config.map(item => ({
|
config.map(item => ({
|
||||||
'value': ko.observable(item[0]),
|
'value': ko.observable(item[0]),
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
|
|
||||||
import { doc, $htmlCL, leftPanelDisabled, keyScopeReal, moveAction, Settings } from 'Common/Globals';
|
import { doc, $htmlCL, leftPanelDisabled, keyScopeReal, moveAction, Settings } from 'Common/Globals';
|
||||||
|
|
||||||
import { inFocus } from 'Common/Utils';
|
import { isNonEmptyArray, inFocus } from 'Common/Utils';
|
||||||
import { mailToHelper, showMessageComposer } from 'Common/UtilsUser';
|
import { mailToHelper, showMessageComposer } from 'Common/UtilsUser';
|
||||||
|
|
||||||
import { SMAudio } from 'Common/Audio';
|
import { SMAudio } from 'Common/Audio';
|
||||||
|
|
@ -80,7 +80,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
this.allowMessageListActions = Settings.capa(Capa.MessageListActions);
|
this.allowMessageListActions = Settings.capa(Capa.MessageListActions);
|
||||||
|
|
||||||
const attachmentsActions = Settings.app('attachmentsActions');
|
const attachmentsActions = Settings.app('attachmentsActions');
|
||||||
this.attachmentsActions = ko.observableArray(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []);
|
this.attachmentsActions = ko.observableArray(isNonEmptyArray(attachmentsActions) ? attachmentsActions : []);
|
||||||
|
|
||||||
this.message = MessageUserStore.message;
|
this.message = MessageUserStore.message;
|
||||||
this.hasCheckedMessages = MessageUserStore.hasCheckedMessages;
|
this.hasCheckedMessages = MessageUserStore.hasCheckedMessages;
|
||||||
|
|
@ -177,7 +177,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
||||||
|
|
||||||
viewFromDkimStatusTitle:() => {
|
viewFromDkimStatusTitle:() => {
|
||||||
const status = this.viewFromDkimData();
|
const status = this.viewFromDkimData();
|
||||||
if (Array.isNotEmpty(status)) {
|
if (isNonEmptyArray(status)) {
|
||||||
if (status[0]) {
|
if (status[0]) {
|
||||||
return status[1] || 'DKIM: ' + status[0];
|
return status[1] || 'DKIM: ' + status[0];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
dev/prototype.js
vendored
1
dev/prototype.js
vendored
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
(doc=>{
|
(doc=>{
|
||||||
Array.isNotEmpty = array => Array.isArray(array) && array.length;
|
|
||||||
Array.prototype.unique = function() { return this.filter((v, i, a) => a.indexOf(v) === i); };
|
Array.prototype.unique = function() { return this.filter((v, i, a) => a.indexOf(v) === i); };
|
||||||
Array.prototype.validUnique = function(fn) {
|
Array.prototype.validUnique = function(fn) {
|
||||||
return this.filter((v, i, a) => (fn ? fn(v) : v) && a.indexOf(v) === i);
|
return this.filter((v, i, a) => (fn ? fn(v) : v) && a.indexOf(v) === i);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue