diff --git a/dev/App/Admin.js b/dev/App/Admin.js index 16e52eee2..72de5500a 100644 --- a/dev/App/Admin.js +++ b/dev/App/Admin.js @@ -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); diff --git a/dev/App/User.js b/dev/App/User.js index fde5e903b..103a8fbde 100644 --- a/dev/App/User.js +++ b/dev/App/User.js @@ -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)); } } diff --git a/dev/Common/Selector.js b/dev/Common/Selector.js index fb26047b3..35f17f812 100644 --- a/dev/Common/Selector.js +++ b/dev/Common/Selector.js @@ -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; diff --git a/dev/Common/Translator.js b/dev/Common/Translator.js index a5cbd6378..8dfc67bd6 100644 --- a/dev/Common/Translator.js +++ b/dev/Common/Translator.js @@ -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') diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index f3d20d23e..c8a4eeec4 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -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) }); } diff --git a/dev/External/ko.js b/dev/External/ko.js index 8db564aee..8f365c7a8 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -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 { diff --git a/dev/Model/Attachment.js b/dev/Model/Attachment.js index 9555e7ddb..941b53a4a 100644 --- a/dev/Model/Attachment.js +++ b/dev/Model/Attachment.js @@ -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 diff --git a/dev/Model/Filter.js b/dev/Model/Filter.js index 9ad5a6757..bbec81a7c 100644 --- a/dev/Model/Filter.js +++ b/dev/Model/Filter.js @@ -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; diff --git a/dev/Model/Message.js b/dev/Model/Message.js index fb38149ed..e8bf9fa45 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -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; } diff --git a/dev/Promises/AbstractAjax.js b/dev/Promises/AbstractAjax.js index c659e17c6..ed92a6fbd 100644 --- a/dev/Promises/AbstractAjax.js +++ b/dev/Promises/AbstractAjax.js @@ -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; } diff --git a/dev/Remote/AbstractAjax.js b/dev/Remote/AbstractAjax.js index efc6cd880..f7316544d 100644 --- a/dev/Remote/AbstractAjax.js +++ b/dev/Remote/AbstractAjax.js @@ -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) { diff --git a/dev/Settings/Admin/Contacts.js b/dev/Settings/Admin/Contacts.js index d6bdcb385..15603645c 100644 --- a/dev/Settings/Admin/Contacts.js +++ b/dev/Settings/Admin/Contacts.js @@ -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(''); diff --git a/dev/Storage/Settings.js b/dev/Storage/Settings.js index e4ecbabea..5eeaef011 100644 --- a/dev/Storage/Settings.js +++ b/dev/Storage/Settings.js @@ -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); } diff --git a/dev/Stores/User/Message.js b/dev/Stores/User/Message.js index eed66f84a..7f274d9a3 100644 --- a/dev/Stores/User/Message.js +++ b/dev/Stores/User/Message.js @@ -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); diff --git a/dev/View/Popup/ComposeOpenPgp.js b/dev/View/Popup/ComposeOpenPgp.js index 85a7d3d9a..99cbe529a 100644 --- a/dev/View/Popup/ComposeOpenPgp.js +++ b/dev/View/Popup/ComposeOpenPgp.js @@ -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) => ({ diff --git a/dev/View/Popup/Contacts.js b/dev/View/Popup/Contacts.js index 986bcc37e..58f1a9534 100644 --- a/dev/View/Popup/Contacts.js +++ b/dev/View/Popup/Contacts.js @@ -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(() => diff --git a/dev/View/User/Login.js b/dev/View/User/Login.js index 87ccd2ef9..ed27d40ff 100644 --- a/dev/View/User/Login.js +++ b/dev/View/User/Login.js @@ -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; } diff --git a/dev/View/User/MailBox/FolderList.js b/dev/View/User/MailBox/FolderList.js index ed91c4ce3..bf491365d 100644 --- a/dev/View/User/MailBox/FolderList.js +++ b/dev/View/User/MailBox/FolderList.js @@ -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') ); } diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index 221924f25..cf0e3b3d3 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -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, diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index a983fa2b5..aa16970c6 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -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 );