mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-01 04:22:15 +08:00
Underscore.js _.each() to native Array.forEach() (optional with Object.entries/values)
This commit is contained in:
parent
178e5f6ef7
commit
a5d41edb24
25 changed files with 72 additions and 79 deletions
|
@ -79,7 +79,7 @@ class AdminApp extends AbstractApp {
|
|||
let list = [];
|
||||
const loading = {};
|
||||
|
||||
_.each(PackageStore.packages(), (item) => {
|
||||
PackageStore.packages().forEach(item => {
|
||||
if (item && item.loading()) {
|
||||
loading[item.file] = item;
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ class AppUser extends AbstractApp {
|
|||
}
|
||||
|
||||
reloadFlagsCurrentMessageListAndMessageFromCache() {
|
||||
_.each(MessageStore.messageList(), (message) => {
|
||||
MessageStore.messageList().forEach(message => {
|
||||
initMessageFlagsFromCache(message);
|
||||
});
|
||||
initMessageFlagsFromCache(MessageStore.message());
|
||||
|
@ -293,7 +293,7 @@ class AppUser extends AbstractApp {
|
|||
const sTrashFolder = FolderStore.trashFolder(),
|
||||
sSpamFolder = FolderStore.spamFolder();
|
||||
|
||||
_.each(this.moveCache, (item) => {
|
||||
this.moveCache.forEach(item => {
|
||||
const isSpam = sSpamFolder === item.To,
|
||||
isTrash = sTrashFolder === item.To,
|
||||
isHam = !isSpam && sSpamFolder === item.From && getFolderInboxName() === item.To;
|
||||
|
@ -486,7 +486,7 @@ class AppUser extends AbstractApp {
|
|||
openpgpKeyring = PgpStore.openpgpKeyring,
|
||||
openpgpKeys = openpgpKeyring ? openpgpKeyring.getAllKeys() : [];
|
||||
|
||||
_.each(openpgpKeys, (oItem, iIndex) => {
|
||||
openpgpKeys.forEach((oItem, iIndex) => {
|
||||
if (oItem && oItem.primaryKey) {
|
||||
const aEmails = [],
|
||||
aUsers = [],
|
||||
|
@ -499,7 +499,7 @@ class AppUser extends AbstractApp {
|
|||
: '';
|
||||
|
||||
if (oItem.users) {
|
||||
_.each(oItem.users, (item) => {
|
||||
oItem.users.forEach(item => {
|
||||
if (item.userId) {
|
||||
email.clear();
|
||||
email.parse(item.userId.userid);
|
||||
|
@ -583,7 +583,7 @@ class AppUser extends AbstractApp {
|
|||
parentEmail = '' === parentEmail ? sAccountEmail : parentEmail;
|
||||
|
||||
if (isArray(oData.Result.Accounts)) {
|
||||
_.each(AccountStore.accounts(), (oAccount) => {
|
||||
AccountStore.accounts().forEach(oAccount => {
|
||||
counts[oAccount.email] = oAccount.count();
|
||||
});
|
||||
|
||||
|
@ -754,7 +754,7 @@ class AppUser extends AbstractApp {
|
|||
if (StorageResultType.Success === sResult) {
|
||||
if (oData && oData.Result && oData.Result.List && isNonEmptyArray(oData.Result.List)) {
|
||||
const utc = momentNowUnix();
|
||||
_.each(oData.Result.List, (item) => {
|
||||
oData.Result.List.forEach(item => {
|
||||
const hash = getFolderHash(item.Folder),
|
||||
folder = getFolderFromCacheList(item.Folder);
|
||||
let unreadCountChange = false;
|
||||
|
@ -825,7 +825,7 @@ class AppUser extends AbstractApp {
|
|||
if ('' !== sFolderFullNameRaw && 0 < rootUids.length) {
|
||||
switch (iSetAction) {
|
||||
case MessageSetAction.SetSeen:
|
||||
_.each(rootUids, (sSubUid) => {
|
||||
rootUids.forEach(sSubUid => {
|
||||
alreadyUnread += storeMessageFlagsToCacheBySetAction(sFolderFullNameRaw, sSubUid, iSetAction);
|
||||
});
|
||||
|
||||
|
@ -838,7 +838,7 @@ class AppUser extends AbstractApp {
|
|||
break;
|
||||
|
||||
case MessageSetAction.UnsetSeen:
|
||||
_.each(rootUids, (sSubUid) => {
|
||||
rootUids.forEach(sSubUid => {
|
||||
alreadyUnread += storeMessageFlagsToCacheBySetAction(sFolderFullNameRaw, sSubUid, iSetAction);
|
||||
});
|
||||
|
||||
|
@ -851,7 +851,7 @@ class AppUser extends AbstractApp {
|
|||
break;
|
||||
|
||||
case MessageSetAction.SetFlag:
|
||||
_.each(rootUids, (sSubUid) => {
|
||||
rootUids.forEach(sSubUid => {
|
||||
storeMessageFlagsToCacheBySetAction(sFolderFullNameRaw, sSubUid, iSetAction);
|
||||
});
|
||||
|
||||
|
@ -859,7 +859,7 @@ class AppUser extends AbstractApp {
|
|||
break;
|
||||
|
||||
case MessageSetAction.UnsetFlag:
|
||||
_.each(rootUids, (sSubUid) => {
|
||||
rootUids.forEach(sSubUid => {
|
||||
storeMessageFlagsToCacheBySetAction(sFolderFullNameRaw, sSubUid, iSetAction);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import { isObject, isUnd } from 'Common/Utils';
|
||||
import * as Plugins from 'Common/Plugins';
|
||||
|
||||
|
@ -14,7 +13,7 @@ export function sub(name, func, context) {
|
|||
context = func || null;
|
||||
func = null;
|
||||
|
||||
_.each(name, (subFunc, subName) => {
|
||||
Object.entries(name).forEach(([subFunc, subName]) => {
|
||||
sub(subName, subFunc, context);
|
||||
});
|
||||
} else {
|
||||
|
@ -34,7 +33,7 @@ export function pub(name, args) {
|
|||
Plugins.runHook('rl-pub', [name, args]);
|
||||
|
||||
if (!isUnd(SUBS[name])) {
|
||||
_.each(SUBS[name], (items) => {
|
||||
SUBS[name].forEach(items => {
|
||||
if (items[0]) {
|
||||
items[0].apply(items[1] || null, args || []);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import { isFunc, isArray, isUnd } from 'Common/Utils';
|
||||
import { data as GlobalsData } from 'Common/Globals';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
@ -27,7 +26,7 @@ export function addHook(name, callback) {
|
|||
*/
|
||||
export function runHook(name, args = []) {
|
||||
if (isArray(SIMPLE_HOOKS[name])) {
|
||||
_.each(SIMPLE_HOOKS[name], (callback) => {
|
||||
SIMPLE_HOOKS[name].forEach(callback => {
|
||||
callback(...args);
|
||||
});
|
||||
}
|
||||
|
@ -78,7 +77,7 @@ export function addSettingsViewModelForAdmin(SettingsViewModelClass, template, l
|
|||
*/
|
||||
export function runSettingsViewModelHooks(admin) {
|
||||
const Knoin = require('Knoin/Knoin');
|
||||
_.each(admin ? ADMIN_VIEW_MODELS_HOOKS : USER_VIEW_MODELS_HOOKS, (view) => {
|
||||
(admin ? ADMIN_VIEW_MODELS_HOOKS : USER_VIEW_MODELS_HOOKS).forEach(view => {
|
||||
Knoin.addSettingsViewModel(view[0], view[1], view[2], view[3]);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class Selector {
|
|||
this.selectedItem.subscribe((item) => {
|
||||
if (item) {
|
||||
if (this.isListChecked()) {
|
||||
_.each(this.listChecked(), (subItem) => {
|
||||
this.listChecked().forEach(subItem => {
|
||||
subItem.checked(false);
|
||||
});
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class Selector {
|
|||
this.list.subscribe(
|
||||
(items) => {
|
||||
if (isArray(items)) {
|
||||
_.each(items, (item) => {
|
||||
items.forEach(item => {
|
||||
if (item) {
|
||||
const uid = this.getItemUid(item);
|
||||
|
||||
|
@ -150,7 +150,7 @@ class Selector {
|
|||
if (isArray(aItems)) {
|
||||
len = aCheckedCache.length;
|
||||
|
||||
_.each(aItems, (item) => {
|
||||
aItems.forEach(item => {
|
||||
const uid = this.getItemUid(item);
|
||||
uids.push(uid);
|
||||
|
||||
|
@ -416,7 +416,7 @@ class Selector {
|
|||
EventKeyCode.Insert === iEventKeyCode ||
|
||||
EventKeyCode.Space === iEventKeyCode
|
||||
) {
|
||||
_.each(list, (item) => {
|
||||
list.forEach(item => {
|
||||
if (!isStop) {
|
||||
switch (iEventKeyCode) {
|
||||
case EventKeyCode.Up:
|
||||
|
|
|
@ -302,7 +302,7 @@ export function replySubjectAdd(prefix, subject) {
|
|||
prefixIsRe = !fwd;
|
||||
|
||||
if ('' !== subject) {
|
||||
_.each(subject.split(':'), (part) => {
|
||||
subject.split(':').forEach(part => {
|
||||
const trimmedPart = trim(part);
|
||||
if (!drop && (/^(RE|FWD)$/i.test(trimmedPart) || /^(RE|FWD)[[(][\d]+[\])]$/i.test(trimmedPart))) {
|
||||
if (!re) {
|
||||
|
@ -1072,7 +1072,7 @@ export function disposeOne(propOrValue, value) {
|
|||
export function disposeObject(object) {
|
||||
if (object) {
|
||||
if (isArray(object.disposables)) {
|
||||
_.each(object.disposables, disposeOne);
|
||||
object.disposables.forEach(disposeOne);
|
||||
}
|
||||
|
||||
ko.utils.objectForEach(object, disposeOne);
|
||||
|
@ -1086,7 +1086,7 @@ export function disposeObject(object) {
|
|||
export function delegateRunOnDestroy(objectOrObjects) {
|
||||
if (objectOrObjects) {
|
||||
if (isArray(objectOrObjects)) {
|
||||
_.each(objectOrObjects, (item) => {
|
||||
objectOrObjects.forEach(item => {
|
||||
delegateRunOnDestroy(item);
|
||||
});
|
||||
} else if (objectOrObjects && objectOrObjects.onDestroy) {
|
||||
|
|
|
@ -131,7 +131,7 @@ export function hideScreenPopup(ViewModelClassToHide) {
|
|||
* @param {mixed=} params = null
|
||||
*/
|
||||
export function vmRunHook(hookName, ViewModelClass, params = null) {
|
||||
_.each(ViewModelClass.__names, (name) => {
|
||||
ViewModelClass.__names.forEach(name => {
|
||||
runHook(hookName, [name, ViewModelClass.__vm, params]);
|
||||
});
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ export function screenOnRoute(screenName, subPart) {
|
|||
vmScreen.__builded = true;
|
||||
|
||||
if (isNonEmptyArray(vmScreen.viewModels())) {
|
||||
_.each(vmScreen.viewModels(), (ViewModelClass) => {
|
||||
vmScreen.viewModels().forEach(ViewModelClass => {
|
||||
buildViewModel(ViewModelClass, vmScreen);
|
||||
});
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ export function screenOnRoute(screenName, subPart) {
|
|||
}
|
||||
|
||||
if (isNonEmptyArray(currentScreen.viewModels())) {
|
||||
_.each(currentScreen.viewModels(), (ViewModelClass) => {
|
||||
currentScreen.viewModels().forEach(ViewModelClass => {
|
||||
if (
|
||||
ViewModelClass.__vm &&
|
||||
ViewModelClass.__dom &&
|
||||
|
@ -361,7 +361,7 @@ export function screenOnRoute(screenName, subPart) {
|
|||
runHook('screen-on-show', [currentScreen.screenName(), currentScreen]);
|
||||
|
||||
if (isNonEmptyArray(currentScreen.viewModels())) {
|
||||
_.each(currentScreen.viewModels(), (ViewModelClass) => {
|
||||
currentScreen.viewModels().forEach(ViewModelClass => {
|
||||
if (
|
||||
ViewModelClass.__vm &&
|
||||
ViewModelClass.__dom &&
|
||||
|
@ -399,7 +399,7 @@ export function screenOnRoute(screenName, subPart) {
|
|||
* @returns {void}
|
||||
*/
|
||||
export function startScreens(screensClasses) {
|
||||
_.each(screensClasses, (CScreen) => {
|
||||
screensClasses.forEach(CScreen => {
|
||||
if (CScreen) {
|
||||
const vmScreen = new CScreen(),
|
||||
screenName = vmScreen ? vmScreen.screenName() : '';
|
||||
|
@ -414,7 +414,7 @@ export function startScreens(screensClasses) {
|
|||
}
|
||||
});
|
||||
|
||||
_.each(SCREENS, (vmScreen) => {
|
||||
Object.values(SCREENS).forEach(vmScreen => {
|
||||
if (vmScreen && !vmScreen.__started && vmScreen.__start) {
|
||||
vmScreen.__started = true;
|
||||
vmScreen.__start();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import { ContactPropertyType } from 'Common/Enums';
|
||||
|
@ -30,7 +29,7 @@ class ContactModel extends AbstractModel {
|
|||
email = '';
|
||||
|
||||
if (isNonEmptyArray(this.properties)) {
|
||||
_.each(this.properties, (property) => {
|
||||
this.properties.forEach(property => {
|
||||
if (property) {
|
||||
if (ContactPropertyType.FirstName === property[0]) {
|
||||
name = trim(property[1] + ' ' + name);
|
||||
|
@ -58,7 +57,7 @@ class ContactModel extends AbstractModel {
|
|||
this.readOnly = !!json.ReadOnly;
|
||||
|
||||
if (isNonEmptyArray(json.Properties)) {
|
||||
_.each(json.Properties, (property) => {
|
||||
json.Properties.forEach(property => {
|
||||
if (property && property.Type && isNormal(property.Value) && isNormal(property.TypeStr)) {
|
||||
this.properties.push([pInt(property.Type), pString(property.Value), pString(property.TypeStr)]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import _ from '_';
|
||||
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
import { isArray, isNormal, pInt, isUnd, noop } from 'Common/Utils';
|
||||
import { ClientSideKeyName, ServerFolderType } from 'Common/Enums';
|
||||
|
@ -48,7 +46,7 @@ class PromisesUserPopulator extends AbstractBasicPromises {
|
|||
const bDisplaySpecSetting = FolderStore.displaySpecSetting(),
|
||||
aList = [];
|
||||
|
||||
_.each(aFolders, (oFolder) => {
|
||||
aFolders.forEach(oFolder => {
|
||||
if (oFolder) {
|
||||
let oCacheFolder = Cache.getFolderFromCacheList(oFolder.FullNameRaw);
|
||||
if (!oCacheFolder) {
|
||||
|
|
|
@ -453,13 +453,13 @@ class RemoteUserAjax extends AbstractAjaxRemote {
|
|||
|
||||
if (isArray(list) && 0 < list.length) {
|
||||
request = false;
|
||||
_.each(list, (messageListItem) => {
|
||||
list.forEach(messageListItem => {
|
||||
if (!getMessageFlagsFromCache(messageListItem.folderFullNameRaw, messageListItem.uid)) {
|
||||
uids.push(messageListItem.uid);
|
||||
}
|
||||
|
||||
if (0 < messageListItem.threads().length) {
|
||||
_.each(messageListItem.threads(), (uid) => {
|
||||
messageListItem.threads().forEach(uid => {
|
||||
if (!getMessageFlagsFromCache(messageListItem.folderFullNameRaw, uid)) {
|
||||
uids.push(uid);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class AbstractSettingsScreen extends AbstractScreen {
|
|||
delegateRun(this.oCurrentSubScreen, 'onShow');
|
||||
delegateRun(this.oCurrentSubScreen, 'onShowWithDelay', [], 200);
|
||||
|
||||
_.each(this.menu(), (item) => {
|
||||
this.menu().forEach(item => {
|
||||
item.selected(
|
||||
settingsScreen &&
|
||||
settingsScreen.__rlSettingsData &&
|
||||
|
@ -148,7 +148,7 @@ class AbstractSettingsScreen extends AbstractScreen {
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
_.each(VIEW_MODELS.settings, (SettingsViewModel) => {
|
||||
VIEW_MODELS.settings.forEach(SettingsViewModel => {
|
||||
if (
|
||||
SettingsViewModel &&
|
||||
SettingsViewModel.__rlSettingsData &&
|
||||
|
|
|
@ -116,7 +116,7 @@ class MailBoxUserScreen extends AbstractScreen {
|
|||
FolderStore.foldersInboxUnreadCount(count);
|
||||
|
||||
const email = AccountStore.email();
|
||||
_.each(AccountStore.accounts(), (item) => {
|
||||
AccountStore.accounts().forEach(item => {
|
||||
if (item && email === item.email) {
|
||||
item.count(count);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import window from 'window';
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
|
@ -51,7 +50,7 @@ class PackagesAdminSettings {
|
|||
}
|
||||
}
|
||||
|
||||
_.each(this.packages(), (item) => {
|
||||
this.packages().forEach(item => {
|
||||
if (item && packageToRequest && item.loading && item.loading() && packageToRequest.file === item.file) {
|
||||
packageToRequest.loading(false);
|
||||
item.loading(false);
|
||||
|
|
|
@ -36,7 +36,7 @@ class ThemesUserSettings {
|
|||
this.oThemeAjaxRequest = null;
|
||||
|
||||
this.theme.subscribe((value) => {
|
||||
_.each(this.themesObjects(), (theme) => {
|
||||
this.themesObjects().forEach(theme => {
|
||||
theme.selected(value === theme.name);
|
||||
});
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class AccountUserStore {
|
|||
this.accountsUnreadCount = ko.computed(() => 0);
|
||||
// this.accountsUnreadCount = ko.computed(() => {
|
||||
// let result = 0;
|
||||
// _.each(this.accounts(), (item) => {
|
||||
// this.accounts().forEach(item => {
|
||||
// if (item)
|
||||
// {
|
||||
// result += item.count();
|
||||
|
|
|
@ -163,7 +163,7 @@ class FolderUserStore {
|
|||
timeouts = [],
|
||||
inboxFolderName = getFolderInboxName(),
|
||||
fSearchFunction = (list) => {
|
||||
_.each(list, (folder) => {
|
||||
list.forEach(folder => {
|
||||
if (
|
||||
folder &&
|
||||
inboxFolderName !== folder.fullNameRaw &&
|
||||
|
|
|
@ -163,7 +163,7 @@ class MessageUserStore {
|
|||
|
||||
this.messageListCheckedOrSelectedUidsWithSubMails = ko.computed(() => {
|
||||
let result = [];
|
||||
_.each(this.messageListCheckedOrSelected(), (message) => {
|
||||
this.messageListCheckedOrSelected().forEach(message => {
|
||||
if (message) {
|
||||
result.push(message.uid);
|
||||
if (1 < message.threadsLen()) {
|
||||
|
@ -184,7 +184,7 @@ class MessageUserStore {
|
|||
|
||||
this.messageList.subscribe(
|
||||
_.debounce((list) => {
|
||||
_.each(list, (item) => {
|
||||
list.forEach(item => {
|
||||
if (item && item.newForAnimation()) {
|
||||
item.newForAnimation(false);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ class MessageUserStore {
|
|||
initUidNextAndNewMessages(folder, uidNext, newMessages) {
|
||||
if (getFolderInboxName() === folder && isNormal(uidNext) && '' !== uidNext) {
|
||||
if (isArray(newMessages) && 0 < newMessages.length) {
|
||||
_.each(newMessages, (item) => {
|
||||
newMessages.forEach(item => {
|
||||
addNewMessageCache(folder, item.Uid);
|
||||
});
|
||||
|
||||
|
@ -265,7 +265,7 @@ class MessageUserStore {
|
|||
{ 'Folder': '', 'Uid': '' }
|
||||
);
|
||||
} else {
|
||||
_.each(newMessages, (item) => {
|
||||
newMessages.forEach(item => {
|
||||
NotificationStore.displayDesktopNotification(
|
||||
notificationMailIcon(),
|
||||
MessageHelper.emailArrayToString(MessageHelper.emailArrayFromJson(item.From), false),
|
||||
|
@ -310,7 +310,7 @@ class MessageUserStore {
|
|||
? messageList.filter(item => item && uidForRemove.includes(pInt(item.uid)))
|
||||
: [];
|
||||
|
||||
_.each(messages, (item) => {
|
||||
messages.forEach(item => {
|
||||
if (item && item.unseen()) {
|
||||
unseenCount += 1;
|
||||
}
|
||||
|
@ -343,13 +343,13 @@ class MessageUserStore {
|
|||
|
||||
if (0 < messages.length) {
|
||||
if (copy) {
|
||||
_.each(messages, (item) => {
|
||||
messages.forEach(item => {
|
||||
item.checked(false);
|
||||
});
|
||||
} else {
|
||||
this.messageListIsNotCompleted(true);
|
||||
|
||||
_.each(messages, (item) => {
|
||||
messages.forEach(item => {
|
||||
if (currentMessage && currentMessage.hash === item.hash) {
|
||||
currentMessage = null;
|
||||
this.message(null);
|
||||
|
@ -359,7 +359,7 @@ class MessageUserStore {
|
|||
});
|
||||
|
||||
_.delay(() => {
|
||||
_.each(messages, (item) => {
|
||||
messages.forEach(item => {
|
||||
this.messageList.remove(item);
|
||||
});
|
||||
}, Magics.Time350ms);
|
||||
|
@ -756,7 +756,7 @@ class MessageUserStore {
|
|||
clearMessageFlagsFromCacheByFolder(folder.fullNameRaw);
|
||||
}
|
||||
|
||||
_.each(data.Result['@Collection'], (jsonMessage) => {
|
||||
data.Result['@Collection'].forEach(jsonMessage => {
|
||||
if (jsonMessage && 'Object/Message' === jsonMessage['@Object']) {
|
||||
const message = MessageModel.newInstanceFromJson(jsonMessage);
|
||||
if (message) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import { trim } from 'Common/Utils';
|
||||
|
@ -56,7 +55,7 @@ class AdvancedSearchPopupView extends AbstractViewNext {
|
|||
|
||||
parseSearchStringValue(search) {
|
||||
const parts = (search || '').split(/[\s]+/g);
|
||||
_.each(parts, (part) => {
|
||||
parts.forEach(part => {
|
||||
switch (part) {
|
||||
case 'has:attachment':
|
||||
this.hasAttachment(true);
|
||||
|
|
|
@ -588,7 +588,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
}
|
||||
};
|
||||
|
||||
_.each(identities, (item, index) => {
|
||||
identities.forEach((item, index) => {
|
||||
identitiesCache[item.email()] = [item, index];
|
||||
});
|
||||
|
||||
|
@ -600,13 +600,13 @@ class ComposePopupView extends AbstractViewNext {
|
|||
case ComposeType.ReplyAll:
|
||||
case ComposeType.Forward:
|
||||
case ComposeType.ForwardAsAttachment:
|
||||
_.each(_.union(message.to, message.cc, message.bcc), fEachHelper);
|
||||
_.union(message.to, message.cc, message.bcc).forEach(fEachHelper);
|
||||
if (!resultIdentity) {
|
||||
_.each(message.deliveredTo, fEachHelper);
|
||||
message.deliveredTo.forEach(fEachHelper);
|
||||
}
|
||||
break;
|
||||
case ComposeType.Draft:
|
||||
_.each(_.union(message.from, message.replyTo), fEachHelper);
|
||||
_.union(message.from, message.replyTo).forEach(fEachHelper);
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
@ -775,7 +775,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
if (moments && 0 < moments.length) {
|
||||
_.each(moments, (data) => {
|
||||
moments.forEach(data => {
|
||||
signature = signature.replace(data[0], momentorFormat(0, data[1]));
|
||||
});
|
||||
}
|
||||
|
@ -1112,7 +1112,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
this.setFocusInPopup();
|
||||
});
|
||||
} else if (isNonEmptyArray(oMessageOrArray)) {
|
||||
_.each(oMessageOrArray, (item) => {
|
||||
oMessageOrArray.forEach(item => {
|
||||
this.addMessageAsAttachment(item);
|
||||
});
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
onMessageUploadAttachments(sResult, oData) {
|
||||
if (StorageResultType.Success === sResult && oData && oData.Result) {
|
||||
if (!this.viewModelVisibility()) {
|
||||
_.each(oData.Result, (id, tempName) => {
|
||||
oData.Result.forEach((id, tempName) => {
|
||||
const attachment = this.getAttachmentById(id);
|
||||
if (attachment) {
|
||||
attachment.tempName(tempName);
|
||||
|
@ -1411,7 +1411,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
*/
|
||||
prepearAttachmentsForSendOrSave() {
|
||||
const result = {};
|
||||
_.each(this.attachmentsInReady(), (item) => {
|
||||
this.attachmentsInReady().forEach(item => {
|
||||
if (item && '' !== item.tempName() && item.enabled()) {
|
||||
result[item.tempName()] = [item.fileName(), item.isInline ? '1' : '0', item.CID, item.contentLocation];
|
||||
}
|
||||
|
@ -1474,7 +1474,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
this.addMessageAsAttachment(message);
|
||||
} else {
|
||||
const attachments = message.attachments();
|
||||
_.each(isNonEmptyArray(attachments) ? attachments : [], (item) => {
|
||||
(isNonEmptyArray(attachments) ? attachments : []).forEach(item => {
|
||||
let add = false;
|
||||
switch (type) {
|
||||
case ComposeType.Reply:
|
||||
|
@ -1524,7 +1524,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
setMessageAttachmentFailedDownloadText() {
|
||||
_.each(this.attachments(), (attachment) => {
|
||||
this.attachments().forEach(attachment => {
|
||||
if (attachment && attachment.fromMessage) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
|
|
|
@ -157,7 +157,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
|||
} else if (this.encryptKeys()) {
|
||||
aPublicKeys = [];
|
||||
|
||||
_.each(this.encryptKeys(), (oKey) => {
|
||||
this.encryptKeys().forEach(oKey => {
|
||||
if (oKey && oKey.key) {
|
||||
aPublicKeys = aPublicKeys.concat(_.compact(_.flatten(oKey.key.getNativeKeys())));
|
||||
} else if (oKey && oKey.email) {
|
||||
|
@ -279,7 +279,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
|||
|
||||
@command()
|
||||
updateCommand() {
|
||||
_.each(this.encryptKeys(), (oKey) => {
|
||||
this.encryptKeys().forEach(oKey => {
|
||||
oKey.removable(!this.sign() || !this.signKey() || this.signKey().key.id !== oKey.key.id);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
const requestUid = fakeMd5(),
|
||||
properties = [];
|
||||
|
||||
_.each(this.viewProperties(), (oItem) => {
|
||||
this.viewProperties().forEach(oItem => {
|
||||
if (oItem.type() && oItem.type() !== ContactPropertyType.FullName && '' !== trim(oItem.value())) {
|
||||
properties.push([oItem.type(), oItem.value(), oItem.typeStr()]);
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
count = this.contacts().length;
|
||||
|
||||
if (0 < contacts.length) {
|
||||
_.each(contacts, (contact) => {
|
||||
contacts.forEach(contact => {
|
||||
if (currentContact && currentContact.idContact === contact.idContact) {
|
||||
currentContact = null;
|
||||
this.currentContact(null);
|
||||
|
@ -471,7 +471,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
_.delay(() => {
|
||||
_.each(contacts, (contact) => {
|
||||
contacts.forEach(contact => {
|
||||
koContacts.remove(contact);
|
||||
delegateRunOnDestroy(contact);
|
||||
});
|
||||
|
@ -523,7 +523,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
if (contact) {
|
||||
id = contact.idContact;
|
||||
if (isNonEmptyArray(contact.properties)) {
|
||||
_.each(contact.properties, (property) => {
|
||||
contact.properties.forEach(property => {
|
||||
if (property && property[0]) {
|
||||
if (ContactPropertyType.LastName === property[0]) {
|
||||
lastName = property[1];
|
||||
|
|
|
@ -42,7 +42,7 @@ class LanguagesPopupView extends AbstractViewNext {
|
|||
|
||||
setLanguageSelection() {
|
||||
const currentLang = this.fLang ? ko.unwrap(this.fLang) : '';
|
||||
_.each(this.languages(), (item) => {
|
||||
this.languages().forEach(item => {
|
||||
item.selected(item.key === currentLang);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class PluginPopupView extends AbstractViewNext {
|
|||
const list = {};
|
||||
list.Name = this.name();
|
||||
|
||||
_.each(this.configures(), (oItem) => {
|
||||
this.configures().forEach(oItem => {
|
||||
let value = oItem.value();
|
||||
if (false === value || true === value) {
|
||||
value = value ? '1' : '0';
|
||||
|
|
|
@ -146,7 +146,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
read: () => 0 < MessageStore.messageListChecked().length,
|
||||
write: (value) => {
|
||||
value = !!value;
|
||||
_.each(MessageStore.messageList(), (message) => {
|
||||
MessageStore.messageList().forEach(message => {
|
||||
message.checked(value);
|
||||
});
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
case MessageSetAction.SetSeen:
|
||||
folder = getFolderFromCacheList(sFolderFullNameRaw);
|
||||
if (folder) {
|
||||
_.each(MessageStore.messageList(), (message) => {
|
||||
MessageStore.messageList().forEach(message => {
|
||||
if (message.unseen()) {
|
||||
cnt += 1;
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
case MessageSetAction.UnsetSeen:
|
||||
folder = getFolderFromCacheList(sFolderFullNameRaw);
|
||||
if (folder) {
|
||||
_.each(MessageStore.messageList(), (message) => {
|
||||
MessageStore.messageList().forEach(message => {
|
||||
if (!message.unseen()) {
|
||||
cnt += 1;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
|
||||
this.showAttachmnetControls.subscribe((v) => {
|
||||
if (this.message()) {
|
||||
_.each(this.message().attachments(), (item) => {
|
||||
this.message().attachments().forEach(item => {
|
||||
if (item) {
|
||||
item.checked(!!v);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue