mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Array.isArray to isArray
Array.isNotEmpty to isNonEmptyArray
This commit is contained in:
parent
986b8f056b
commit
0b64083543
30 changed files with 82 additions and 69 deletions
|
|
@ -3,7 +3,7 @@ import ko from 'ko';
|
|||
import { Scope, Notification } from 'Common/Enums';
|
||||
import { MessageSetAction } from 'Common/EnumsUser';
|
||||
import { doc, elementById } from 'Common/Globals';
|
||||
import { pInt, pString, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||
import { isNonEmptyArray, pInt, pString, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||
import { plainToHtml } from 'Common/UtilsUser';
|
||||
|
||||
import {
|
||||
|
|
@ -237,7 +237,7 @@ export const MessageUserStore = new class {
|
|||
|
||||
initUidNextAndNewMessages(folder, uidNext, newMessages) {
|
||||
if (getFolderInboxName() === folder && uidNext) {
|
||||
if (Array.isNotEmpty(newMessages)) {
|
||||
if (isNonEmptyArray(newMessages)) {
|
||||
newMessages.forEach(item => addNewMessageCache(folder, item.Uid));
|
||||
|
||||
NotificationUserStore.playSoundNotification();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { i18n } from 'Common/Translator';
|
||||
import { pString } from 'Common/Utils';
|
||||
import { isArray, isNonEmptyArray, pString } from 'Common/Utils';
|
||||
import { doc } from 'Common/Globals';
|
||||
|
||||
import { AccountUserStore } from 'Stores/User/Account';
|
||||
|
|
@ -54,7 +54,7 @@ function domControlEncryptedClickHelper(store, dom, armoredMessage, recipients)
|
|||
decryptedMessage.getText()
|
||||
);
|
||||
} else if (validPrivateKey) {
|
||||
const keyIds = Array.isNotEmpty(signingKeyIds) ? signingKeyIds : null,
|
||||
const keyIds = isNonEmptyArray(signingKeyIds) ? signingKeyIds : null,
|
||||
additional = keyIds
|
||||
? keyIds.map(item => (item && item.toHex ? item.toHex() : null)).filter(v => v).join(', ')
|
||||
: '';
|
||||
|
|
@ -110,7 +110,7 @@ function domControlSignedClickHelper(store, dom, armoredMessage) {
|
|||
message.getText()
|
||||
);
|
||||
} else {
|
||||
const keyIds = Array.isNotEmpty(signingKeyIds) ? signingKeyIds : null,
|
||||
const keyIds = isNonEmptyArray(signingKeyIds) ? signingKeyIds : null,
|
||||
additional = keyIds
|
||||
? keyIds.map(item => (item && item.toHex ? item.toHex() : null)).filter(v => v).join(', ')
|
||||
: '';
|
||||
|
|
@ -179,14 +179,14 @@ export const PgpUserStore = new class {
|
|||
}
|
||||
|
||||
findPrivateKeysByEncryptionKeyIds(encryptionKeyIds, recipients, returnWrapKeys) {
|
||||
let result = Array.isArray(encryptionKeyIds)
|
||||
let result = isArray(encryptionKeyIds)
|
||||
? encryptionKeyIds.map(id => {
|
||||
const key = id && id.toHex ? this.findPrivateKeyByHex(id.toHex()) : null;
|
||||
return key ? (returnWrapKeys ? [key] : key.getNativeKeys()) : [null];
|
||||
}).flat().filter(v => v)
|
||||
: [];
|
||||
|
||||
if (!result.length && Array.isNotEmpty(recipients)) {
|
||||
if (!result.length && isNonEmptyArray(recipients)) {
|
||||
result = recipients.map(sEmail => {
|
||||
const keys = sEmail ? this.findAllPrivateKeysByEmailNotNative(sEmail) : null;
|
||||
return keys
|
||||
|
|
@ -314,7 +314,7 @@ export const PgpUserStore = new class {
|
|||
if (publicKeys && publicKeys.length) {
|
||||
try {
|
||||
const result = message.verify(publicKeys),
|
||||
valid = (Array.isArray(result) ? result : []).find(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) {
|
||||
fCallback(this.findPublicKeyByHex(valid.keyid.toHex()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue