mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Cleanup array.length checks and for() to forEach()
This commit is contained in:
parent
db5751cd00
commit
82bed1ed80
24 changed files with 135 additions and 169 deletions
10
README.md
10
README.md
|
|
@ -62,22 +62,22 @@ Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyf
|
||||||
|js/* |1.14.0 |native |
|
|js/* |1.14.0 |native |
|
||||||
|----------- |--------: |--------: |
|
|----------- |--------: |--------: |
|
||||||
|admin.js |2.130.942 |1.359.501 |
|
|admin.js |2.130.942 |1.359.501 |
|
||||||
|app.js |4.184.455 |3.127.807 |
|
|app.js |4.184.455 |3.121.743 |
|
||||||
|boot.js | 671.522 | 109.651 |
|
|boot.js | 671.522 | 109.651 |
|
||||||
|libs.js | 647.614 | 508.324 |
|
|libs.js | 647.614 | 508.324 |
|
||||||
|polyfills.js | 325.834 | 0 |
|
|polyfills.js | 325.834 | 0 |
|
||||||
|TOTAL js |7.960.367 |5.105.283 |
|
|TOTAL js |7.960.367 |5.097.142 |
|
||||||
|
|
||||||
|js/min/* |1.14.0 |native |
|
|js/min/* |1.14.0 |native |
|
||||||
|----------- |--------: |--------: |
|
|----------- |--------: |--------: |
|
||||||
|admin.js | 252.147 | 177.094 |
|
|admin.js | 252.147 | 177.094 |
|
||||||
|app.js | 511.202 | 409.778 |
|
|app.js | 511.202 | 409.173 |
|
||||||
|boot.js | 66.007 | 13.380 |
|
|boot.js | 66.007 | 13.380 |
|
||||||
|libs.js | 572.545 | 465.247 |
|
|libs.js | 572.545 | 465.247 |
|
||||||
|polyfills.js | 32.452 | 0 |
|
|polyfills.js | 32.452 | 0 |
|
||||||
|TOTAL js/min |1.434.353 |1.065.499 |
|
|TOTAL js/min |1.434.353 |1.064.753 |
|
||||||
|
|
||||||
368.854 bytes is not much, but it feels faster.
|
369.600 bytes is not much, but it feels faster.
|
||||||
|
|
||||||
### PHP73 branch
|
### PHP73 branch
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ class AbstractApp extends AbstractBoot {
|
||||||
* @param {string} title
|
* @param {string} title
|
||||||
*/
|
*/
|
||||||
setWindowTitle(title) {
|
setWindowTitle(title) {
|
||||||
title = isNormal(title) && 0 < title.length ? '' + title : '';
|
title = isNormal(title) && title.length ? '' + title : '';
|
||||||
if (Settings.settingsGet('Title')) {
|
if (Settings.settingsGet('Title')) {
|
||||||
title += (title ? ' - ' : '') + Settings.settingsGet('Title');
|
title += (title ? ' - ' : '') + Settings.settingsGet('Title');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ class AppUser extends AbstractApp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reloadMessageList(0 === MessageStore.messageList().length);
|
this.reloadMessageList(!MessageStore.messageList().length);
|
||||||
this.quotaDebounce();
|
this.quotaDebounce();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -427,7 +427,7 @@ class AppUser extends AbstractApp {
|
||||||
* @param {boolean=} bCopy = false
|
* @param {boolean=} bCopy = false
|
||||||
*/
|
*/
|
||||||
moveMessagesToFolder(sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy) {
|
moveMessagesToFolder(sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy) {
|
||||||
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && isArray(aUidForMove) && 0 < aUidForMove.length) {
|
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && isArray(aUidForMove) && aUidForMove.length) {
|
||||||
const oFromFolder = getFolderFromCacheList(sFromFolderFullNameRaw),
|
const oFromFolder = getFolderFromCacheList(sFromFolderFullNameRaw),
|
||||||
oToFolder = getFolderFromCacheList(sToFolderFullNameRaw);
|
oToFolder = getFolderFromCacheList(sToFolderFullNameRaw);
|
||||||
|
|
||||||
|
|
@ -823,7 +823,7 @@ class AppUser extends AbstractApp {
|
||||||
rootUids = messages.map(oMessage => oMessage && oMessage.uid ? oMessage.uid : null)
|
rootUids = messages.map(oMessage => oMessage && oMessage.uid ? oMessage.uid : null)
|
||||||
.filter((value, index, self) => !!value && self.indexOf(value) == index);
|
.filter((value, index, self) => !!value && self.indexOf(value) == index);
|
||||||
|
|
||||||
if ('' !== sFolderFullNameRaw && 0 < rootUids.length) {
|
if ('' !== sFolderFullNameRaw && rootUids.length) {
|
||||||
switch (iSetAction) {
|
switch (iSetAction) {
|
||||||
case MessageSetAction.SetSeen:
|
case MessageSetAction.SetSeen:
|
||||||
rootUids.forEach(sSubUid => {
|
rootUids.forEach(sSubUid => {
|
||||||
|
|
@ -1001,7 +1001,7 @@ class AppUser extends AbstractApp {
|
||||||
this.loginAndLogoutReload(
|
this.loginAndLogoutReload(
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
Settings.settingsGet('ParentEmail') && 0 < Settings.settingsGet('ParentEmail').length
|
0 < (Settings.settingsGet('ParentEmail')||{length:0}).length
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ export function initMessageFlagsFromCache(message) {
|
||||||
const uid = message.uid,
|
const uid = message.uid,
|
||||||
flags = getMessageFlagsFromCache(message.folderFullNameRaw, uid);
|
flags = getMessageFlagsFromCache(message.folderFullNameRaw, uid);
|
||||||
|
|
||||||
if (flags && 0 < flags.length) {
|
if (flags && flags.length) {
|
||||||
message.flagged(!!flags[1]);
|
message.flagged(!!flags[1]);
|
||||||
|
|
||||||
if (!message.isSimpleMessage) {
|
if (!message.isSimpleMessage) {
|
||||||
|
|
@ -221,11 +221,11 @@ export function initMessageFlagsFromCache(message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < message.threads().length) {
|
if (message.threads().length) {
|
||||||
const unseenSubUid = message.threads().find(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 && subFlags.length && !!subFlags[0];
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
@ -233,7 +233,7 @@ export function initMessageFlagsFromCache(message) {
|
||||||
const flaggedSubUid = message.threads().find(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 && subFlags.length && !!subFlags[1];
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
@ -266,7 +266,7 @@ export function storeMessageFlagsToCache(message) {
|
||||||
* @param {Array} flags
|
* @param {Array} flags
|
||||||
*/
|
*/
|
||||||
export function storeMessageFlagsToCacheByFolderAndUid(folder, uid, flags) {
|
export function storeMessageFlagsToCacheByFolderAndUid(folder, uid, flags) {
|
||||||
if (isArray(flags) && 0 < flags.length) {
|
if (isArray(flags) && flags.length) {
|
||||||
setMessageFlagsToCache(folder, uid, flags);
|
setMessageFlagsToCache(folder, uid, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +280,7 @@ export function storeMessageFlagsToCacheBySetAction(folder, uid, setAction) {
|
||||||
let unread = 0;
|
let unread = 0;
|
||||||
const flags = getMessageFlagsFromCache(folder, uid);
|
const flags = getMessageFlagsFromCache(folder, uid);
|
||||||
|
|
||||||
if (isArray(flags) && 0 < flags.length) {
|
if (isArray(flags) && flags.length) {
|
||||||
if (flags[0]) {
|
if (flags[0]) {
|
||||||
unread = 1;
|
unread = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class Selector {
|
||||||
this.itemSelectedThrottle = _.debounce(this.itemSelected.bind(this), 300);
|
this.itemSelectedThrottle = _.debounce(this.itemSelected.bind(this), 300);
|
||||||
|
|
||||||
this.listChecked.subscribe((items) => {
|
this.listChecked.subscribe((items) => {
|
||||||
if (0 < items.length) {
|
if (items.length) {
|
||||||
if (null === this.selectedItem()) {
|
if (null === this.selectedItem()) {
|
||||||
if (this.selectedItem.valueHasMutated) {
|
if (this.selectedItem.valueHasMutated) {
|
||||||
this.selectedItem.valueHasMutated();
|
this.selectedItem.valueHasMutated();
|
||||||
|
|
@ -177,7 +177,7 @@ class Selector {
|
||||||
if (!isChecked && !isSelected && this.autoSelect()) {
|
if (!isChecked && !isSelected && this.autoSelect()) {
|
||||||
if (this.focusedItem()) {
|
if (this.focusedItem()) {
|
||||||
this.selectedItem(this.focusedItem());
|
this.selectedItem(this.focusedItem());
|
||||||
} else if (0 < aItems.length) {
|
} else if (aItems.length) {
|
||||||
if (null !== isNextFocused) {
|
if (null !== isNextFocused) {
|
||||||
getNext = false;
|
getNext = false;
|
||||||
isNextFocused = aCache.find(sUid => {
|
isNextFocused = aCache.find(sUid => {
|
||||||
|
|
@ -201,7 +201,7 @@ class Selector {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(0 !== this.iSelectNextHelper || 0 !== this.iFocusedNextHelper) &&
|
(0 !== this.iSelectNextHelper || 0 !== this.iFocusedNextHelper) &&
|
||||||
0 < aItems.length &&
|
aItems.length &&
|
||||||
!this.focusedItem()
|
!this.focusedItem()
|
||||||
) {
|
) {
|
||||||
temp = null;
|
temp = null;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ export function boolToAjax(value) {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isNonEmptyArray(values) {
|
export function isNonEmptyArray(values) {
|
||||||
return isArray(values) && 0 < values.length;
|
return isArray(values) && values.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -141,17 +141,13 @@ export function encodeURI(url) {
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
export function simpleQueryParser(queryString) {
|
export function simpleQueryParser(queryString) {
|
||||||
let index = 0,
|
|
||||||
len = 0,
|
|
||||||
temp = null;
|
|
||||||
|
|
||||||
const queries = queryString.split('&'),
|
const queries = queryString.split('&'),
|
||||||
params = {};
|
params = {};
|
||||||
|
|
||||||
for (len = queries.length; index < len; index++) {
|
queries.forEach(temp => {
|
||||||
temp = queries[index].split('=');
|
temp = temp.split('=');
|
||||||
params[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
|
params[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
|
||||||
}
|
});
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
@ -707,7 +703,7 @@ export function htmlToPlain(html) {
|
||||||
const convertDivs = (...args) => {
|
const convertDivs = (...args) => {
|
||||||
if (args && 1 < args.length) {
|
if (args && 1 < args.length) {
|
||||||
let divText = trim(args[1]);
|
let divText = trim(args[1]);
|
||||||
if (0 < divText.length) {
|
if (divText.length) {
|
||||||
divText = divText.replace(/<div[^>]*>([\s\S\r\n]*)<\/div>/gim, convertDivs);
|
divText = divText.replace(/<div[^>]*>([\s\S\r\n]*)<\/div>/gim, convertDivs);
|
||||||
divText = '\n' + trim(divText) + '\n';
|
divText = '\n' + trim(divText) + '\n';
|
||||||
}
|
}
|
||||||
|
|
@ -805,15 +801,12 @@ export function plainToHtml(plain, findEmailAndLinksInText = false) {
|
||||||
bDo = true,
|
bDo = true,
|
||||||
bStart = true,
|
bStart = true,
|
||||||
aNextText = [],
|
aNextText = [],
|
||||||
sLine = '',
|
|
||||||
iIndex = 0,
|
|
||||||
aText = plain.split('\n');
|
aText = plain.split('\n');
|
||||||
|
|
||||||
do {
|
do {
|
||||||
bDo = false;
|
bDo = false;
|
||||||
aNextText = [];
|
aNextText = [];
|
||||||
for (iIndex = 0; iIndex < aText.length; iIndex++) {
|
aText.forEach(sLine => {
|
||||||
sLine = aText[iIndex];
|
|
||||||
bStart = '>' === sLine.substr(0, 1);
|
bStart = '>' === sLine.substr(0, 1);
|
||||||
if (bStart && !bIn) {
|
if (bStart && !bIn) {
|
||||||
bDo = true;
|
bDo = true;
|
||||||
|
|
@ -833,7 +826,7 @@ export function plainToHtml(plain, findEmailAndLinksInText = false) {
|
||||||
} else {
|
} else {
|
||||||
aNextText.push(sLine);
|
aNextText.push(sLine);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
if (bIn) {
|
if (bIn) {
|
||||||
bIn = false;
|
bIn = false;
|
||||||
|
|
@ -888,10 +881,7 @@ export function folderListOptionsBuilder(
|
||||||
let /**
|
let /**
|
||||||
* @type {?FolderModel}
|
* @type {?FolderModel}
|
||||||
*/
|
*/
|
||||||
oItem = null,
|
|
||||||
bSep = false,
|
bSep = false,
|
||||||
iIndex = 0,
|
|
||||||
iLen = 0,
|
|
||||||
aResult = [];
|
aResult = [];
|
||||||
|
|
||||||
const sDeepPrefix = '\u00A0\u00A0\u00A0';
|
const sDeepPrefix = '\u00A0\u00A0\u00A0';
|
||||||
|
|
@ -911,21 +901,20 @@ export function folderListOptionsBuilder(
|
||||||
aHeaderLines = [];
|
aHeaderLines = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iIndex = 0, iLen = aHeaderLines.length; iIndex < iLen; iIndex++) {
|
aHeaderLines.forEach(line => {
|
||||||
aResult.push({
|
aResult.push({
|
||||||
id: aHeaderLines[iIndex][0],
|
id: line[0],
|
||||||
name: aHeaderLines[iIndex][1],
|
name: line[1],
|
||||||
system: false,
|
system: false,
|
||||||
seporator: false,
|
seporator: false,
|
||||||
disabled: false
|
disabled: false
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
bSep = true;
|
bSep = true;
|
||||||
for (iIndex = 0, iLen = aSystem.length; iIndex < iLen; iIndex++) {
|
aSystem.forEach(oItem => {
|
||||||
oItem = aSystem[iIndex];
|
|
||||||
if (fVisibleCallback ? fVisibleCallback(oItem) : true) {
|
if (fVisibleCallback ? fVisibleCallback(oItem) : true) {
|
||||||
if (bSep && 0 < aResult.length) {
|
if (bSep && aResult.length) {
|
||||||
aResult.push({
|
aResult.push({
|
||||||
id: '---',
|
id: '---',
|
||||||
name: '---',
|
name: '---',
|
||||||
|
|
@ -947,11 +936,10 @@ export function folderListOptionsBuilder(
|
||||||
(fDisableCallback ? fDisableCallback(oItem) : false)
|
(fDisableCallback ? fDisableCallback(oItem) : false)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
bSep = true;
|
bSep = true;
|
||||||
for (iIndex = 0, iLen = aList.length; iIndex < iLen; iIndex++) {
|
aList.forEach(oItem => {
|
||||||
oItem = aList[iIndex];
|
|
||||||
// if (oItem.subScribed() || !oItem.existen || bBuildUnvisible)
|
// if (oItem.subScribed() || !oItem.existen || bBuildUnvisible)
|
||||||
if (
|
if (
|
||||||
(oItem.subScribed() || !oItem.existen || bBuildUnvisible) &&
|
(oItem.subScribed() || !oItem.existen || bBuildUnvisible) &&
|
||||||
|
|
@ -959,7 +947,7 @@ export function folderListOptionsBuilder(
|
||||||
) {
|
) {
|
||||||
if (fVisibleCallback ? fVisibleCallback(oItem) : true) {
|
if (fVisibleCallback ? fVisibleCallback(oItem) : true) {
|
||||||
if (FolderType.User === oItem.type() || !bSystem || oItem.hasSubScribedSubfolders()) {
|
if (FolderType.User === oItem.type() || !bSystem || oItem.hasSubScribedSubfolders()) {
|
||||||
if (bSep && 0 < aResult.length) {
|
if (bSep && aResult.length) {
|
||||||
aResult.push({
|
aResult.push({
|
||||||
id: '---',
|
id: '---',
|
||||||
name: '---',
|
name: '---',
|
||||||
|
|
@ -986,7 +974,7 @@ export function folderListOptionsBuilder(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oItem.subScribed() && 0 < oItem.subFolders().length) {
|
if (oItem.subScribed() && oItem.subFolders().length) {
|
||||||
aResult = aResult.concat(
|
aResult = aResult.concat(
|
||||||
folderListOptionsBuilder(
|
folderListOptionsBuilder(
|
||||||
[],
|
[],
|
||||||
|
|
@ -1002,7 +990,7 @@ export function folderListOptionsBuilder(
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
return aResult;
|
return aResult;
|
||||||
}
|
}
|
||||||
|
|
@ -1304,7 +1292,7 @@ export function mimeContentType(fileName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ext = getFileExtension(fileName);
|
ext = getFileExtension(fileName);
|
||||||
if (ext && 0 < ext.length && !isUnd(Mime[ext])) {
|
if (ext && ext.length && !isUnd(Mime[ext])) {
|
||||||
result = Mime[ext];
|
result = Mime[ext];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
dev/External/ko.js
vendored
2
dev/External/ko.js
vendored
|
|
@ -951,7 +951,7 @@ ko.extenders.limitedList = (target, limitedList) => {
|
||||||
const currentValue = ko.unwrap(target),
|
const currentValue = ko.unwrap(target),
|
||||||
list = ko.unwrap(limitedList);
|
list = ko.unwrap(limitedList);
|
||||||
|
|
||||||
if (Array.isArray(list) && 0 < list.length) {
|
if (Array.isArray(list) && list.length) {
|
||||||
if (list.includes(newValue)) {
|
if (list.includes(newValue)) {
|
||||||
target(newValue);
|
target(newValue);
|
||||||
} else if (list.includes(currentValue, list)) {
|
} else if (list.includes(currentValue, list)) {
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,9 @@ import { EmailModel } from 'Model/Email';
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function emailArrayToString(emails, friendlyView = false, wrapWithLink = false) {
|
export function emailArrayToString(emails, friendlyView = false, wrapWithLink = false) {
|
||||||
let index = 0,
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
const result = [];
|
const result = [];
|
||||||
if (isNonEmptyArray(emails)) {
|
if (isNonEmptyArray(emails)) {
|
||||||
for (len = emails.length; index < len; index++) {
|
emails.forEach(email => result.push(email.toLine(friendlyView, wrapWithLink)));
|
||||||
result.push(emails[index].toLine(friendlyView, wrapWithLink));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.join(', ');
|
return result.join(', ');
|
||||||
|
|
@ -26,16 +21,13 @@ export function emailArrayToString(emails, friendlyView = false, wrapWithLink =
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function emailArrayToStringClear(emails) {
|
export function emailArrayToStringClear(emails) {
|
||||||
let index = 0,
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
const result = [];
|
const result = [];
|
||||||
if (isNonEmptyArray(emails)) {
|
if (isNonEmptyArray(emails)) {
|
||||||
for (len = emails.length; index < len; index++) {
|
emails.forEach(email => {
|
||||||
if (emails[index] && emails[index].email && '' !== emails[index].name) {
|
if (email && email.email && '' !== email.name) {
|
||||||
result.push(emails[index].email);
|
result.push(email.email);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.join(', ');
|
return result.join(', ');
|
||||||
|
|
@ -46,18 +38,14 @@ export function emailArrayToStringClear(emails) {
|
||||||
* @returns {Array.<EmailModel>}
|
* @returns {Array.<EmailModel>}
|
||||||
*/
|
*/
|
||||||
export function emailArrayFromJson(json) {
|
export function emailArrayFromJson(json) {
|
||||||
let index = 0,
|
|
||||||
len = 0,
|
|
||||||
email = null;
|
|
||||||
|
|
||||||
const result = [];
|
const result = [];
|
||||||
if (isNonEmptyArray(json)) {
|
if (isNonEmptyArray(json)) {
|
||||||
for (index = 0, len = json.length; index < len; index++) {
|
json.forEach(email => {
|
||||||
email = EmailModel.newInstanceFromJson(json[index]);
|
email = EmailModel.newInstanceFromJson(email);
|
||||||
if (email) {
|
if (email) {
|
||||||
result.push(email);
|
result.push(email);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -69,15 +57,12 @@ export function emailArrayFromJson(json) {
|
||||||
* @param {Array} localEmails
|
* @param {Array} localEmails
|
||||||
*/
|
*/
|
||||||
export function replyHelper(inputEmails, unic, localEmails) {
|
export function replyHelper(inputEmails, unic, localEmails) {
|
||||||
if (inputEmails && 0 < inputEmails.length) {
|
if (inputEmails) {
|
||||||
let index = 0;
|
inputEmails.forEach(email => {
|
||||||
const len = inputEmails.length;
|
if (isUnd(unic[email.email])) {
|
||||||
|
unic[email.email] = true;
|
||||||
for (; index < len; index++) {
|
localEmails.push(email);
|
||||||
if (isUnd(unic[inputEmails[index].email])) {
|
|
||||||
unic[inputEmails[index].email] = true;
|
|
||||||
localEmails.push(inputEmails[index]);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ class FilterModel extends AbstractModel {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < this.conditions().length) {
|
if (this.conditions().length) {
|
||||||
if (this.conditions().find(cond => cond && !cond.verify())) {
|
if (this.conditions().find(cond => cond && !cond.verify())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ class FolderModel extends AbstractModel {
|
||||||
|
|
||||||
this.canBeDeleted = ko.computed(() => {
|
this.canBeDeleted = ko.computed(() => {
|
||||||
const bSystem = this.isSystemFolder();
|
const bSystem = this.isSystemFolder();
|
||||||
return !bSystem && 0 === this.subFolders().length && inboxFolderName !== this.fullNameRaw;
|
return !bSystem && !this.subFolders().length && inboxFolderName !== this.fullNameRaw;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.canBeSubScribed = ko.computed(
|
this.canBeSubScribed = ko.computed(
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,6 @@ class MessageModel extends AbstractModel {
|
||||||
if (attachment) {
|
if (attachment) {
|
||||||
if (
|
if (
|
||||||
'' !== attachment.cidWithOutTags &&
|
'' !== attachment.cidWithOutTags &&
|
||||||
0 < this.foundedCIDs.length &&
|
|
||||||
this.foundedCIDs.includes(attachment.cidWithOutTags)
|
this.foundedCIDs.includes(attachment.cidWithOutTags)
|
||||||
) {
|
) {
|
||||||
attachment.isLinked = true;
|
attachment.isLinked = true;
|
||||||
|
|
@ -372,14 +371,14 @@ class MessageModel extends AbstractModel {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
hasUnsubsribeLinks() {
|
hasUnsubsribeLinks() {
|
||||||
return this.unsubsribeLinks && 0 < this.unsubsribeLinks.length;
|
return this.unsubsribeLinks && this.unsubsribeLinks.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
getFirstUnsubsribeLink() {
|
getFirstUnsubsribeLink() {
|
||||||
return this.unsubsribeLinks && 0 < this.unsubsribeLinks.length ? this.unsubsribeLinks[0] || '' : '';
|
return this.unsubsribeLinks && this.unsubsribeLinks.length ? this.unsubsribeLinks[0] || '' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -573,11 +572,11 @@ class MessageModel extends AbstractModel {
|
||||||
unic = isUnd(excludeEmails) ? {} : excludeEmails;
|
unic = isUnd(excludeEmails) ? {} : excludeEmails;
|
||||||
|
|
||||||
replyHelper(this.replyTo, unic, result);
|
replyHelper(this.replyTo, unic, result);
|
||||||
if (0 === result.length) {
|
if (!result.length) {
|
||||||
replyHelper(this.from, unic, result);
|
replyHelper(this.from, unic, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === result.length && !last) {
|
if (!result.length && !last) {
|
||||||
return this.replyEmails({}, true);
|
return this.replyEmails({}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -596,14 +595,14 @@ class MessageModel extends AbstractModel {
|
||||||
unic = isUnd(excludeEmails) ? {} : excludeEmails;
|
unic = isUnd(excludeEmails) ? {} : excludeEmails;
|
||||||
|
|
||||||
replyHelper(this.replyTo, unic, toResult);
|
replyHelper(this.replyTo, unic, toResult);
|
||||||
if (0 === toResult.length) {
|
if (!toResult.length) {
|
||||||
replyHelper(this.from, unic, toResult);
|
replyHelper(this.from, unic, toResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
replyHelper(this.to, unic, toResult);
|
replyHelper(this.to, unic, toResult);
|
||||||
replyHelper(this.cc, unic, ccResult);
|
replyHelper(this.cc, unic, ccResult);
|
||||||
|
|
||||||
if (0 === toResult.length && !last) {
|
if (!toResult.length && !last) {
|
||||||
data = this.replyAllEmails({}, true);
|
data = this.replyAllEmails({}, true);
|
||||||
return [data[0], ccResult];
|
return [data[0], ccResult];
|
||||||
}
|
}
|
||||||
|
|
@ -623,7 +622,7 @@ class MessageModel extends AbstractModel {
|
||||||
*/
|
*/
|
||||||
attachmentsToStringLine() {
|
attachmentsToStringLine() {
|
||||||
const attachLines = this.attachments().map(item => item.fileName + ' (' + item.friendlySize + ')');
|
const attachLines = this.attachments().map(item => item.fileName + ' (' + item.friendlySize + ')');
|
||||||
return attachLines && 0 < attachLines.length ? attachLines.join(', ') : '';
|
return attachLines && attachLines.length ? attachLines.join(', ') : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -449,14 +449,14 @@ class RemoteUserAjax extends AbstractAjaxRemote {
|
||||||
let request = true;
|
let request = true;
|
||||||
const uids = [];
|
const uids = [];
|
||||||
|
|
||||||
if (isArray(list) && 0 < list.length) {
|
if (isArray(list) && list.length) {
|
||||||
request = false;
|
request = false;
|
||||||
list.forEach(messageListItem => {
|
list.forEach(messageListItem => {
|
||||||
if (!getMessageFlagsFromCache(messageListItem.folderFullNameRaw, messageListItem.uid)) {
|
if (!getMessageFlagsFromCache(messageListItem.folderFullNameRaw, messageListItem.uid)) {
|
||||||
uids.push(messageListItem.uid);
|
uids.push(messageListItem.uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < messageListItem.threads().length) {
|
if (messageListItem.threads().length) {
|
||||||
messageListItem.threads().forEach(uid => {
|
messageListItem.threads().forEach(uid => {
|
||||||
if (!getMessageFlagsFromCache(messageListItem.folderFullNameRaw, uid)) {
|
if (!getMessageFlagsFromCache(messageListItem.folderFullNameRaw, uid)) {
|
||||||
uids.push(uid);
|
uids.push(uid);
|
||||||
|
|
@ -465,7 +465,7 @@ class RemoteUserAjax extends AbstractAjaxRemote {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (0 < uids.length) {
|
if (uids.length) {
|
||||||
request = true;
|
request = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class ContactsAdminSettings {
|
||||||
if (value !== this.contactsType()) {
|
if (value !== this.contactsType()) {
|
||||||
if (supportedTypes.includes(value)) {
|
if (supportedTypes.includes(value)) {
|
||||||
this.contactsType(value);
|
this.contactsType(value);
|
||||||
} else if (0 < supportedTypes.length) {
|
} else if (supportedTypes.length) {
|
||||||
this.contactsType('');
|
this.contactsType('');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class FolderUserStore {
|
||||||
trashFolder = this.trashFolder(),
|
trashFolder = this.trashFolder(),
|
||||||
archiveFolder = this.archiveFolder();
|
archiveFolder = this.archiveFolder();
|
||||||
|
|
||||||
if (isArray(folders) && 0 < folders.length) {
|
if (isArray(folders) && folders.length) {
|
||||||
if ('' !== sentFolder && UNUSED_OPTION_VALUE !== sentFolder) {
|
if ('' !== sentFolder && UNUSED_OPTION_VALUE !== sentFolder) {
|
||||||
list.push(sentFolder);
|
list.push(sentFolder);
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +174,7 @@ class FolderUserStore {
|
||||||
timeouts.push([folder.interval, folder.fullNameRaw]);
|
timeouts.push([folder.interval, folder.fullNameRaw]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (folder && 0 < folder.subFolders().length) {
|
if (folder && folder.subFolders().length) {
|
||||||
fSearchFunction(folder.subFolders());
|
fSearchFunction(folder.subFolders());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ class MessageUserStore {
|
||||||
|
|
||||||
initUidNextAndNewMessages(folder, uidNext, newMessages) {
|
initUidNextAndNewMessages(folder, uidNext, newMessages) {
|
||||||
if (getFolderInboxName() === folder && isNormal(uidNext) && '' !== uidNext) {
|
if (getFolderInboxName() === folder && isNormal(uidNext) && '' !== uidNext) {
|
||||||
if (isArray(newMessages) && 0 < newMessages.length) {
|
if (isArray(newMessages) && newMessages.length) {
|
||||||
newMessages.forEach(item => {
|
newMessages.forEach(item => {
|
||||||
addNewMessageCache(folder, item.Uid);
|
addNewMessageCache(folder, item.Uid);
|
||||||
});
|
});
|
||||||
|
|
@ -343,7 +343,7 @@ class MessageUserStore {
|
||||||
toFolder.actionBlink(true);
|
toFolder.actionBlink(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < messages.length) {
|
if (messages.length) {
|
||||||
if (copy) {
|
if (copy) {
|
||||||
messages.forEach(item => {
|
messages.forEach(item => {
|
||||||
item.checked(false);
|
item.checked(false);
|
||||||
|
|
@ -381,7 +381,7 @@ class MessageUserStore {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
messageList &&
|
messageList &&
|
||||||
0 < messageList.length &&
|
messageList.length &&
|
||||||
!!messageList.find(item => !!(item && item.deleted() && item.uid === this.messageListThreadUid()))
|
!!messageList.find(item => !!(item && item.deleted() && item.uid === this.messageListThreadUid()))
|
||||||
) {
|
) {
|
||||||
const message = messageList.find(item => item && !item.deleted());
|
const message = messageList.find(item => item && !item.deleted());
|
||||||
|
|
@ -436,15 +436,10 @@ class MessageUserStore {
|
||||||
initBlockquoteSwitcher(messageTextBody) {
|
initBlockquoteSwitcher(messageTextBody) {
|
||||||
if (messageTextBody) {
|
if (messageTextBody) {
|
||||||
const $oList = $('blockquote:not(.rl-bq-switcher)', messageTextBody).filter(function() {
|
const $oList = $('blockquote:not(.rl-bq-switcher)', messageTextBody).filter(function() {
|
||||||
return (
|
return !$(this).parent().closest('blockquote', messageTextBody).length;
|
||||||
0 ===
|
|
||||||
$(this)
|
|
||||||
.parent()
|
|
||||||
.closest('blockquote', messageTextBody).length
|
|
||||||
); // eslint-disable-line no-invalid-this
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($oList && 0 < $oList.length) {
|
if ($oList && $oList.length) {
|
||||||
$oList.each(function() {
|
$oList.each(function() {
|
||||||
const $this = $(this); // eslint-disable-line no-invalid-this
|
const $this = $(this); // eslint-disable-line no-invalid-this
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class PgpUserStore {
|
||||||
}).flat().filter(value => !!value)
|
}).flat().filter(value => !!value)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
if (0 === result.length && isNonEmptyArray(recipients)) {
|
if (!result.length && isNonEmptyArray(recipients)) {
|
||||||
result = recipients.map(sEmail => {
|
result = recipients.map(sEmail => {
|
||||||
const keys = sEmail ? this.findAllPrivateKeysByEmailNotNative(sEmail) : null;
|
const keys = sEmail ? this.findAllPrivateKeysByEmailNotNative(sEmail) : null;
|
||||||
return keys
|
return keys
|
||||||
|
|
@ -143,7 +143,7 @@ class PgpUserStore {
|
||||||
decryptMessage(message, recipients, fCallback) {
|
decryptMessage(message, recipients, fCallback) {
|
||||||
if (message && message.getEncryptionKeyIds) {
|
if (message && message.getEncryptionKeyIds) {
|
||||||
const privateKeys = this.findPrivateKeysByEncryptionKeyIds(message.getEncryptionKeyIds(), recipients, true);
|
const privateKeys = this.findPrivateKeysByEncryptionKeyIds(message.getEncryptionKeyIds(), recipients, true);
|
||||||
if (privateKeys && 0 < privateKeys.length) {
|
if (privateKeys && privateKeys.length) {
|
||||||
showScreenPopup(require('View/Popup/MessageOpenPgp'), [
|
showScreenPopup(require('View/Popup/MessageOpenPgp'), [
|
||||||
(decryptedKey) => {
|
(decryptedKey) => {
|
||||||
if (decryptedKey) {
|
if (decryptedKey) {
|
||||||
|
|
@ -186,9 +186,9 @@ class PgpUserStore {
|
||||||
verifyMessage(message, fCallback) {
|
verifyMessage(message, fCallback) {
|
||||||
if (message && message.getSigningKeyIds) {
|
if (message && message.getSigningKeyIds) {
|
||||||
const signingKeyIds = message.getSigningKeyIds();
|
const signingKeyIds = message.getSigningKeyIds();
|
||||||
if (signingKeyIds && 0 < signingKeyIds.length) {
|
if (signingKeyIds && signingKeyIds.length) {
|
||||||
const publicKeys = this.findPublicKeysBySigningKeyIds(signingKeyIds);
|
const publicKeys = this.findPublicKeysBySigningKeyIds(signingKeyIds);
|
||||||
if (publicKeys && 0 < publicKeys.length) {
|
if (publicKeys && publicKeys.length) {
|
||||||
try {
|
try {
|
||||||
const result = message.verify(publicKeys),
|
const result = message.verify(publicKeys),
|
||||||
valid = (_.isArray(result) ? result : []).find(item => item && item.valid && item.keyid);
|
valid = (_.isArray(result) ? result : []).find(item => item && item.valid && item.keyid);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class TemplateUserStore {
|
||||||
// {
|
// {
|
||||||
// this.templatesNames.skipFirst = false;
|
// this.templatesNames.skipFirst = false;
|
||||||
// }
|
// }
|
||||||
// else if (aList && 1 < aList.length)
|
// else if (aList && aList.length)
|
||||||
// {
|
// {
|
||||||
// Remote.templatesSortOrder(null, aList);
|
// Remote.templatesSortOrder(null, aList);
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -111,11 +111,11 @@ class AdvancedSearchPopupView extends AbstractViewNext {
|
||||||
isPart.push('flagged');
|
isPart.push('flagged');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < hasPart.length) {
|
if (hasPart.length) {
|
||||||
result.push('has:' + hasPart.join(','));
|
result.push('has:' + hasPart.join(','));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < isPart.length) {
|
if (isPart.length) {
|
||||||
result.push('is:' + isPart.join(','));
|
result.push('is:' + isPart.join(','));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -202,19 +202,19 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
this.showReplyTo = ko.observable(false);
|
this.showReplyTo = ko.observable(false);
|
||||||
|
|
||||||
this.cc.subscribe((value) => {
|
this.cc.subscribe((value) => {
|
||||||
if (false === this.showCc() && 0 < value.length) {
|
if (false === this.showCc() && value.length) {
|
||||||
this.showCc(true);
|
this.showCc(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.bcc.subscribe((value) => {
|
this.bcc.subscribe((value) => {
|
||||||
if (false === this.showBcc() && 0 < value.length) {
|
if (false === this.showBcc() && value.length) {
|
||||||
this.showBcc(true);
|
this.showBcc(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.replyTo.subscribe((value) => {
|
this.replyTo.subscribe((value) => {
|
||||||
if (false === this.showReplyTo() && 0 < value.length) {
|
if (false === this.showReplyTo() && value.length) {
|
||||||
this.showReplyTo(true);
|
this.showReplyTo(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -286,13 +286,13 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.to.subscribe((value) => {
|
this.to.subscribe((value) => {
|
||||||
if (this.emptyToError() && 0 < value.length) {
|
if (this.emptyToError() && value.length) {
|
||||||
this.emptyToError(false);
|
this.emptyToError(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.attachmentsInProcess.subscribe((value) => {
|
this.attachmentsInProcess.subscribe((value) => {
|
||||||
if (this.attachmentsInProcessError() && isArray(value) && 0 === value.length) {
|
if (this.attachmentsInProcessError() && isArray(value) && value.length) {
|
||||||
this.attachmentsInProcessError(false);
|
this.attachmentsInProcessError(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -352,10 +352,10 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
this.attachmentsInErrorError(false);
|
this.attachmentsInErrorError(false);
|
||||||
this.emptyToError(false);
|
this.emptyToError(false);
|
||||||
|
|
||||||
if (0 < this.attachmentsInProcess().length) {
|
if (this.attachmentsInProcess().length) {
|
||||||
this.attachmentsInProcessError(true);
|
this.attachmentsInProcessError(true);
|
||||||
this.attachmentsPlace(true);
|
this.attachmentsPlace(true);
|
||||||
} else if (0 < this.attachmentsInError().length) {
|
} else if (this.attachmentsInError().length) {
|
||||||
this.attachmentsInErrorError(true);
|
this.attachmentsInErrorError(true);
|
||||||
this.attachmentsPlace(true);
|
this.attachmentsPlace(true);
|
||||||
}
|
}
|
||||||
|
|
@ -370,7 +370,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
isArray(this.aDraftInfo) &&
|
isArray(this.aDraftInfo) &&
|
||||||
3 === this.aDraftInfo.length &&
|
3 === this.aDraftInfo.length &&
|
||||||
isNormal(this.aDraftInfo[2]) &&
|
isNormal(this.aDraftInfo[2]) &&
|
||||||
0 < this.aDraftInfo[2].length
|
this.aDraftInfo[2].length
|
||||||
) {
|
) {
|
||||||
sSentFolder = this.aDraftInfo[2];
|
sSentFolder = this.aDraftInfo[2];
|
||||||
}
|
}
|
||||||
|
|
@ -774,7 +774,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moments && 0 < moments.length) {
|
if (moments) {
|
||||||
moments.forEach(data => {
|
moments.forEach(data => {
|
||||||
signature = signature.replace(data[0], momentorFormat(0, data[1]));
|
signature = signature.replace(data[0], momentorFormat(0, data[1]));
|
||||||
});
|
});
|
||||||
|
|
@ -1055,7 +1055,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') +
|
i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') +
|
||||||
': ' +
|
': ' +
|
||||||
sTo +
|
sTo +
|
||||||
(0 < sCc.length ? '<br />' + i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') +
|
(sCc.length ? '<br />' + i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') +
|
||||||
'<br />' +
|
'<br />' +
|
||||||
i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') +
|
i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') +
|
||||||
': ' +
|
': ' +
|
||||||
|
|
@ -1379,7 +1379,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachment) {
|
if (attachment) {
|
||||||
if ('' !== error && 0 < error.length) {
|
if ('' !== error && error.length) {
|
||||||
attachment
|
attachment
|
||||||
.waiting(false)
|
.waiting(false)
|
||||||
.uploading(false)
|
.uploading(false)
|
||||||
|
|
@ -1542,15 +1542,15 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
*/
|
*/
|
||||||
isEmptyForm(includeAttachmentInProgress = true) {
|
isEmptyForm(includeAttachmentInProgress = true) {
|
||||||
const withoutAttachment = includeAttachmentInProgress
|
const withoutAttachment = includeAttachmentInProgress
|
||||||
? 0 === this.attachments().length
|
? !this.attachments().length
|
||||||
: 0 === this.attachmentsInReady().length;
|
: !this.attachmentsInReady().length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
0 === this.to().length &&
|
!this.to().length &&
|
||||||
0 === this.cc().length &&
|
!this.cc().length &&
|
||||||
0 === this.bcc().length &&
|
!this.bcc().length &&
|
||||||
0 === this.replyTo().length &&
|
!this.replyTo().length &&
|
||||||
0 === this.subject().length &&
|
!this.subject().length &&
|
||||||
withoutAttachment &&
|
withoutAttachment &&
|
||||||
(!this.oEditor || '' === this.oEditor.getData())
|
(!this.oEditor || '' === this.oEditor.getData())
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result && this.encrypt()) {
|
if (result && this.encrypt()) {
|
||||||
if (0 === this.encryptKeys().length) {
|
if (!this.encryptKeys().length) {
|
||||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'));
|
this.notification(i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'));
|
||||||
result = false;
|
result = false;
|
||||||
} else if (this.encryptKeys()) {
|
} else if (this.encryptKeys()) {
|
||||||
|
|
@ -172,7 +172,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result && (0 === aPublicKeys.length || this.encryptKeys().length !== aPublicKeys.length)) {
|
if (result && (!aPublicKeys.length || this.encryptKeys().length !== aPublicKeys.length)) {
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -183,22 +183,24 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
let pgpPromise = null;
|
let pgpPromise = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (privateKey && 0 === aPublicKeys.length) {
|
if (aPublicKeys.length) {
|
||||||
|
if (privateKey) {
|
||||||
|
pgpPromise = PgpStore.openpgp.encrypt({
|
||||||
|
data: this.text(),
|
||||||
|
publicKeys: aPublicKeys,
|
||||||
|
privateKeys: [privateKey]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
pgpPromise = PgpStore.openpgp.encrypt({
|
||||||
|
data: this.text(),
|
||||||
|
publicKeys: aPublicKeys
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (privateKey) {
|
||||||
pgpPromise = PgpStore.openpgp.sign({
|
pgpPromise = PgpStore.openpgp.sign({
|
||||||
data: this.text(),
|
data: this.text(),
|
||||||
privateKeys: [privateKey]
|
privateKeys: [privateKey]
|
||||||
});
|
});
|
||||||
} else if (privateKey && 0 < aPublicKeys.length) {
|
|
||||||
pgpPromise = PgpStore.openpgp.encrypt({
|
|
||||||
data: this.text(),
|
|
||||||
publicKeys: aPublicKeys,
|
|
||||||
privateKeys: [privateKey]
|
|
||||||
});
|
|
||||||
} else if (!privateKey && 0 < aPublicKeys.length) {
|
|
||||||
pgpPromise = PgpStore.openpgp.encrypt({
|
|
||||||
data: this.text(),
|
|
||||||
publicKeys: aPublicKeys
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
log(e);
|
||||||
|
|
@ -380,7 +382,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
this.sign(true);
|
this.sign(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rec && 0 < rec.length) {
|
if (rec.length) {
|
||||||
this.encryptKeys(
|
this.encryptKeys(
|
||||||
rec.map(recEmail => {
|
rec.map(recEmail => {
|
||||||
const keys = PgpStore.findAllPublicKeysByEmailNotNative(recEmail);
|
const keys = PgpStore.findAllPublicKeysByEmailNotNative(recEmail);
|
||||||
|
|
@ -401,7 +403,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (0 < this.encryptKeys().length) {
|
if (this.encryptKeys().length) {
|
||||||
this.encrypt(true);
|
this.encrypt(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
const fFastClearEmptyListHelper = (list) => {
|
const fFastClearEmptyListHelper = (list) => {
|
||||||
if (list && 0 < list.length) {
|
if (list && list.length) {
|
||||||
this.viewProperties.removeAll(list);
|
this.viewProperties.removeAll(list);
|
||||||
delegateRunOnDestroy(list);
|
delegateRunOnDestroy(list);
|
||||||
}
|
}
|
||||||
|
|
@ -456,7 +456,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
let currentContact = this.currentContact(),
|
let currentContact = this.currentContact(),
|
||||||
count = this.contacts().length;
|
count = this.contacts().length;
|
||||||
|
|
||||||
if (0 < contacts.length) {
|
if (contacts.length) {
|
||||||
contacts.forEach(contact => {
|
contacts.forEach(contact => {
|
||||||
if (currentContact && currentContact.idContact === contact.idContact) {
|
if (currentContact && currentContact.idContact === contact.idContact) {
|
||||||
currentContact = null;
|
currentContact = null;
|
||||||
|
|
@ -481,7 +481,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteSelectedContacts() {
|
deleteSelectedContacts() {
|
||||||
if (0 < this.contactsCheckedOrSelected().length) {
|
if (this.contactsCheckedOrSelected().length) {
|
||||||
Remote.contactsDelete(this.deleteResponse.bind(this), this.contactsCheckedOrSelectedUids());
|
Remote.contactsDelete(this.deleteResponse.bind(this), this.contactsCheckedOrSelectedUids());
|
||||||
|
|
||||||
this.removeCheckedOrSelectedContactsFromList();
|
this.removeCheckedOrSelectedContactsFromList();
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,13 @@ class IdentityPopupView extends AbstractViewNext {
|
||||||
this.submitError = ko.observable('');
|
this.submitError = ko.observable('');
|
||||||
|
|
||||||
this.bcc.subscribe((value) => {
|
this.bcc.subscribe((value) => {
|
||||||
if (false === this.showBcc() && 0 < value.length) {
|
if (false === this.showBcc() && value.length) {
|
||||||
this.showBcc(true);
|
this.showBcc(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.replyTo.subscribe((value) => {
|
this.replyTo.subscribe((value) => {
|
||||||
if (false === this.showReplyTo() && 0 < value.length) {
|
if (false === this.showReplyTo() && value.length) {
|
||||||
this.showReplyTo(true);
|
this.showReplyTo(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -163,9 +163,8 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.isIncompleteChecked = ko.computed(() => {
|
this.isIncompleteChecked = ko.computed(() => {
|
||||||
const m = MessageStore.messageList().length,
|
const c = MessageStore.messageListChecked().length;
|
||||||
c = MessageStore.messageListChecked().length;
|
return c && MessageStore.messageList().length > c;
|
||||||
return 0 < m && 0 < c && m > c;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.hasMessages = ko.computed(() => 0 < this.messageList().length);
|
this.hasMessages = ko.computed(() => 0 < this.messageList().length);
|
||||||
|
|
@ -209,13 +208,11 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
);
|
);
|
||||||
|
|
||||||
this.mobileCheckedStateShow = ko.computed(() => {
|
this.mobileCheckedStateShow = ko.computed(() => {
|
||||||
const checked = 0 < this.messageListChecked().length;
|
return this.mobile ? 0 < this.messageListChecked().length : true;
|
||||||
return this.mobile ? checked : true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mobileCheckedStateHide = ko.computed(() => {
|
this.mobileCheckedStateHide = ko.computed(() => {
|
||||||
const checked = 0 < this.messageListChecked().length;
|
return this.mobile ? !this.messageListChecked().length : true;
|
||||||
return this.mobile ? !checked : true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.messageListFocused = ko.computed(() => Focused.MessageList === AppStore.focusedState());
|
this.messageListFocused = ko.computed(() => Focused.MessageList === AppStore.focusedState());
|
||||||
|
|
@ -399,7 +396,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
goToUpUpOrDownDown(up) {
|
goToUpUpOrDownDown(up) {
|
||||||
if (0 < this.messageListChecked().length) {
|
if (this.messageListChecked().length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -652,7 +649,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
const checked = this.messageListCheckedOrSelected();
|
const checked = this.messageListCheckedOrSelected();
|
||||||
if (currentMessage) {
|
if (currentMessage) {
|
||||||
const checkedUids = checked.map(message => message.uid);
|
const checkedUids = checked.map(message => message.uid);
|
||||||
if (0 < checkedUids.length && checkedUids.includes(currentMessage.uid)) {
|
if (checkedUids.includes(currentMessage.uid)) {
|
||||||
this.setAction(
|
this.setAction(
|
||||||
currentMessage.folderFullNameRaw,
|
currentMessage.folderFullNameRaw,
|
||||||
currentMessage.flagged() ? MessageSetAction.UnsetFlag : MessageSetAction.SetFlag,
|
currentMessage.flagged() ? MessageSetAction.UnsetFlag : MessageSetAction.SetFlag,
|
||||||
|
|
@ -670,7 +667,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
|
|
||||||
flagMessagesFast(bFlag) {
|
flagMessagesFast(bFlag) {
|
||||||
const checked = this.messageListCheckedOrSelected();
|
const checked = this.messageListCheckedOrSelected();
|
||||||
if (0 < checked.length) {
|
if (checked.length) {
|
||||||
if (isUnd(bFlag)) {
|
if (isUnd(bFlag)) {
|
||||||
const flagged = checked.filter(message => message.flagged());
|
const flagged = checked.filter(message => message.flagged());
|
||||||
this.setAction(
|
this.setAction(
|
||||||
|
|
@ -690,12 +687,12 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
|
|
||||||
seenMessagesFast(seen) {
|
seenMessagesFast(seen) {
|
||||||
const checked = this.messageListCheckedOrSelected();
|
const checked = this.messageListCheckedOrSelected();
|
||||||
if (0 < checked.length) {
|
if (checked.length) {
|
||||||
if (isUnd(seen)) {
|
if (isUnd(seen)) {
|
||||||
const unseen = checked.filter(message => message.unseen());
|
const unseen = checked.filter(message => message.unseen());
|
||||||
this.setAction(
|
this.setAction(
|
||||||
checked[0].folderFullNameRaw,
|
checked[0].folderFullNameRaw,
|
||||||
0 < unseen.length ? MessageSetAction.SetSeen : MessageSetAction.UnsetSeen,
|
unseen.length ? MessageSetAction.SetSeen : MessageSetAction.UnsetSeen,
|
||||||
checked
|
checked
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -734,7 +731,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
'' === this.messageListSearchDesc() &&
|
'' === this.messageListSearchDesc() &&
|
||||||
'' === this.messageListError() &&
|
'' === this.messageListError() &&
|
||||||
'' === this.messageListEndThreadUid() &&
|
'' === this.messageListEndThreadUid() &&
|
||||||
0 < this.messageList().length &&
|
this.messageList().length &&
|
||||||
(this.isSpamFolder() || this.isTrashFolder())
|
(this.isSpamFolder() || this.isTrashFolder())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -811,7 +808,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
// delete
|
// delete
|
||||||
key('delete, shift+delete, shift+3', KeyState.MessageList, (event, handler) => {
|
key('delete, shift+delete, shift+3', KeyState.MessageList, (event, handler) => {
|
||||||
if (event) {
|
if (event) {
|
||||||
if (0 < MessageStore.messageListCheckedOrSelected().length) {
|
if (MessageStore.messageListCheckedOrSelected().length) {
|
||||||
if (handler && 'shift+delete' === handler.shortcut) {
|
if (handler && 'shift+delete' === handler.shortcut) {
|
||||||
this.deleteWithoutMoveCommand();
|
this.deleteWithoutMoveCommand();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.allowAttachmnetControls = ko.computed(
|
this.allowAttachmnetControls = ko.computed(
|
||||||
() => 0 < this.attachmentsActions().length && Settings.capa(Capa.AttachmentsActions)
|
() => this.attachmentsActions().length && Settings.capa(Capa.AttachmentsActions)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.downloadAsZipAllowed = ko.computed(
|
this.downloadAsZipAllowed = ko.computed(
|
||||||
|
|
@ -496,7 +496,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
||||||
return null;
|
return null;
|
||||||
}).filter(value => !!value);
|
}).filter(value => !!value);
|
||||||
|
|
||||||
if (0 < dynamicEls.length) {
|
if (dynamicEls.length) {
|
||||||
div.on('onBeforeOpen.lg', () => {
|
div.on('onBeforeOpen.lg', () => {
|
||||||
useKeyboardShortcuts(false);
|
useKeyboardShortcuts(false);
|
||||||
removeInFocus(true);
|
removeInFocus(true);
|
||||||
|
|
@ -888,7 +888,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
||||||
|
|
||||||
downloadAsZip() {
|
downloadAsZip() {
|
||||||
const hashes = this.getAttachmentsHashes();
|
const hashes = this.getAttachmentsHashes();
|
||||||
if (0 < hashes.length) {
|
if (hashes.length) {
|
||||||
Promises.attachmentsActions('Zip', hashes, this.downloadAsZipLoading)
|
Promises.attachmentsActions('Zip', hashes, this.downloadAsZipLoading)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result && result.Result && result.Result.Files && result.Result.Files[0] && result.Result.Files[0].Hash) {
|
if (result && result.Result && result.Result.Files && result.Result.Files[0] && result.Result.Files[0].Hash) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue