mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-03-06 11:49:32 +08:00
JavaScript inArray()/indexOf() to .includes()
This commit is contained in:
parent
ec3fd5b7e4
commit
db2d95d684
20 changed files with 69 additions and 86 deletions
|
@ -6,7 +6,7 @@ import progressJs from 'progressJs';
|
|||
import { root } from 'Common/Links';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { pInt, isNormal, isArray, inArray, isUnd } from 'Common/Utils';
|
||||
import { pInt, isNormal, isArray, isUnd } from 'Common/Utils';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
|
@ -168,7 +168,7 @@ class AdminApp extends AbstractApp {
|
|||
if (
|
||||
data &&
|
||||
data.ErrorCode &&
|
||||
-1 < inArray(pInt(data.ErrorCode), [Notification.LicensingServerIsUnavailable, Notification.LicensingExpired])
|
||||
[Notification.LicensingServerIsUnavailable, Notification.LicensingExpired].includes(pInt(data.ErrorCode))
|
||||
) {
|
||||
LicenseStore.licenseError(getNotification(pInt(data.ErrorCode)));
|
||||
LicenseStore.licensing(true);
|
||||
|
|
|
@ -8,7 +8,6 @@ import {
|
|||
log,
|
||||
has,
|
||||
isArray,
|
||||
inArray,
|
||||
isUnd,
|
||||
isNormal,
|
||||
isPosNumeric,
|
||||
|
@ -342,7 +341,7 @@ class AppUser extends AbstractApp {
|
|||
} else {
|
||||
setFolderHash(FolderStore.currentFolderFullNameRaw(), '');
|
||||
|
||||
if (oData && -1 < inArray(oData.ErrorCode, [Notification.CantMoveMessage, Notification.CantCopyMessage])) {
|
||||
if (oData && [Notification.CantMoveMessage, Notification.CantCopyMessage].includes(oData.ErrorCode)) {
|
||||
window.alert(getNotification(oData.ErrorCode));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import _ from '_';
|
|||
import key from 'key';
|
||||
import ko from 'ko';
|
||||
import { EventKeyCode } from 'Common/Enums';
|
||||
import { isArray, inArray, noop, noopTrue } from 'Common/Utils';
|
||||
import { isArray, noop, noopTrue } from 'Common/Utils';
|
||||
|
||||
class Selector {
|
||||
list;
|
||||
|
@ -159,7 +159,7 @@ class Selector {
|
|||
mFocused = null;
|
||||
}
|
||||
|
||||
if (0 < len && -1 < inArray(uid, aCheckedCache)) {
|
||||
if (0 < len && aCheckedCache.includes(uid)) {
|
||||
isChecked = true;
|
||||
item.checked(true);
|
||||
len -= 1;
|
||||
|
@ -181,7 +181,7 @@ class Selector {
|
|||
if (null !== isNextFocused) {
|
||||
getNext = false;
|
||||
isNextFocused = _.find(aCache, (sUid) => {
|
||||
if (getNext && -1 < inArray(sUid, uids)) {
|
||||
if (getNext && uids.includes(sUid)) {
|
||||
return sUid;
|
||||
} else if (isNextFocused === sUid) {
|
||||
getNext = true;
|
||||
|
|
|
@ -3,7 +3,7 @@ import _ from '_';
|
|||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import { Notification, UploadErrorCode } from 'Common/Enums';
|
||||
import { pInt, isUnd, isNull, has, microtime, inArray } from 'Common/Utils';
|
||||
import { pInt, isUnd, isNull, has, microtime } from 'Common/Utils';
|
||||
import { $html, $htmlCL } from 'Common/Globals';
|
||||
import { reload as momentorReload } from 'Common/Momentor';
|
||||
import { langLink } from 'Common/Links';
|
||||
|
@ -274,7 +274,7 @@ export function reload(admin, language) {
|
|||
() => {
|
||||
reloadData();
|
||||
|
||||
const isRtl = -1 < inArray((language || '').toLowerCase(), ['ar', 'ar_sa', 'he', 'he_he', 'ur', 'ur_ir']);
|
||||
const isRtl = ['ar', 'ar_sa', 'he', 'he_he', 'ur', 'ur_ir'].includes((language || '').toLowerCase());
|
||||
|
||||
$htmlCL.remove('rl-changing-language', 'rl-rtl', 'rl-ltr');
|
||||
// $html.attr('dir', isRtl ? 'rtl' : 'ltr')
|
||||
|
|
|
@ -10,8 +10,7 @@ import { Mime } from 'Common/Mime';
|
|||
import { jassl } from 'Common/Jassl';
|
||||
|
||||
const trim = $.trim;
|
||||
const inArray = $.inArray;
|
||||
const isArray = _.isArray;
|
||||
const isArray = Array.isArray;
|
||||
const isObject = _.isObject;
|
||||
const isFunc = _.isFunction;
|
||||
const isUnd = _.isUndefined;
|
||||
|
@ -22,7 +21,7 @@ const noop = () => {}; // eslint-disable-line no-empty-function
|
|||
const noopTrue = () => true;
|
||||
const noopFalse = () => false;
|
||||
|
||||
export { trim, inArray, isArray, isObject, isFunc, isUnd, isNull, has, bind, noop, noopTrue, noopFalse, jassl };
|
||||
export { trim, isArray, isObject, isFunc, isUnd, isNull, has, bind, noop, noopTrue, noopFalse, jassl };
|
||||
|
||||
/**
|
||||
* @param {Function} func
|
||||
|
@ -935,7 +934,7 @@ export function folderListOptionsBuilder(
|
|||
seporator: false,
|
||||
disabled:
|
||||
!oItem.selectable ||
|
||||
-1 < inArray(oItem.fullNameRaw, aDisabled) ||
|
||||
aDisabled.includes(oItem.fullNameRaw) ||
|
||||
(fDisableCallback ? fDisableCallback(oItem) : false)
|
||||
});
|
||||
}
|
||||
|
@ -971,7 +970,7 @@ export function folderListOptionsBuilder(
|
|||
seporator: false,
|
||||
disabled:
|
||||
!oItem.selectable ||
|
||||
-1 < inArray(oItem.fullNameRaw, aDisabled) ||
|
||||
aDisabled.includes(oItem.fullNameRaw) ||
|
||||
(fDisableCallback ? fDisableCallback(oItem) : false)
|
||||
});
|
||||
}
|
||||
|
|
9
dev/External/ko.js
vendored
9
dev/External/ko.js
vendored
|
@ -948,18 +948,17 @@ ko.extenders.posInterer = (target, defaultVal) => {
|
|||
};
|
||||
|
||||
ko.extenders.limitedList = (target, limitedList) => {
|
||||
const Utils = require('Common/Utils'),
|
||||
result = ko
|
||||
const result = ko
|
||||
.computed({
|
||||
read: target,
|
||||
write: (newValue) => {
|
||||
const currentValue = ko.unwrap(target),
|
||||
list = ko.unwrap(limitedList);
|
||||
|
||||
if (Utils.isNonEmptyArray(list)) {
|
||||
if (-1 < Utils.inArray(newValue, list)) {
|
||||
if (Array.isArray(list) && 0 < list.length) {
|
||||
if (list.includes(newValue)) {
|
||||
target(newValue);
|
||||
} else if (-1 < Utils.inArray(currentValue, list)) {
|
||||
} else if (list.includes(currentValue, list)) {
|
||||
target(currentValue + ' ');
|
||||
target(currentValue);
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@ import ko from 'ko';
|
|||
|
||||
import { FileType } from 'Common/Enums';
|
||||
import { bAllowPdfPreview } from 'Common/Globals';
|
||||
import { trim, pInt, inArray, isNonEmptyArray, getFileExtension, friendlySize } from 'Common/Utils';
|
||||
import { trim, pInt, isNonEmptyArray, getFileExtension, friendlySize } from 'Common/Utils';
|
||||
import {
|
||||
attachmentDownload,
|
||||
attachmentPreview,
|
||||
|
@ -30,29 +30,28 @@ export const staticFileType = _.memoize((ext, mimeType) => {
|
|||
const mimeTypeParts = mimeType.split('/');
|
||||
|
||||
switch (true) {
|
||||
case 'image' === mimeTypeParts[0] || -1 < inArray(ext, ['png', 'jpg', 'jpeg', 'gif', 'bmp']):
|
||||
case 'image' === mimeTypeParts[0] || ['png', 'jpg', 'jpeg', 'gif', 'bmp'].includes(ext):
|
||||
result = FileType.Image;
|
||||
break;
|
||||
case 'audio' === mimeTypeParts[0] || -1 < inArray(ext, ['mp3', 'ogg', 'oga', 'wav']):
|
||||
case 'audio' === mimeTypeParts[0] || ['mp3', 'ogg', 'oga', 'wav'].includes(ext):
|
||||
result = FileType.Audio;
|
||||
break;
|
||||
case 'video' === mimeTypeParts[0] || -1 < inArray(ext, ['mkv', 'avi']):
|
||||
case 'video' === mimeTypeParts[0] || ['mkv', 'avi'].includes(ext):
|
||||
result = FileType.Video;
|
||||
break;
|
||||
case -1 < inArray(ext, ['php', 'js', 'css']):
|
||||
case ['php', 'js', 'css'].includes(ext):
|
||||
result = FileType.Code;
|
||||
break;
|
||||
case 'eml' === ext || -1 < inArray(mimeType, ['message/delivery-status', 'message/rfc822']):
|
||||
case 'eml' === ext || ['message/delivery-status', 'message/rfc822'].includes(mimeType):
|
||||
result = FileType.Eml;
|
||||
break;
|
||||
case ('text' === mimeTypeParts[0] && 'html' !== mimeTypeParts[1]) || -1 < inArray(ext, ['txt', 'log']):
|
||||
case ('text' === mimeTypeParts[0] && 'html' !== mimeTypeParts[1]) || ['txt', 'log'].includes(ext):
|
||||
result = FileType.Text;
|
||||
break;
|
||||
case 'text/html' === mimeType || -1 < inArray(ext, ['html']):
|
||||
case 'text/html' === mimeType || ['html'].includes(ext):
|
||||
result = FileType.Html;
|
||||
break;
|
||||
case -1 <
|
||||
inArray(mimeTypeParts[1], [
|
||||
case [
|
||||
'zip',
|
||||
'7z',
|
||||
'tar',
|
||||
|
@ -70,21 +69,20 @@ export const staticFileType = _.memoize((ext, mimeType) => {
|
|||
'x-zip-compressed',
|
||||
'x-7z-compressed',
|
||||
'x-rar-compressed'
|
||||
]) || -1 < inArray(ext, ['zip', '7z', 'tar', 'rar', 'gzip', 'bzip', 'bzip2']):
|
||||
].includes(mimeTypeParts[1]) || ['zip', '7z', 'tar', 'rar', 'gzip', 'bzip', 'bzip2'].includes(ext):
|
||||
result = FileType.Archive;
|
||||
break;
|
||||
case -1 < inArray(mimeTypeParts[1], ['pdf', 'x-pdf']) || -1 < inArray(ext, ['pdf']):
|
||||
case ['pdf', 'x-pdf'].includes(mimeTypeParts[1]) || ['pdf'].includes(ext):
|
||||
result = FileType.Pdf;
|
||||
break;
|
||||
case -1 < inArray(mimeType, ['application/pgp-signature', 'application/pgp-keys']) ||
|
||||
-1 < inArray(ext, ['asc', 'pem', 'ppk']):
|
||||
case ['application/pgp-signature', 'application/pgp-keys'].includes(mimeType) ||
|
||||
['asc', 'pem', 'ppk'].includes(ext):
|
||||
result = FileType.Certificate;
|
||||
break;
|
||||
case -1 < inArray(mimeType, ['application/pkcs7-signature']) || -1 < inArray(ext, ['p7s']):
|
||||
case ['application/pkcs7-signature'].includes(mimeType) || ['p7s'].includes(ext):
|
||||
result = FileType.CertificateBin;
|
||||
break;
|
||||
case -1 <
|
||||
inArray(mimeTypeParts[1], [
|
||||
case [
|
||||
'rtf',
|
||||
'msword',
|
||||
'vnd.msword',
|
||||
|
@ -92,11 +90,10 @@ export const staticFileType = _.memoize((ext, mimeType) => {
|
|||
'vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||
'vnd.ms-word.document.macroEnabled.12',
|
||||
'vnd.ms-word.template.macroEnabled.12'
|
||||
]):
|
||||
].includes(mimeTypeParts[1]):
|
||||
result = FileType.WordText;
|
||||
break;
|
||||
case -1 <
|
||||
inArray(mimeTypeParts[1], [
|
||||
case [
|
||||
'excel',
|
||||
'ms-excel',
|
||||
'vnd.ms-excel',
|
||||
|
@ -106,11 +103,10 @@ export const staticFileType = _.memoize((ext, mimeType) => {
|
|||
'vnd.ms-excel.template.macroEnabled.12',
|
||||
'vnd.ms-excel.addin.macroEnabled.12',
|
||||
'vnd.ms-excel.sheet.binary.macroEnabled.12'
|
||||
]):
|
||||
].includes(mimeTypeParts[1]):
|
||||
result = FileType.Sheet;
|
||||
break;
|
||||
case -1 <
|
||||
inArray(mimeTypeParts[1], [
|
||||
case [
|
||||
'powerpoint',
|
||||
'ms-powerpoint',
|
||||
'vnd.ms-powerpoint',
|
||||
|
@ -121,7 +117,7 @@ export const staticFileType = _.memoize((ext, mimeType) => {
|
|||
'vnd.ms-powerpoint.presentation.macroEnabled.12',
|
||||
'vnd.ms-powerpoint.template.macroEnabled.12',
|
||||
'vnd.ms-powerpoint.slideshow.macroEnabled.12'
|
||||
]):
|
||||
].includes(mimeTypeParts[1]):
|
||||
result = FileType.Presentation;
|
||||
break;
|
||||
// no default
|
||||
|
|
|
@ -2,7 +2,7 @@ import _ from '_';
|
|||
import ko from 'ko';
|
||||
|
||||
import { FilterRulesType, FiltersAction } from 'Common/Enums';
|
||||
import { pString, inArray, isNonEmptyArray, fakeMd5, delegateRunOnDestroy, windowResizeCallback } from 'Common/Utils';
|
||||
import { pString, isNonEmptyArray, fakeMd5, delegateRunOnDestroy, windowResizeCallback } from 'Common/Utils';
|
||||
import { i18n } from 'Common/Translator';
|
||||
import { getFolderFromCacheList } from 'Common/Cache';
|
||||
|
||||
|
@ -152,21 +152,19 @@ class FilterModel extends AbstractModel {
|
|||
}
|
||||
|
||||
if ('' === this.actionValue()) {
|
||||
if (
|
||||
-1 <
|
||||
inArray(this.actionType(), [
|
||||
if ([
|
||||
FiltersAction.MoveTo,
|
||||
FiltersAction.Forward,
|
||||
FiltersAction.Reject,
|
||||
FiltersAction.Vacation
|
||||
])
|
||||
].includes(this.actionType())
|
||||
) {
|
||||
this.actionValue.error(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (FiltersAction.Forward === this.actionType() && -1 === this.actionValue().indexOf('@')) {
|
||||
if (FiltersAction.Forward === this.actionType() && !this.actionValue().includes('@')) {
|
||||
this.actionValue.error(true);
|
||||
return false;
|
||||
}
|
||||
|
@ -174,7 +172,7 @@ class FilterModel extends AbstractModel {
|
|||
if (
|
||||
FiltersAction.Vacation === this.actionType() &&
|
||||
'' !== this.actionValueFourth() &&
|
||||
-1 === this.actionValueFourth().indexOf('@')
|
||||
!this.actionValueFourth().includes('@')
|
||||
) {
|
||||
this.actionValueFourth.error(true);
|
||||
return false;
|
||||
|
|
|
@ -11,7 +11,6 @@ import { DATA_IMAGE_LAZY_PLACEHOLDER_PIC } from 'Common/Consts';
|
|||
|
||||
import {
|
||||
pInt,
|
||||
inArray,
|
||||
isArray,
|
||||
isUnd,
|
||||
trim,
|
||||
|
@ -253,7 +252,7 @@ class MessageModel extends AbstractModel {
|
|||
if (json && 'Object/Message' === json['@Object']) {
|
||||
priority = pInt(json.Priority);
|
||||
this.priority(
|
||||
-1 < inArray(priority, [MessagePriority.High, MessagePriority.Low]) ? priority : MessagePriority.Normal
|
||||
[MessagePriority.High, MessagePriority.Low].includes(priority) ? priority : MessagePriority.Normal
|
||||
);
|
||||
|
||||
this.folderFullNameRaw = json.Folder;
|
||||
|
@ -313,7 +312,7 @@ class MessageModel extends AbstractModel {
|
|||
if (json && 'Object/Message' === json['@Object']) {
|
||||
priority = pInt(json.Priority);
|
||||
this.priority(
|
||||
-1 < inArray(priority, [MessagePriority.High, MessagePriority.Low]) ? priority : MessagePriority.Normal
|
||||
[MessagePriority.High, MessagePriority.Low].includes(priority) ? priority : MessagePriority.Normal
|
||||
);
|
||||
|
||||
this.aDraftInfo = json.DraftInfo;
|
||||
|
@ -362,7 +361,7 @@ class MessageModel extends AbstractModel {
|
|||
if (
|
||||
'' !== attachment.cidWithOutTags &&
|
||||
0 < this.foundedCIDs.length &&
|
||||
0 <= inArray(attachment.cidWithOutTags, this.foundedCIDs)
|
||||
this.foundedCIDs.includes(attachment.cidWithOutTags)
|
||||
) {
|
||||
attachment.isLinked = true;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import window from 'window';
|
|||
import $ from '$';
|
||||
|
||||
import { ajax } from 'Common/Links';
|
||||
import { microtime, isUnd, isNormal, pString, pInt, inArray } from 'Common/Utils';
|
||||
import { microtime, isUnd, isNormal, pString, pInt } from 'Common/Utils';
|
||||
import { DEFAULT_AJAX_TIMEOUT, TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT } from 'Common/Consts';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { data as GlobalsData } from 'Common/Globals';
|
||||
|
@ -128,9 +128,7 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
this.setTrigger(fTrigger, false);
|
||||
|
||||
if (errorData) {
|
||||
if (
|
||||
-1 <
|
||||
inArray(errorData.ErrorCode, [
|
||||
if ([
|
||||
Notification.AuthError,
|
||||
Notification.AccessError,
|
||||
Notification.ConnectionError,
|
||||
|
@ -139,7 +137,7 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
Notification.MailServerError,
|
||||
Notification.UnknownNotification,
|
||||
Notification.UnknownError
|
||||
])
|
||||
].includes(errorData.ErrorCode)
|
||||
) {
|
||||
GlobalsData.iAjaxErrorCount += 1;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import $ from '$';
|
|||
|
||||
import { TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT, DEFAULT_AJAX_TIMEOUT } from 'Common/Consts';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { inArray, pInt, pString, isUnd } from 'Common/Utils';
|
||||
import { pInt, pString, isUnd } from 'Common/Utils';
|
||||
import { data as GlobalsData } from 'Common/Globals';
|
||||
import { ajax } from 'Common/Links';
|
||||
import { runHook } from 'Common/Plugins';
|
||||
|
@ -32,9 +32,7 @@ class AbstractAjaxRemote {
|
|||
|
||||
if (StorageResultType.Success === sType && oData && !oData.Result) {
|
||||
if (
|
||||
oData &&
|
||||
-1 <
|
||||
inArray(oData.ErrorCode, [
|
||||
oData && [
|
||||
Notification.AuthError,
|
||||
Notification.AccessError,
|
||||
Notification.ConnectionError,
|
||||
|
@ -43,7 +41,7 @@ class AbstractAjaxRemote {
|
|||
Notification.MailServerError,
|
||||
Notification.UnknownNotification,
|
||||
Notification.UnknownError
|
||||
])
|
||||
].includes(oData.ErrorCode)
|
||||
) {
|
||||
GlobalsData.iAjaxErrorCount += 1;
|
||||
}
|
||||
|
@ -178,7 +176,7 @@ class AbstractAjaxRemote {
|
|||
this.defaultResponse(fResultCallback, action, sType, oData, cached, params);
|
||||
});
|
||||
|
||||
if (action && 0 < abortActions.length && -1 < inArray(action, abortActions)) {
|
||||
if (action && 0 < abortActions.length && abortActions.includes(action)) {
|
||||
if (this.oRequests[action]) {
|
||||
this.oRequests[action].__aborted = true;
|
||||
if (this.oRequests[action].abort) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender, inArray, trim, boolToAjax } from 'Common/Utils';
|
||||
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender, trim, boolToAjax } from 'Common/Utils';
|
||||
|
||||
import { SaveSettingsStep, StorageResultType, Magics } from 'Common/Enums';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
@ -49,7 +49,7 @@ class ContactsAdminSettings {
|
|||
this.contactsTypes = ko.observableArray([]);
|
||||
this.contactsTypesOptions = ko.computed(() =>
|
||||
_.map(this.contactsTypes(), (value) => {
|
||||
const disabled = -1 === inArray(value, supportedTypes);
|
||||
const disabled = supportedTypes.includes(value);
|
||||
return {
|
||||
'id': value,
|
||||
'name': getTypeName(value) + (disabled ? ' (' + i18n('HINTS/NOT_SUPPORTED') + ')' : ''),
|
||||
|
@ -66,7 +66,7 @@ class ContactsAdminSettings {
|
|||
read: this.contactsType,
|
||||
write: (value) => {
|
||||
if (value !== this.contactsType()) {
|
||||
if (-1 < inArray(value, supportedTypes)) {
|
||||
if (supportedTypes.includes(value)) {
|
||||
this.contactsType(value);
|
||||
} else if (0 < supportedTypes.length) {
|
||||
this.contactsType('');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import window from 'window';
|
||||
import { isUnd, isNormal, isArray, inArray } from 'Common/Utils';
|
||||
import { isUnd, isNormal, isArray } from 'Common/Utils';
|
||||
|
||||
let SETTINGS = window.__rlah_data() || null;
|
||||
SETTINGS = isNormal(SETTINGS) ? SETTINGS : {};
|
||||
|
@ -37,5 +37,5 @@ export function appSettingsGet(name) {
|
|||
*/
|
||||
export function capa(name) {
|
||||
const values = settingsGet('Capa');
|
||||
return isArray(values) && isNormal(name) && -1 < inArray(name, values);
|
||||
return isArray(values) && isNormal(name) && values.includes(name);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import {
|
|||
trim,
|
||||
isNormal,
|
||||
isArray,
|
||||
inArray,
|
||||
pInt,
|
||||
pString,
|
||||
plainToHtml,
|
||||
|
@ -308,7 +307,7 @@ class MessageUserStore {
|
|||
currentFolderFullNameRaw = FolderStore.currentFolderFullNameRaw(),
|
||||
messages =
|
||||
currentFolderFullNameRaw === fromFolderFullNameRaw
|
||||
? _.filter(messageList, (item) => item && -1 < inArray(pInt(item.uid), uidForRemove))
|
||||
? _.filter(messageList, (item) => item && uidForRemove.includes(pInt(item.uid)))
|
||||
: [];
|
||||
|
||||
_.each(messages, (item) => {
|
||||
|
@ -499,7 +498,7 @@ class MessageUserStore {
|
|||
message.folderFullNameRaw === data.Result.Folder
|
||||
) {
|
||||
const threads = message.threads();
|
||||
if (message.uid !== data.Result.Uid && 1 < threads.length && -1 < inArray(data.Result.Uid, threads)) {
|
||||
if (message.uid !== data.Result.Uid && 1 < threads.length && threads.includes(data.Result.Uid)) {
|
||||
message = MessageModel.newInstanceFromJson(data.Result);
|
||||
if (message) {
|
||||
message.threads(threads);
|
||||
|
|
|
@ -3,7 +3,7 @@ import $ from '$';
|
|||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import { inArray, pString, log, isUnd, trim, defautOptionsAfterRender } from 'Common/Utils';
|
||||
import { pString, log, isUnd, trim, defautOptionsAfterRender } from 'Common/Utils';
|
||||
|
||||
import { Magics, KeyState } from 'Common/Enums';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
@ -64,7 +64,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
|||
|
||||
this.publicKeysOptions = ko.computed(() => {
|
||||
const opts = _.map(PgpStore.openpgpkeysPublic(), (oKey, index) => {
|
||||
if (-1 < inArray(oKey, this.encryptKeysView())) {
|
||||
if (this.encryptKeysView().includes(oKey)) {
|
||||
return null;
|
||||
}
|
||||
return _.map(oKey.users, (user) => ({
|
||||
|
|
|
@ -19,7 +19,6 @@ import {
|
|||
import {
|
||||
delegateRunOnDestroy,
|
||||
computedPagenatorHelper,
|
||||
inArray,
|
||||
trim,
|
||||
windowResizeCallback,
|
||||
isNonEmptyArray,
|
||||
|
@ -101,11 +100,11 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
this.viewPropertiesNames = ko.computed(() =>
|
||||
_.filter(
|
||||
this.viewProperties(),
|
||||
(property) => -1 < inArray(property.type(), [ContactPropertyType.FirstName, ContactPropertyType.LastName])
|
||||
(property) => [ContactPropertyType.FirstName, ContactPropertyType.LastName].includes(property.type())
|
||||
)
|
||||
);
|
||||
this.viewPropertiesOther = ko.computed(() =>
|
||||
_.filter(this.viewProperties(), (property) => -1 < inArray(property.type(), [ContactPropertyType.Nick]))
|
||||
_.filter(this.viewProperties(), (property) => [ContactPropertyType.Nick].includes(property.type()))
|
||||
);
|
||||
|
||||
this.viewPropertiesEmails = ko.computed(() =>
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
Notification
|
||||
} from 'Common/Enums';
|
||||
|
||||
import { trim, inArray, convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
|
||||
import { trim, convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
|
||||
|
||||
import { $win } from 'Common/Globals';
|
||||
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
|
||||
|
@ -225,7 +225,7 @@ class LoginUserView extends AbstractViewNext {
|
|||
}
|
||||
} else if (oData.ErrorCode) {
|
||||
this.submitRequest(false);
|
||||
if (-1 < inArray(oData.ErrorCode, [Notification.InvalidInputArgument])) {
|
||||
if ([Notification.InvalidInputArgument].includes(oData.ErrorCode)) {
|
||||
oData.ErrorCode = Notification.AuthError;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
|||
() =>
|
||||
FolderStore.currentFolder() &&
|
||||
FolderStore.currentFolder().isInbox() &&
|
||||
-1 < trim(MessageStore.messageListSearch()).indexOf('is:flagged')
|
||||
trim(MessageStore.messageListSearch()).includes('is:flagged')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
|||
|
||||
import { bMobileDevice, popupVisibility, leftPanelDisabled, moveAction } from 'Common/Globals';
|
||||
|
||||
import { noop, noopFalse, computedPagenatorHelper, draggablePlace, friendlySize, inArray, isUnd } from 'Common/Utils';
|
||||
import { noop, noopFalse, computedPagenatorHelper, draggablePlace, friendlySize, isUnd } from 'Common/Utils';
|
||||
|
||||
import { mailBox, append } from 'Common/Links';
|
||||
import { Selector } from 'Common/Selector';
|
||||
|
@ -653,7 +653,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
const checked = this.messageListCheckedOrSelected();
|
||||
if (currentMessage) {
|
||||
const checkedUids = _.map(checked, (message) => message.uid);
|
||||
if (0 < checkedUids.length && -1 < inArray(currentMessage.uid, checkedUids)) {
|
||||
if (0 < checkedUids.length && checkedUids.includes(currentMessage.uid)) {
|
||||
this.setAction(
|
||||
currentMessage.folderFullNameRaw,
|
||||
currentMessage.flagged() ? MessageSetAction.UnsetFlag : MessageSetAction.SetFlag,
|
||||
|
|
|
@ -20,7 +20,6 @@ import {
|
|||
import { $htmlCL, leftPanelDisabled, keyScopeReal, useKeyboardShortcuts, moveAction } from 'Common/Globals';
|
||||
|
||||
import {
|
||||
inArray,
|
||||
isNonEmptyArray,
|
||||
trim,
|
||||
noop,
|
||||
|
@ -135,7 +134,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
);
|
||||
|
||||
this.downloadAsZipAllowed = ko.computed(
|
||||
() => -1 < inArray('zip', this.attachmentsActions()) && this.allowAttachmnetControls()
|
||||
() => this.attachmentsActions().includes('zip') && this.allowAttachmnetControls()
|
||||
);
|
||||
|
||||
this.downloadAsZipLoading = ko.observable(false);
|
||||
|
@ -156,7 +155,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
read: this.lastReplyAction_,
|
||||
write: (value) => {
|
||||
this.lastReplyAction_(
|
||||
-1 === inArray(value, [ComposeType.Reply, ComposeType.ReplyAll, ComposeType.Forward])
|
||||
[ComposeType.Reply, ComposeType.ReplyAll, ComposeType.Forward].includes(value)
|
||||
? ComposeType.Reply
|
||||
: value
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue