mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Underscore.js _.find() to native Array.find()
This commit is contained in:
parent
2404f6466d
commit
9c0072d626
19 changed files with 55 additions and 79 deletions
|
|
@ -552,9 +552,9 @@ class AppUser extends AbstractApp {
|
||||||
// aAcounts = AccountStore.accounts()
|
// aAcounts = AccountStore.accounts()
|
||||||
// ;
|
// ;
|
||||||
//
|
//
|
||||||
// _.each(oData.Result['Counts'], (oItem) => {
|
// oData.Result['Counts'].find(oItem => {
|
||||||
//
|
//
|
||||||
// var oAccount = _.find(aAcounts, (oAccount) => {
|
// var oAccount = aAcounts.find(oAccount => {
|
||||||
// return oAccount && oItem[0] === oAccount.email && sEmail !== oAccount.email;
|
// return oAccount && oItem[0] === oAccount.email && sEmail !== oAccount.email;
|
||||||
// });
|
// });
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import _ from '_';
|
|
||||||
import { MessageSetAction } from 'Common/Enums';
|
import { MessageSetAction } from 'Common/Enums';
|
||||||
import { trim, pInt, isArray } from 'Common/Utils';
|
import { trim, pInt, isArray } from 'Common/Utils';
|
||||||
|
|
||||||
|
|
@ -223,7 +222,7 @@ export function initMessageFlagsFromCache(message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < message.threads().length) {
|
if (0 < message.threads().length) {
|
||||||
const unseenSubUid = _.find(message.threads(), (sSubUid) => {
|
const unseenSubUid = message.threads().find(sSubUid => {
|
||||||
if (uid !== sSubUid) {
|
if (uid !== sSubUid) {
|
||||||
const subFlags = getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid);
|
const subFlags = getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid);
|
||||||
return subFlags && 0 < subFlags.length && !!subFlags[0];
|
return subFlags && 0 < subFlags.length && !!subFlags[0];
|
||||||
|
|
@ -231,7 +230,7 @@ export function initMessageFlagsFromCache(message) {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
const flaggedSubUid = _.find(message.threads(), (sSubUid) => {
|
const flaggedSubUid = message.threads().find(sSubUid => {
|
||||||
if (uid !== sSubUid) {
|
if (uid !== sSubUid) {
|
||||||
const subFlags = getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid);
|
const subFlags = getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid);
|
||||||
return subFlags && 0 < subFlags.length && !!subFlags[1];
|
return subFlags && 0 < subFlags.length && !!subFlags[1];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import _ from '_';
|
|
||||||
import $ from '$';
|
import $ from '$';
|
||||||
import key from 'key';
|
import key from 'key';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
@ -152,15 +151,7 @@ export const htmlEditorLangsMap = {
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
let bAllowPdfPreview = !bMobileDevice;
|
let bAllowPdfPreview = !bMobileDevice && undefined !== window.navigator.mimeTypes['application/pdf'];
|
||||||
|
|
||||||
if (bAllowPdfPreview && window.navigator && window.navigator.mimeTypes) {
|
|
||||||
bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, (type) => type && 'application/pdf' === type.type);
|
|
||||||
|
|
||||||
if (!bAllowPdfPreview) {
|
|
||||||
bAllowPdfPreview = 'undefined' !== typeof window.navigator.mimeTypes['application/pdf'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { bAllowPdfPreview };
|
export { bAllowPdfPreview };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ class Selector {
|
||||||
} else if (0 < aItems.length) {
|
} else if (0 < aItems.length) {
|
||||||
if (null !== isNextFocused) {
|
if (null !== isNextFocused) {
|
||||||
getNext = false;
|
getNext = false;
|
||||||
isNextFocused = _.find(aCache, (sUid) => {
|
isNextFocused = aCache.find(sUid => {
|
||||||
if (getNext && uids.includes(sUid)) {
|
if (getNext && uids.includes(sUid)) {
|
||||||
return sUid;
|
return sUid;
|
||||||
} else if (isNextFocused === sUid) {
|
} else if (isNextFocused === sUid) {
|
||||||
|
|
@ -190,7 +190,7 @@ class Selector {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isNextFocused) {
|
if (isNextFocused) {
|
||||||
temp = _.find(aItems, (oItem) => isNextFocused === this.getItemUid(oItem));
|
temp = aItems.find(oItem => isNextFocused === this.getItemUid(oItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1018,7 +1018,7 @@ export function selectElement(element) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const detectDropdownVisibility = _.debounce(() => {
|
export const detectDropdownVisibility = _.debounce(() => {
|
||||||
dropdownVisibility(!!_.find(GlobalsData.aBootstrapDropdowns, (item) => item.hasClass('open')));
|
dropdownVisibility(!!GlobalsData.aBootstrapDropdowns.find(item => item.hasClass('open')));
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ class FilterModel extends AbstractModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < this.conditions().length) {
|
if (0 < this.conditions().length) {
|
||||||
if (_.find(this.conditions(), (cond) => cond && !cond.verify())) {
|
if (this.conditions().find(cond => cond && !cond.verify())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import _ from '_';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { FolderType } from 'Common/Enums';
|
import { FolderType } from 'Common/Enums';
|
||||||
|
|
@ -64,9 +63,8 @@ class FolderModel extends AbstractModel {
|
||||||
|
|
||||||
this.hasSubScribedSubfolders = ko.computed(
|
this.hasSubScribedSubfolders = ko.computed(
|
||||||
() =>
|
() =>
|
||||||
!!_.find(
|
!!this.subFolders().find(
|
||||||
this.subFolders(),
|
oFolder => (oFolder.subScribed() || oFolder.hasSubScribedSubfolders()) && !oFolder.isSystemFolder()
|
||||||
(oFolder) => (oFolder.subScribed() || oFolder.hasSubScribedSubfolders()) && !oFolder.isSystemFolder()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -230,9 +228,8 @@ class FolderModel extends AbstractModel {
|
||||||
|
|
||||||
this.hasSubScribedUnreadMessagesSubfolders = ko.computed(
|
this.hasSubScribedUnreadMessagesSubfolders = ko.computed(
|
||||||
() =>
|
() =>
|
||||||
!!_.find(
|
!!this.subFolders().find(
|
||||||
this.subFolders(),
|
folder => folder.hasUnreadMessages() || folder.hasSubScribedUnreadMessagesSubfolders()
|
||||||
(folder) => folder.hasUnreadMessages() || folder.hasSubScribedUnreadMessagesSubfolders()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,7 @@ class MessageModel extends AbstractModel {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
hasVisibleAttachments() {
|
hasVisibleAttachments() {
|
||||||
return !!_.find(this.attachments(), (item) => !item.isLinked);
|
return !!this.attachments().find(item => !item.isLinked);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -506,7 +506,7 @@ class MessageModel extends AbstractModel {
|
||||||
|
|
||||||
if (isNonEmptyArray(attachments)) {
|
if (isNonEmptyArray(attachments)) {
|
||||||
cid = cid.replace(/^<+/, '').replace(/>+$/, '');
|
cid = cid.replace(/^<+/, '').replace(/>+$/, '');
|
||||||
result = _.find(attachments, (item) => cid === item.cidWithOutTags);
|
result = attachments.find(item => cid === item.cidWithOutTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result || null;
|
return result || null;
|
||||||
|
|
@ -521,7 +521,7 @@ class MessageModel extends AbstractModel {
|
||||||
const attachments = this.attachments();
|
const attachments = this.attachments();
|
||||||
|
|
||||||
if (isNonEmptyArray(attachments)) {
|
if (isNonEmptyArray(attachments)) {
|
||||||
result = _.find(attachments, (item) => contentLocation === item.contentLocation);
|
result = attachments.find(item => contentLocation === item.contentLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result || null;
|
return result || null;
|
||||||
|
|
|
||||||
|
|
@ -39,17 +39,15 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
viewModelPlace = null,
|
viewModelPlace = null,
|
||||||
viewModelDom = null;
|
viewModelDom = null;
|
||||||
|
|
||||||
RoutedSettingsViewModel = _.find(
|
RoutedSettingsViewModel = VIEW_MODELS.settings.find(
|
||||||
VIEW_MODELS.settings,
|
SettingsViewModel =>
|
||||||
(SettingsViewModel) =>
|
|
||||||
SettingsViewModel && SettingsViewModel.__rlSettingsData && subName === SettingsViewModel.__rlSettingsData.Route
|
SettingsViewModel && SettingsViewModel.__rlSettingsData && subName === SettingsViewModel.__rlSettingsData.Route
|
||||||
);
|
);
|
||||||
|
|
||||||
if (RoutedSettingsViewModel) {
|
if (RoutedSettingsViewModel) {
|
||||||
if (
|
if (
|
||||||
_.find(
|
VIEW_MODELS['settings-removed'].find(
|
||||||
VIEW_MODELS['settings-removed'],
|
DisabledSettingsViewModel =>
|
||||||
(DisabledSettingsViewModel) =>
|
|
||||||
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
@ -58,9 +56,8 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
RoutedSettingsViewModel &&
|
RoutedSettingsViewModel &&
|
||||||
_.find(
|
VIEW_MODELS['settings-disabled'].find(
|
||||||
VIEW_MODELS['settings-disabled'],
|
DisabledSettingsViewModel =>
|
||||||
(DisabledSettingsViewModel) =>
|
|
||||||
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
@ -155,18 +152,16 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
if (
|
if (
|
||||||
SettingsViewModel &&
|
SettingsViewModel &&
|
||||||
SettingsViewModel.__rlSettingsData &&
|
SettingsViewModel.__rlSettingsData &&
|
||||||
!_.find(
|
!VIEW_MODELS['settings-removed'].find(
|
||||||
VIEW_MODELS['settings-removed'],
|
RemoveSettingsViewModel => RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel
|
||||||
(RemoveSettingsViewModel) => RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
this.menu.push({
|
this.menu.push({
|
||||||
route: SettingsViewModel.__rlSettingsData.Route,
|
route: SettingsViewModel.__rlSettingsData.Route,
|
||||||
label: SettingsViewModel.__rlSettingsData.Label,
|
label: SettingsViewModel.__rlSettingsData.Label,
|
||||||
selected: ko.observable(false),
|
selected: ko.observable(false),
|
||||||
disabled: !!_.find(
|
disabled: !!VIEW_MODELS['settings-disabled'].find(
|
||||||
VIEW_MODELS['settings-disabled'],
|
DisabledSettingsViewModel => DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel
|
||||||
(DisabledSettingsViewModel) => DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel
|
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -176,9 +171,8 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
routes() {
|
routes() {
|
||||||
const DefaultViewModel = _.find(
|
const DefaultViewModel = VIEW_MODELS.settings.find(
|
||||||
VIEW_MODELS.settings,
|
SettingsViewModel =>
|
||||||
(SettingsViewModel) =>
|
|
||||||
SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault
|
SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData.IsDefault
|
||||||
),
|
),
|
||||||
defaultRoute =
|
defaultRoute =
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class GeneralUserSettings {
|
||||||
|
|
||||||
this.identityMain = ko.computed(() => {
|
this.identityMain = ko.computed(() => {
|
||||||
const list = this.identities();
|
const list = this.identities();
|
||||||
return isArray(list) ? _.find(list, (item) => item && '' === item.id()) : null;
|
return isArray(list) ? list.find(item => item && '' === item.id()) : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.identityMainDesc = ko.computed(() => {
|
this.identityMainDesc = ko.computed(() => {
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class OpenPgpUserSettings {
|
||||||
this.openPgpKeyForDeletion(null);
|
this.openPgpKeyForDeletion(null);
|
||||||
|
|
||||||
if (openPgpKeyToRemove && PgpStore.openpgpKeyring) {
|
if (openPgpKeyToRemove && PgpStore.openpgpKeyring) {
|
||||||
const findedItem = _.find(PgpStore.openpgpkeys(), (key) => openPgpKeyToRemove === key);
|
const findedItem = PgpStore.openpgpkeys().find(key => openPgpKeyToRemove === key);
|
||||||
if (findedItem) {
|
if (findedItem) {
|
||||||
PgpStore.openpgpkeys.remove(findedItem);
|
PgpStore.openpgpkeys.remove(findedItem);
|
||||||
delegateRunOnDestroy(findedItem);
|
delegateRunOnDestroy(findedItem);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
import _ from '_';
|
|
||||||
import { CookieDriver } from 'Common/ClientStorageDriver/Cookie';
|
import { CookieDriver } from 'Common/ClientStorageDriver/Cookie';
|
||||||
import { LocalStorageDriver } from 'Common/ClientStorageDriver/LocalStorage';
|
import { LocalStorageDriver } from 'Common/ClientStorageDriver/LocalStorage';
|
||||||
|
|
||||||
const SupportedStorageDriver = _.find(
|
const SupportedStorageDriver = [LocalStorageDriver, CookieDriver].find(
|
||||||
[LocalStorageDriver, CookieDriver],
|
StorageDriver => StorageDriver && StorageDriver.supported()
|
||||||
(StorageDriver) => StorageDriver && StorageDriver.supported()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const driver = SupportedStorageDriver ? new SupportedStorageDriver() : null;
|
const driver = SupportedStorageDriver ? new SupportedStorageDriver() : null;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class FolderUserStore {
|
||||||
);
|
);
|
||||||
|
|
||||||
this.foldersListWithSingleInboxRootFolder = ko.computed(
|
this.foldersListWithSingleInboxRootFolder = ko.computed(
|
||||||
() => !_.find(this.folderList(), (folder) => folder && !folder.isSystemFolder() && folder.visible())
|
() => !this.folderList().find(folder => folder && !folder.isSystemFolder() && folder.visible())
|
||||||
);
|
);
|
||||||
|
|
||||||
this.currentFolderFullNameRaw = ko.computed(() => (this.currentFolder() ? this.currentFolder().fullNameRaw : ''));
|
this.currentFolderFullNameRaw = ko.computed(() => (this.currentFolder() ? this.currentFolder().fullNameRaw : ''));
|
||||||
|
|
@ -193,7 +193,7 @@ class FolderUserStore {
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
_.find(timeouts, (aItem) => {
|
timeouts.find(aItem => {
|
||||||
const folder = getFolderFromCacheList(aItem[1]);
|
const folder = getFolderFromCacheList(aItem[1]);
|
||||||
if (folder) {
|
if (folder) {
|
||||||
folder.interval = utc;
|
folder.interval = utc;
|
||||||
|
|
|
||||||
|
|
@ -380,9 +380,9 @@ class MessageUserStore {
|
||||||
if (
|
if (
|
||||||
messageList &&
|
messageList &&
|
||||||
0 < messageList.length &&
|
0 < messageList.length &&
|
||||||
!!_.find(messageList, (item) => !!(item && item.deleted() && item.uid === this.messageListThreadUid()))
|
!!messageList.find(item => !!(item && item.deleted() && item.uid === this.messageListThreadUid()))
|
||||||
) {
|
) {
|
||||||
const message = _.find(messageList, (item) => item && !item.deleted());
|
const message = messageList.find(item => item && !item.deleted());
|
||||||
if (message && this.messageListThreadUid() !== pString(message.uid)) {
|
if (message && this.messageListThreadUid() !== pString(message.uid)) {
|
||||||
this.messageListThreadUid(pString(message.uid));
|
this.messageListThreadUid(pString(message.uid));
|
||||||
|
|
||||||
|
|
@ -633,9 +633,8 @@ class MessageUserStore {
|
||||||
this.selectorMessageFocused(null);
|
this.selectorMessageFocused(null);
|
||||||
}
|
}
|
||||||
} else if (!selectedMessage && message) {
|
} else if (!selectedMessage && message) {
|
||||||
selectedMessage = _.find(
|
selectedMessage = this.messageList().find(
|
||||||
this.messageList(),
|
subMessage =>
|
||||||
(subMessage) =>
|
|
||||||
subMessage &&
|
subMessage &&
|
||||||
subMessage.folderFullNameRaw === message.folderFullNameRaw &&
|
subMessage.folderFullNameRaw === message.folderFullNameRaw &&
|
||||||
subMessage.uid === message.uid
|
subMessage.uid === message.uid
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class PgpUserStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
findKeyByHex(keys, hash) {
|
findKeyByHex(keys, hash) {
|
||||||
return _.find(keys, (item) => hash && item && (hash === item.id || item.ids.includes(hash)));
|
return keys.find(item => hash && item && (hash === item.id || item.ids.includes(hash)));
|
||||||
}
|
}
|
||||||
|
|
||||||
findPublicKeyByHex(hash) {
|
findPublicKeyByHex(hash) {
|
||||||
|
|
@ -108,7 +108,7 @@ class PgpUserStore {
|
||||||
* @returns {?}
|
* @returns {?}
|
||||||
*/
|
*/
|
||||||
findPublicKeyByEmailNotNative(email) {
|
findPublicKeyByEmailNotNative(email) {
|
||||||
return _.find(this.openpgpkeysPublic(), (item) => item && item.emails.includes(email)) || null;
|
return this.openpgpkeysPublic().find(item => item && item.emails.includes(email)) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -116,7 +116,7 @@ class PgpUserStore {
|
||||||
* @returns {?}
|
* @returns {?}
|
||||||
*/
|
*/
|
||||||
findPrivateKeyByEmailNotNative(email) {
|
findPrivateKeyByEmailNotNative(email) {
|
||||||
return _.find(this.openpgpkeysPrivate(), (item) => item && item.emails.includes(email)) || null;
|
return this.openpgpkeysPrivate().find(item => item && item.emails.includes(email)) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -142,7 +142,7 @@ class PgpUserStore {
|
||||||
*/
|
*/
|
||||||
findPrivateKeyByEmail(email, password) {
|
findPrivateKeyByEmail(email, password) {
|
||||||
let privateKey = null;
|
let privateKey = null;
|
||||||
const key = _.find(this.openpgpkeysPrivate(), (item) => item && item.emails.includes(email));
|
const key = this.openpgpkeysPrivate().find(item => item && item.emails.includes(email));
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -217,7 +217,7 @@ class PgpUserStore {
|
||||||
if (publicKeys && 0 < publicKeys.length) {
|
if (publicKeys && 0 < publicKeys.length) {
|
||||||
try {
|
try {
|
||||||
const result = message.verify(publicKeys),
|
const result = message.verify(publicKeys),
|
||||||
valid = _.find(_.isArray(result) ? result : [], (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()));
|
||||||
|
|
|
||||||
|
|
@ -1263,12 +1263,12 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
* @returns {?Object}
|
* @returns {?Object}
|
||||||
*/
|
*/
|
||||||
getAttachmentById(id) {
|
getAttachmentById(id) {
|
||||||
return _.find(this.attachments(), (item) => item && id === item.id);
|
return this.attachments().find(item => item && id === item.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelAttachmentHelper(id, oJua) {
|
cancelAttachmentHelper(id, oJua) {
|
||||||
return () => {
|
return () => {
|
||||||
const attachment = _.find(this.attachments(), (item) => item && item.id === id);
|
const attachment = this.attachments().find(item => item && item.id === id);
|
||||||
if (attachment) {
|
if (attachment) {
|
||||||
this.attachments.remove(attachment);
|
this.attachments.remove(attachment);
|
||||||
delegateRunOnDestroy(attachment);
|
delegateRunOnDestroy(attachment);
|
||||||
|
|
@ -1516,7 +1516,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeLinkedAttachments() {
|
removeLinkedAttachments() {
|
||||||
const arrachment = _.find(this.attachments(), (item) => item && item.isLinked);
|
const arrachment = this.attachments().find(item => item && item.isLinked);
|
||||||
if (arrachment) {
|
if (arrachment) {
|
||||||
this.attachments.remove(arrachment);
|
this.attachments.remove(arrachment);
|
||||||
delegateRunOnDestroy(arrachment);
|
delegateRunOnDestroy(arrachment);
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
@command()
|
@command()
|
||||||
selectCommand() {
|
selectCommand() {
|
||||||
const keyId = this.selectedPrivateKey(),
|
const keyId = this.selectedPrivateKey(),
|
||||||
option = keyId ? _.find(this.privateKeysOptions(), (item) => item && keyId === item.id) : null;
|
option = keyId ? this.privateKeysOptions().find(item => item && keyId === item.id) : null;
|
||||||
|
|
||||||
if (option) {
|
if (option) {
|
||||||
this.signKey({
|
this.signKey({
|
||||||
|
|
@ -261,7 +261,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
addCommand() {
|
addCommand() {
|
||||||
const keyId = this.selectedPublicKey(),
|
const keyId = this.selectedPublicKey(),
|
||||||
keys = this.encryptKeys(),
|
keys = this.encryptKeys(),
|
||||||
option = keyId ? _.find(this.publicKeysOptions(), (item) => item && keyId === item.id) : null;
|
option = keyId ? this.publicKeysOptions().find(item => item && keyId === item.id) : null;
|
||||||
|
|
||||||
if (option) {
|
if (option) {
|
||||||
keys.push({
|
keys.push({
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
emails = this.viewPropertiesEmails(),
|
emails = this.viewPropertiesEmails(),
|
||||||
fFilter = (property) => '' !== trim(property.value());
|
fFilter = (property) => '' !== trim(property.value());
|
||||||
|
|
||||||
return !!(_.find(names, fFilter) || _.find(emails, fFilter));
|
return !!(names.find(fFilter) || emails.find(fFilter));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.viewPropertiesPhones = ko.computed(() =>
|
this.viewPropertiesPhones = ko.computed(() =>
|
||||||
|
|
@ -381,7 +381,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewOrFocusProperty(type, typeStr) {
|
addNewOrFocusProperty(type, typeStr) {
|
||||||
const item = _.find(this.viewProperties(), (prop) => type === prop.type());
|
const item = this.viewProperties().find(prop => type === prop.type());
|
||||||
if (item) {
|
if (item) {
|
||||||
item.focused(true);
|
item.focused(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -255,9 +255,8 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.sub('mailbox.message.show', (sFolder, sUid) => {
|
Events.sub('mailbox.message.show', (sFolder, sUid) => {
|
||||||
const message = _.find(
|
const message = this.messageList().find(
|
||||||
this.messageList(),
|
item => item && sFolder === item.folderFullNameRaw && sUid === item.uid
|
||||||
(item) => item && sFolder === item.folderFullNameRaw && sUid === item.uid
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if ('INBOX' === sFolder) {
|
if ('INBOX' === sFolder) {
|
||||||
|
|
@ -411,7 +410,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
temp = null,
|
temp = null,
|
||||||
current = null;
|
current = null;
|
||||||
|
|
||||||
_.find(this.messageListPagenator(), (item) => {
|
this.messageListPagenator().find(item => {
|
||||||
if (item) {
|
if (item) {
|
||||||
if (current) {
|
if (current) {
|
||||||
next = item;
|
next = item;
|
||||||
|
|
@ -942,9 +941,8 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
|
|
||||||
prefetchNextTick() {
|
prefetchNextTick() {
|
||||||
if (ifvisible && !this.bPrefetch && !ifvisible.now() && this.viewModelVisibility()) {
|
if (ifvisible && !this.bPrefetch && !ifvisible.now() && this.viewModelVisibility()) {
|
||||||
const message = _.find(
|
const message = this.messageList().find(
|
||||||
this.messageList(),
|
item => item && !hasRequestedMessage(item.folderFullNameRaw, item.uid)
|
||||||
(item) => item && !hasRequestedMessage(item.folderFullNameRaw, item.uid)
|
|
||||||
);
|
);
|
||||||
if (message) {
|
if (message) {
|
||||||
this.bPrefetch = true;
|
this.bPrefetch = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue