|
1 | 1 |
|
2 | | -import {window, _, $} from 'common'; |
| 2 | +import window from 'window'; |
| 3 | +import _ from '_'; |
| 4 | +import $ from '$'; |
3 | 5 | import progressJs from 'progressJs'; |
4 | 6 | import Tinycon from 'Tinycon'; |
5 | 7 |
|
6 | 8 | import { |
7 | | - noop, trim, log, isArray, inArray, isUnd, isNormal, isPosNumeric, isNonEmptyArray, |
| 9 | + noop, trim, log, has, isArray, inArray, isUnd, isNormal, isPosNumeric, isNonEmptyArray, |
8 | 10 | pInt, pString, delegateRunOnDestroy, mailToHelper, windowResize |
9 | 11 | } from 'Common/Utils'; |
10 | 12 |
|
@@ -411,18 +413,17 @@ class AppUser extends AbstractApp |
411 | 413 | * @param {Function=} callback = null |
412 | 414 | */ |
413 | 415 | foldersReload(callback = null) { |
414 | | - |
415 | | - Promises.foldersReload(FolderStore.foldersLoading).then((value) => { |
416 | | - if (callback) |
417 | | - { |
| 416 | + const prom = Promises.foldersReload(FolderStore.foldersLoading); |
| 417 | + if (callback) |
| 418 | + { |
| 419 | + prom.then((value) => { |
418 | 420 | callback(!!value); |
419 | | - } |
420 | | - }).catch(() => { |
421 | | - if (callback) |
422 | | - { |
423 | | - _.delay(() => callback(false), 1); |
424 | | - } |
425 | | - }); |
| 421 | + }).catch(() => { |
| 422 | + _.delay(() => { |
| 423 | + callback(false); |
| 424 | + }, 1); |
| 425 | + }); |
| 426 | + } |
426 | 427 | } |
427 | 428 |
|
428 | 429 | foldersPromisesActionHelper(promise, errorDefCode) { |
@@ -481,7 +482,9 @@ class AppUser extends AbstractApp |
481 | 482 | iIndex, |
482 | 483 | oItem.primaryKey.getFingerprint(), |
483 | 484 | oItem.primaryKey.getKeyId().toHex().toLowerCase(), |
484 | | - _.uniq(_.compact(_.map(oItem.getKeyIds(), (item) => item && item.toHex ? item.toHex() : null))), |
| 485 | + _.uniq(_.compact(_.map( |
| 486 | + oItem.getKeyIds(), (item) => (item && item.toHex ? item.toHex() : null) |
| 487 | + ))), |
485 | 488 | aUsers, |
486 | 489 | aEmails, |
487 | 490 | oItem.isPrivate(), |
@@ -672,7 +675,7 @@ class AppUser extends AbstractApp |
672 | 675 | { |
673 | 676 | for (uid in data.Result.Flags) |
674 | 677 | { |
675 | | - if (data.Result.Flags.hasOwnProperty(uid)) |
| 678 | + if (has(data.Result.Flags, uid)) |
676 | 679 | { |
677 | 680 | check = true; |
678 | 681 | const flags = data.Result.Flags[uid]; |
@@ -808,7 +811,7 @@ class AppUser extends AbstractApp |
808 | 811 | aMessages = MessageStore.messageListChecked(); |
809 | 812 | } |
810 | 813 |
|
811 | | - aRootUids = _.uniq(_.compact(_.map(aMessages, (oMessage) => (oMessage && oMessage.uid) ? oMessage.uid : null))); |
| 814 | + aRootUids = _.uniq(_.compact(_.map(aMessages, (oMessage) => (oMessage && oMessage.uid ? oMessage.uid : null)))); |
812 | 815 |
|
813 | 816 | if ('' !== sFolderFullNameRaw && 0 < aRootUids.length) |
814 | 817 | { |
@@ -934,18 +937,17 @@ class AppUser extends AbstractApp |
934 | 937 |
|
935 | 938 | /** |
936 | 939 | * @param {string} query |
937 | | - * @param {Function} callback |
| 940 | + * @param {Function} autocompleteCallback |
938 | 941 | */ |
939 | | - getAutocomplete(query, callback) { |
| 942 | + getAutocomplete(query, autocompleteCallback) { |
940 | 943 | Remote.suggestions((result, data) => { |
941 | 944 | if (StorageResultType.Success === result && data && isArray(data.Result)) |
942 | 945 | { |
943 | | - callback(_.compact(_.map(data.Result, |
944 | | - (item) => item && item[0] ? new EmailModel(item[0], item[1]) : null))); |
| 946 | + autocompleteCallback(_.compact(_.map(data.Result, (item) => (item && item[0] ? new EmailModel(item[0], item[1]) : null)))); |
945 | 947 | } |
946 | 948 | else if (StorageResultType.Abort !== result) |
947 | 949 | { |
948 | | - callback([]); |
| 950 | + autocompleteCallback([]); |
949 | 951 | } |
950 | 952 | }, query); |
951 | 953 | } |
@@ -1407,7 +1409,7 @@ class AppUser extends AbstractApp |
1407 | 1409 | window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s', |
1408 | 1410 | '' + (Settings.settingsGet('Title') || 'RainLoop')); |
1409 | 1411 | } |
1410 | | - catch (e) {/* eslint-disable-line no-empty */} |
| 1412 | + catch (e) {} // eslint-disable-line no-empty |
1411 | 1413 |
|
1412 | 1414 | if (Settings.settingsGet('MailToEmail')) |
1413 | 1415 | { |
|
0 commit comments