mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
JavaScript inArray()/indexOf() to .includes()
This commit is contained in:
parent
ec3fd5b7e4
commit
db2d95d684
20 changed files with 69 additions and 86 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue