diff --git a/dev/App/User.js b/dev/App/User.js index ab7fe5868..ed016196d 100644 --- a/dev/App/User.js +++ b/dev/App/User.js @@ -520,8 +520,8 @@ class AppUser extends AbstractApp { if ( !iError && 1 < arrayLength(data.Result) && - isPosNumeric(data.Result[0], true) && - isPosNumeric(data.Result[1], true) + isPosNumeric(data.Result[0]) && + isPosNumeric(data.Result[1]) ) { QuotaUserStore.populateData(pInt(data.Result[1]), pInt(data.Result[0])); } diff --git a/dev/Common/UtilsUser.js b/dev/Common/UtilsUser.js index 93fed0663..151e73939 100644 --- a/dev/Common/UtilsUser.js +++ b/dev/Common/UtilsUser.js @@ -9,8 +9,8 @@ import { createElement } from 'Common/Globals'; * @param {boolean=} includeZero = true * @returns {boolean} */ -export function isPosNumeric(value, includeZero = true) { - return null != value && (includeZero ? /^[0-9]*$/ : /^[1-9]+[0-9]*$/).test(value.toString()); +export function isPosNumeric(value) { + return null != value && /^[0-9]*$/.test(value.toString()); } /** @@ -395,13 +395,13 @@ export function computedPaginatorHelper(koCurrentPage, koPageCount) { if (3 === prev) { fAdd(2, false); } else if (3 < prev) { - fAdd(Math.round((prev - 1) / 2), false, '...'); + fAdd(Math.round((prev - 1) / 2), false, '…'); } if (pageCount - 2 === next) { fAdd(pageCount - 1, true); } else if (pageCount - 2 > next) { - fAdd(Math.round((pageCount + next) / 2), true, '...'); + fAdd(Math.round((pageCount + next) / 2), true, '…'); } // first and last @@ -434,22 +434,20 @@ export function mailToHelper(mailToUrl) { mailToUrl = mailToUrl.toString().substr(7); let to = [], - cc = null, - bcc = null, params = {}; const email = mailToUrl.replace(/\?.+$/, ''), - query = mailToUrl.replace(/^[^?]*\?/, ''); + query = mailToUrl.replace(/^[^?]*\?/, ''), + toEmailModel = value => null != value ? EmailModel.parseEmailLine(decodeURIComponent(value)) : null; query.split('&').forEach(temp => { temp = temp.split('='); params[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]); }); - if (undefined !== params.to) { - to = EmailModel.parseEmailLine(decodeURIComponent(email + ',' + params.to)); + if (null != params.to) { to = Object.values( - to.reduce((result, value) => { + toEmailModel(email + ',' + params.to).reduce((result, value) => { if (value) { if (result[value.email]) { if (!result[value.email].name) { @@ -466,20 +464,12 @@ export function mailToHelper(mailToUrl) { to = EmailModel.parseEmailLine(email); } - if (undefined !== params.cc) { - cc = EmailModel.parseEmailLine(decodeURIComponent(params.cc)); - } - - if (undefined !== params.bcc) { - bcc = EmailModel.parseEmailLine(decodeURIComponent(params.bcc)); - } - showMessageComposer([ ComposeType.Empty, null, to, - cc, - bcc, + toEmailModel(params.cc), + toEmailModel(params.bcc), null == params.subject ? null : decodeURIComponent(params.subject), null == params.body ? null : plainToHtml(decodeURIComponent(params.body)) ]); diff --git a/dev/Model/FolderCollection.js b/dev/Model/FolderCollection.js index b781bbc0f..b04ce4f45 100644 --- a/dev/Model/FolderCollection.js +++ b/dev/Model/FolderCollection.js @@ -226,7 +226,7 @@ export class FolderModel extends AbstractModel { folder.messageCountAll = ko.computed({ read: folder.privateMessageCountAll, write: (iValue) => { - if (isPosNumeric(iValue, true)) { + if (isPosNumeric(iValue)) { folder.privateMessageCountAll(iValue); } else { folder.privateMessageCountAll.valueHasMutated(); @@ -238,7 +238,7 @@ export class FolderModel extends AbstractModel { folder.messageCountUnread = ko.computed({ read: folder.privateMessageCountUnread, write: (value) => { - if (isPosNumeric(value, true)) { + if (isPosNumeric(value)) { folder.privateMessageCountUnread(value); } else { folder.privateMessageCountUnread.valueHasMutated(); @@ -371,6 +371,6 @@ export class FolderModel extends AbstractModel { * @returns {string} */ printableFullName() { - return this.fullName.split(this.delimiter).join(' / '); + return this.fullName.replace(this.delimiter, ' / '); } }