JavaScript string compare '' is always a ToBoolean

See https://www.ecma-international.org/ecma-262/5.1/#sec-9.2
This commit is contained in:
djmaze 2020-07-28 17:20:14 +02:00
parent 82bed1ed80
commit 2ba34532c2
57 changed files with 213 additions and 218 deletions

View file

@ -61,23 +61,23 @@ Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyf
|js/* |1.14.0 |native |
|----------- |--------: |--------: |
|admin.js |2.130.942 |1.359.501 |
|app.js |4.184.455 |3.121.743 |
|admin.js |2.130.942 |1.356.246 |
|app.js |4.184.455 |3.117.728 |
|boot.js | 671.522 | 109.651 |
|libs.js | 647.614 | 508.324 |
|polyfills.js | 325.834 | 0 |
|TOTAL js |7.960.367 |5.097.142 |
|TOTAL js |7.960.367 |5.091.949 |
|js/min/* |1.14.0 |native |
|----------- |--------: |--------: |
|admin.js | 252.147 | 177.094 |
|app.js | 511.202 | 409.173 |
|boot.js | 66.007 | 13.380 |
|libs.js | 572.545 | 465.247 |
|polyfills.js | 32.452 | 0 |
|TOTAL js/min |1.434.353 |1.064.753 |
|js/min/* |1.14.0 |native |
|--------------- |--------: |--------: |
|admin.min.js | 252.147 | 176.702 |
|app.min.js | 511.202 | 408.359 |
|boot.min.js | 66.007 | 13.380 |
|libs.min.js | 572.545 | 465.247 |
|polyfills.min.js | 32.452 | 0 |
|TOTAL js/min |1.434.353 |1.063.688 |
369.600 bytes is not much, but it feels faster.
370.665 bytes is not much, but it feels faster.
### PHP73 branch

View file

@ -581,9 +581,7 @@ class AppUser extends AbstractApp {
if (StorageResultType.Success === sResult && oData.Result) {
const counts = {},
sAccountEmail = AccountStore.email();
let parentEmail = Settings.settingsGet('ParentEmail');
parentEmail = '' === parentEmail ? sAccountEmail : parentEmail;
let parentEmail = Settings.settingsGet('ParentEmail') || sAccountEmail;
if (isArray(oData.Result.Accounts)) {
AccountStore.accounts().forEach(oAccount => {
@ -667,7 +665,7 @@ class AppUser extends AbstractApp {
* @param {Array=} list = []
*/
folderInformation(folder, list) {
if ('' !== trim(folder)) {
if (trim(folder)) {
Remote.folderInformation(
(result, data) => {
if (StorageResultType.Success === result) {
@ -727,7 +725,7 @@ class AppUser extends AbstractApp {
);
const hash = getFolderHash(data.Result.Folder);
if (data.Result.Hash !== hash || '' === hash || unreadCountChange) {
if (!hash || unreadCountChange || data.Result.Hash !== hash) {
if (folderFromCache.fullNameRaw === FolderStore.currentFolderFullNameRaw()) {
this.reloadMessageList();
} else if (getFolderInboxName() === folderFromCache.fullNameRaw) {
@ -782,7 +780,7 @@ class AppUser extends AbstractApp {
clearMessageFlagsFromCacheByFolder(folder.fullNameRaw);
}
if (item.Hash !== hash || '' === hash) {
if (!hash || item.Hash !== hash) {
if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw()) {
this.reloadMessageList();
}
@ -823,7 +821,7 @@ class AppUser extends AbstractApp {
rootUids = messages.map(oMessage => oMessage && oMessage.uid ? oMessage.uid : null)
.filter((value, index, self) => !!value && self.indexOf(value) == index);
if ('' !== sFolderFullNameRaw && rootUids.length) {
if (sFolderFullNameRaw && rootUids.length) {
switch (iSetAction) {
case MessageSetAction.SetSeen:
rootUids.forEach(sSubUid => {
@ -1083,7 +1081,7 @@ class AppUser extends AbstractApp {
this.bootend();
if (value) {
if ('' !== startupUrl) {
if (startupUrl) {
routeOff();
setHash(root(startupUrl), true);
routeOn();

View file

@ -19,9 +19,9 @@ class Audio {
this.supported = !bMobileDevice && !bSafari && !!this.player && !!this.player.play;
if (this.supported && this.player && this.player.canPlayType) {
this.supportedMp3 = '' !== this.player.canPlayType('audio/mpeg;').replace(/no/, '');
this.supportedWav = '' !== this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, '');
this.supportedOgg = '' !== this.player.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, '');
this.supportedMp3 = !!this.player.canPlayType('audio/mpeg;').replace(/no/, '');
this.supportedWav = !!this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, '');
this.supportedOgg = !!this.player.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, '');
this.supportedNotification = this.supported && this.supportedMp3;
}
@ -81,7 +81,7 @@ class Audio {
name = trim(name.substr(0, name.length - 4));
}
return '' === name ? 'audio' : name;
return name || 'audio';
}
playMp3(url, name) {

View file

@ -89,7 +89,7 @@ export function clearNewMessageCache() {
* @returns {string}
*/
export function getFolderInboxName() {
return '' === inboxFolderName ? 'INBOX' : inboxFolderName;
return inboxFolderName || 'INBOX';
}
/**
@ -97,7 +97,7 @@ export function getFolderInboxName() {
* @returns {string}
*/
export function getFolderFullNameRaw(folderHash) {
return '' !== folderHash && FOLDERS_NAME_CACHE[folderHash] ? FOLDERS_NAME_CACHE[folderHash] : '';
return folderHash && FOLDERS_NAME_CACHE[folderHash] ? FOLDERS_NAME_CACHE[folderHash] : '';
}
/**
@ -106,7 +106,7 @@ export function getFolderFullNameRaw(folderHash) {
*/
export function setFolderFullNameRaw(folderHash, folderFullNameRaw) {
FOLDERS_NAME_CACHE[folderHash] = folderFullNameRaw;
if ('INBOX' === folderFullNameRaw || '' === inboxFolderName) {
if (!inboxFolderName || 'INBOX' === folderFullNameRaw) {
inboxFolderName = folderFullNameRaw;
}
}
@ -116,7 +116,7 @@ export function setFolderFullNameRaw(folderHash, folderFullNameRaw) {
* @returns {string}
*/
export function getFolderHash(folderFullNameRaw) {
return '' !== folderFullNameRaw && FOLDERS_HASH_CACHE[folderFullNameRaw] ? FOLDERS_HASH_CACHE[folderFullNameRaw] : '';
return folderFullNameRaw && FOLDERS_HASH_CACHE[folderFullNameRaw] ? FOLDERS_HASH_CACHE[folderFullNameRaw] : '';
}
/**
@ -124,7 +124,7 @@ export function getFolderHash(folderFullNameRaw) {
* @param {string} folderHash
*/
export function setFolderHash(folderFullNameRaw, folderHash) {
if ('' !== folderFullNameRaw) {
if (folderFullNameRaw) {
FOLDERS_HASH_CACHE[folderFullNameRaw] = folderHash;
}
}
@ -134,7 +134,7 @@ export function setFolderHash(folderFullNameRaw, folderHash) {
* @returns {string}
*/
export function getFolderUidNext(folderFullNameRaw) {
return '' !== folderFullNameRaw && FOLDERS_UID_NEXT_CACHE[folderFullNameRaw]
return folderFullNameRaw && FOLDERS_UID_NEXT_CACHE[folderFullNameRaw]
? FOLDERS_UID_NEXT_CACHE[folderFullNameRaw]
: '';
}
@ -152,7 +152,7 @@ export function setFolderUidNext(folderFullNameRaw, uidNext) {
* @returns {?FolderModel}
*/
export function getFolderFromCacheList(folderFullNameRaw) {
return '' !== folderFullNameRaw && FOLDERS_CACHE[folderFullNameRaw] ? FOLDERS_CACHE[folderFullNameRaw] : null;
return folderFullNameRaw && FOLDERS_CACHE[folderFullNameRaw] ? FOLDERS_CACHE[folderFullNameRaw] : null;
}
/**

View file

@ -371,7 +371,7 @@ export function mailBox(folder, page = 1, search = '', threadUid = '') {
let result = HASH_PREFIX + 'mailbox/';
if ('' !== folder) {
if (folder) {
const resultThreadUid = pInt(threadUid);
result += window.encodeURI(folder) + (0 < resultThreadUid ? '~' + resultThreadUid : '');
}
@ -381,7 +381,7 @@ export function mailBox(folder, page = 1, search = '', threadUid = '') {
result += '/p' + page;
}
if ('' !== search) {
if (search) {
result = result.replace(/[/]+$/, '');
result += '/' + window.encodeURI(search);
}

View file

@ -561,7 +561,7 @@ class Selector {
const uid = this.getItemUid(item);
if (event && event.shiftKey) {
if ('' !== uid && '' !== this.sLastUid && uid !== this.sLastUid) {
if (uid && this.sLastUid && uid !== this.sLastUid) {
list = this.list();
checked = item.checked();
@ -585,7 +585,7 @@ class Selector {
}
}
this.sLastUid = '' === uid ? '' : uid;
this.sLastUid = uid || '';
}
/**
@ -598,7 +598,7 @@ class Selector {
if (event) {
if (event.shiftKey && !(event.ctrlKey || event.metaKey) && !event.altKey) {
click = false;
if ('' === this.sLastUid) {
if (!this.sLastUid) {
this.sLastUid = this.getItemUid(item);
}

View file

@ -68,7 +68,7 @@ export function isPosNumeric(value, includeZero = true) {
* @returns {number}
*/
export function pInt(value, defaultValur = 0) {
const result = isNormal(value) && '' !== value ? window.parseInt(value, 10) : defaultValur;
const result = isNormal(value) && value ? window.parseInt(value, 10) : defaultValur;
return window.isNaN(result) ? defaultValur : result;
}
@ -309,7 +309,7 @@ export function replySubjectAdd(prefix, subject) {
const parts = [],
prefixIsRe = !fwd;
if ('' !== subject) {
if (subject) {
subject.split(':').forEach(part => {
const trimmedPart = trim(part);
if (!drop && (/^(RE|FWD)$/i.test(trimmedPart) || /^(RE|FWD)[[(][\d]+[\])]$/i.test(trimmedPart))) {
@ -814,7 +814,7 @@ export function plainToHtml(plain, findEmailAndLinksInText = false) {
aNextText.push('~~~blockquote~~~');
aNextText.push(sLine.substr(1));
} else if (!bStart && bIn) {
if ('' !== sLine) {
if (sLine) {
bIn = false;
aNextText.push('~~~/blockquote~~~');
aNextText.push(sLine);
@ -1191,9 +1191,9 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount) {
fAdd = (index, push = true, customName = '') => {
const data = {
current: index === currentPage,
name: '' === customName ? index.toString() : customName.toString(),
custom: '' !== customName,
title: '' === customName ? '' : index.toString(),
name: customName ? customName.toString() : index.toString(),
custom: !!customName,
title: customName ? index.toString() : '',
value: index.toString()
};

20
dev/External/ko.js vendored
View file

@ -160,12 +160,12 @@ ko.bindingHandlers.tooltip = {
}
});
if ('' === sValue) {
if (sValue) {
element.__opentip.activate();
} else {
element.__opentip.hide();
element.__opentip.deactivate();
element.__opentip.setContent('');
} else {
element.__opentip.activate();
}
if (isI18N) {
@ -245,11 +245,7 @@ ko.bindingHandlers.tooltipErrorTip = {
openTips = element.__opentip;
if (openTips) {
if ('' === value) {
openTips.hide();
openTips.deactivate();
openTips.setContent('');
} else {
if (value) {
setTimeout(() => {
if ($el.is(':visible')) {
openTips.setContent(value);
@ -261,6 +257,10 @@ ko.bindingHandlers.tooltipErrorTip = {
openTips.setContent('');
}
}, Magics.Time100ms);
} else {
openTips.hide();
openTips.deactivate();
openTips.setContent('');
}
}
}
@ -1087,7 +1087,7 @@ ko.observable.fn.validateEmail = function() {
this.hasError = ko.observable(false);
this.subscribe((value) => {
this.hasError('' !== value && !/^[^@\s]+@[^@\s]+$/.test(value));
this.hasError(value && !/^[^@\s]+@[^@\s]+$/.test(value));
});
this.valueHasMutated();
@ -1098,7 +1098,7 @@ ko.observable.fn.validateSimpleEmail = function() {
this.hasError = ko.observable(false);
this.subscribe((value) => {
this.hasError('' !== value && !/^.+@.+$/.test(value));
this.hasError(value && !/^.+@.+$/.test(value));
});
this.valueHasMutated();

View file

@ -24,7 +24,7 @@ export function emailArrayToStringClear(emails) {
const result = [];
if (isNonEmptyArray(emails)) {
emails.forEach(email => {
if (email && email.email && '' !== email.name) {
if (email && email.email && email.name) {
result.push(email.email);
}
});

View file

@ -95,7 +95,7 @@ export function routeOn() {
* @returns {?Object}
*/
export function screen(screenName) {
return '' !== screenName && !isUnd(SCREENS[screenName]) ? SCREENS[screenName] : null;
return screenName && !isUnd(SCREENS[screenName]) ? SCREENS[screenName] : null;
}
/**
@ -288,11 +288,11 @@ export function screenOnRoute(screenName, subPart) {
isSameScreen = false,
cross = null;
if ('' === pString(screenName)) {
if (!pString(screenName)) {
screenName = defaultScreenName;
}
if ('' !== screenName) {
if (screenName) {
vmScreen = screen(screenName);
if (!vmScreen) {
vmScreen = screen(defaultScreenName);
@ -404,8 +404,8 @@ export function startScreens(screensClasses) {
const vmScreen = new CScreen(),
screenName = vmScreen ? vmScreen.screenName() : '';
if (vmScreen && '' !== screenName) {
if ('' === defaultScreenName) {
if (vmScreen && screenName) {
if (!defaultScreenName) {
defaultScreenName = screenName;
}

View file

@ -361,7 +361,7 @@ class AttachmentModel extends AbstractModel {
*/
linkThumbnailPreviewStyle() {
const link = this.linkThumbnail();
return '' === link ? '' : 'background:url(' + link + ')';
return link ? 'background:url(' + link + ')' : '';
}
/**

View file

@ -46,8 +46,7 @@ class ComposeAttachmentModel extends AbstractModel {
});
this.title = ko.computed(() => {
const error = this.error();
return '' !== error ? error : this.fileName();
return this.error() || this.fileName();
});
this.friendlySize = ko.computed(() => {

View file

@ -35,14 +35,14 @@ class ContactModel extends AbstractModel {
name = trim(property[1] + ' ' + name);
} else if (ContactPropertyType.LastName === property[0]) {
name = trim(name + ' ' + property[1]);
} else if ('' === email && ContactPropertyType.Email === property[0]) {
} else if (!email && ContactPropertyType.Email === property[0]) {
email = property[1];
}
}
});
}
return '' === email ? null : [email, name];
return email ? [email, name] : null;
}
/**

View file

@ -47,7 +47,7 @@ class EmailModel {
* @returns {boolean}
*/
validate() {
return '' !== this.name || '' !== this.email;
return this.name || this.email;
}
/**
@ -87,7 +87,7 @@ class EmailModel {
this.dkimStatus = trim(json.DkimStatus || '');
this.dkimValue = trim(json.DkimValue || '');
result = '' !== this.email;
result = !!this.email;
this.clearDuplicateName();
}
@ -102,8 +102,8 @@ class EmailModel {
*/
toLine(friendlyView, wrapWithLink = false, useEncodeHtml = false) {
let result = '';
if ('' !== this.email) {
if (friendlyView && '' !== this.name) {
if (this.email) {
if (friendlyView && this.name) {
result = wrapWithLink
? '<a href="mailto:' +
encodeHtml(this.email) +
@ -119,7 +119,7 @@ class EmailModel {
// '" target="_blank" tabindex="-1">' + encodeHtml(this.name) + '</a>' : (useEncodeHtml ? encodeHtml(this.name) : this.name);
} else {
result = this.email;
if ('' !== this.name) {
if (this.name) {
if (wrapWithLink) {
result =
encodeHtml('"' + this.name + '" <') +
@ -197,7 +197,7 @@ class EmailModel {
*/
parse(emailAddress) {
emailAddress = trim(emailAddress);
if ('' === emailAddress) {
if (!emailAddress) {
return false;
}

View file

@ -118,13 +118,13 @@ class FilterModel extends AbstractModel {
this.regDisposables(
this.name.subscribe((sValue) => {
this.name.error('' === sValue);
this.name.error(!sValue);
})
);
this.regDisposables(
this.actionValue.subscribe((sValue) => {
this.actionValue.error('' === sValue);
this.actionValue.error(!sValue);
})
);
@ -139,7 +139,7 @@ class FilterModel extends AbstractModel {
}
verify() {
if ('' === this.name()) {
if (!this.name()) {
this.name.error(true);
return false;
}
@ -150,7 +150,7 @@ class FilterModel extends AbstractModel {
}
}
if ('' === this.actionValue()) {
if (!this.actionValue()) {
if ([
FiltersAction.MoveTo,
FiltersAction.Forward,
@ -170,7 +170,7 @@ class FilterModel extends AbstractModel {
if (
FiltersAction.Vacation === this.actionType() &&
'' !== this.actionValueFourth() &&
this.actionValueFourth() &&
!this.actionValueFourth().includes('@')
) {
this.actionValueFourth.error(true);

View file

@ -43,12 +43,12 @@ class FilterConditionModel extends AbstractModel {
}
verify() {
if ('' === this.value()) {
if (!this.value()) {
this.value.error(true);
return false;
}
if (FilterConditionField.Header === this.field() && '' === this.valueSecond()) {
if (FilterConditionField.Header === this.field() && !this.valueSecond()) {
this.valueSecond.error(true);
return false;
}

View file

@ -210,7 +210,7 @@ class FolderModel extends AbstractModel {
}
}
if (('' !== suffix && '(' + name + ')' === suffix) || '(inbox)' === suffix.toLowerCase()) {
if ((suffix && '(' + name + ')' === suffix) || '(inbox)' === suffix.toLowerCase()) {
suffix = '';
}
@ -224,7 +224,7 @@ class FolderModel extends AbstractModel {
}
});
this.hasUnreadMessages = ko.computed(() => 0 < this.messageCountUnread() && '' !== this.printableUnreadCount());
this.hasUnreadMessages = ko.computed(() => 0 < this.messageCountUnread() && this.printableUnreadCount());
this.hasSubScribedUnreadMessagesSubfolders = ko.computed(
() =>

View file

@ -21,7 +21,7 @@ class IdentityModel extends AbstractModel {
this.signatureInsertBefore = ko.observable(false);
this.deleteAccess = ko.observable(false);
this.canBeDeleted = ko.computed(() => '' !== this.id());
this.canBeDeleted = ko.computed(() => !!this.id());
}
/**
@ -31,7 +31,7 @@ class IdentityModel extends AbstractModel {
const name = this.name(),
email = this.email();
return '' !== name ? name + ' (' + email + ')' : email;
return name ? name + ' (' + email + ')' : email;
}
}

View file

@ -353,7 +353,7 @@ class MessageModel extends AbstractModel {
attachment = AttachmentModel.newInstanceFromJson(json['@Collection'][index]);
if (attachment) {
if (
'' !== attachment.cidWithOutTags &&
attachment.cidWithOutTags &&
this.foundedCIDs.includes(attachment.cidWithOutTags)
) {
attachment.isLinked = true;
@ -475,7 +475,7 @@ class MessageModel extends AbstractModel {
'important': this.isImportant(),
'withAttachments': this.hasAttachments(),
'new': this.newForAnimation(),
'emptySubject': '' === this.subject(),
'emptySubject': !this.subject(),
// 'hasChildrenMessage': 1 < this.threadsLen(),
'hasUnseenSubMessage': this.hasUnseenSubMessage(),
'hasFlaggedSubMessage': this.hasFlaggedSubMessage()
@ -783,7 +783,7 @@ class MessageModel extends AbstractModel {
$('[' + attr + ']', this.body).each(function() {
const $this = $(this); // eslint-disable-line no-invalid-this
let style = trim($this.attr('style'));
style = '' === style ? '' : ';' === style.substr(-1) ? style + ' ' : style + '; ';
style = style ? (';' === style.substr(-1) ? style + ' ' : style + '; ') : '';
$this.attr('style', style + $this.attr(attr));
});
@ -840,9 +840,9 @@ class MessageModel extends AbstractModel {
if (attachment && attachment.linkPreview) {
name = $this.attr('data-x-style-cid-name');
if ('' !== name) {
if (name) {
style = trim($this.attr('style'));
style = '' === style ? '' : ';' === style.substr(-1) ? style + ' ' : style + '; ';
style = style ? (';' === style.substr(-1) ? style + ' ' : style + '; ') : '';
$this.attr('style', style + name + ": url('" + attachment.linkPreview() + "')");
}
}

View file

@ -29,7 +29,7 @@ class PromisesUserPopulator extends AbstractBasicPromises {
* @returns {string}
*/
normalizeFolder(sFolderFullNameRaw) {
return '' === sFolderFullNameRaw ||
return !sFolderFullNameRaw ||
UNUSED_OPTION_VALUE === sFolderFullNameRaw ||
null !== Cache.getFolderFromCacheList(sFolderFullNameRaw)
? sFolderFullNameRaw
@ -144,14 +144,13 @@ class PromisesUserPopulator extends AbstractBasicPromises {
if (
oData.SystemFolders &&
'' ===
'' +
!('' +
Settings.settingsGet('SentFolder') +
Settings.settingsGet('DraftFolder') +
Settings.settingsGet('SpamFolder') +
Settings.settingsGet('TrashFolder') +
Settings.settingsGet('ArchiveFolder') +
Settings.settingsGet('NullFolder')
Settings.settingsGet('NullFolder'))
) {
Settings.settingsSet('SentFolder', oData.SystemFolders[ServerFolderType.SENT] || null);
Settings.settingsSet('DraftFolder', oData.SystemFolders[ServerFolderType.DRAFTS] || null);

View file

@ -134,7 +134,7 @@ if (err) {
*/
ajaxRequest(fResultCallback, params, iTimeOut = 20000, sGetAdd = '', abortActions = []) {
params = params || {};
const isPost = '' === sGetAdd,
const isPost = !sGetAdd,
start = new window.Date().getTime(),
action = params.Action || '';

View file

@ -313,12 +313,12 @@ class RemoteUserAjax extends AbstractAjaxRemote {
useThreads = AppStore.threadsAllowed() && SettingsStore.useThreads(),
inboxUidNext = getFolderInboxName() === sFolderFullNameRaw ? getFolderUidNext(sFolderFullNameRaw) : '';
if ('' !== folderHash && ('' === sSearch || !sSearch.includes('is:'))) {
if (folderHash && (!sSearch || !sSearch.includes('is:'))) {
return this.defaultRequest(
fCallback,
'MessageList',
{},
'' === sSearch ? DEFAULT_AJAX_TIMEOUT : SEARCH_AJAX_TIMEOUT,
sSearch ? SEARCH_AJAX_TIMEOUT : DEFAULT_AJAX_TIMEOUT,
'MessageList/' +
subQueryPrefix() +
'/' +
@ -351,7 +351,7 @@ class RemoteUserAjax extends AbstractAjaxRemote {
UseThreads: useThreads ? '1' : '0',
ThreadUid: useThreads ? sThreadUid : ''
},
'' === sSearch ? DEFAULT_AJAX_TIMEOUT : SEARCH_AJAX_TIMEOUT,
sSearch ? SEARCH_AJAX_TIMEOUT : DEFAULT_AJAX_TIMEOUT,
'',
bSilent ? [] : ['MessageList']
);

View file

@ -48,10 +48,10 @@ class MailBoxUserScreen extends AbstractScreen {
}
getApp().setWindowTitle(
('' === email
? ''
: '' + (0 < foldersInboxUnreadCount ? '(' + foldersInboxUnreadCount + ') ' : ' ') + email + ' - ') +
i18n('TITLES/MAILBOX')
(email
? '' + (0 < foldersInboxUnreadCount ? '(' + foldersInboxUnreadCount + ') ' : ' ') + email + ' - '
: ''
) + i18n('TITLES/MAILBOX')
);
}
@ -152,7 +152,7 @@ class MailBoxUserScreen extends AbstractScreen {
vals[1] = 0 >= vals[1] ? 1 : vals[1];
vals[2] = pString(vals[2]);
if ('' === request) {
if (!request) {
vals[0] = inboxFolderName;
vals[1] = 1;
}
@ -163,7 +163,7 @@ class MailBoxUserScreen extends AbstractScreen {
vals[0] = pString(vals[0]);
vals[1] = pString(vals[1]);
if ('' === request) {
if (!request) {
vals[0] = inboxFolderName;
}

View file

@ -120,7 +120,7 @@ class SettingsUserScreen extends AbstractSettingsScreen {
setSettingsTitle() {
const sEmail = AccountStore.email();
getApp().setWindowTitle(('' === sEmail ? '' : sEmail + ' - ') + this.sSettingsTitle);
getApp().setWindowTitle((sEmail ? sEmail + ' - ' : '') + this.sSettingsTitle);
}
}

View file

@ -102,7 +102,7 @@ class ContactsAdminSettings {
this.onTestContactsResponse = this.onTestContactsResponse.bind(this);
}
@command((self) => '' !== self.pdoDsn() && '' !== self.pdoUser())
@command((self) => self.pdoDsn() && self.pdoUser())
testContactsCommand() {
this.testContactsSuccess(false);
this.testContactsError(false);

View file

@ -18,13 +18,13 @@ class PackagesAdminSettings {
this.packagesMainUpdatable = PackageStore.packagesMainUpdatable;
this.packagesCurrent = ko.computed(() =>
this.packages().filter(item => item && '' !== item.installed && !item.compare)
this.packages().filter(item => item && item.installed && !item.compare)
);
this.packagesAvailableForUpdate = ko.computed(() =>
this.packages().filter(item => item && '' !== item.installed && !!item.compare)
this.packages().filter(item => item && item.installed && !!item.compare)
);
this.packagesAvailableForInstallation = ko.computed(() =>
this.packages().filter(item => item && '' === item.installed)
this.packages().filter(item => item && !item.installed)
);
this.visibility = ko.computed(() => (PackageStore.packages.loading() ? 'visible' : 'hidden'));

View file

@ -78,7 +78,7 @@ class PluginsAdminSettings {
onPluginDisableRequest(result, data) {
if (StorageResultType.Success === result && data) {
if (!data.Result && data.ErrorCode) {
if (Notification.UnsupportedPluginPackage === data.ErrorCode && data.ErrorMessage && '' !== data.ErrorMessage) {
if (Notification.UnsupportedPluginPackage === data.ErrorCode && data.ErrorMessage && data.ErrorMessage) {
PluginStore.plugins.error(data.ErrorMessage);
} else {
PluginStore.plugins.error(getNotification(data.ErrorCode));

View file

@ -76,9 +76,9 @@ class SecurityAdminSettings {
this.onNewAdminPasswordResponse = this.onNewAdminPasswordResponse.bind(this);
}
@command((self) => '' !== trim(self.adminLogin()) && '' !== self.adminPassword())
@command((self) => trim(self.adminLogin()) && self.adminPassword())
saveNewAdminPasswordCommand() {
if ('' === trim(this.adminLogin())) {
if (!trim(this.adminLogin())) {
this.adminLoginError(true);
return false;
}

View file

@ -61,7 +61,7 @@ class FiltersUserSettings {
@command((self) => self.haveChanges())
saveChangesCommand() {
if (!this.filters.saving()) {
if (this.filterRaw.active() && '' === trim(this.filterRaw())) {
if (this.filterRaw.active() && !trim(this.filterRaw())) {
this.filterRaw.error(true);
return false;
}

View file

@ -44,7 +44,7 @@ class FoldersUserSettings {
folderEditOnEnter(folder) {
const nameToEdit = folder ? trim(folder.nameForEdit()) : '';
if ('' !== nameToEdit && folder.name() !== nameToEdit) {
if (nameToEdit && folder.name() !== nameToEdit) {
Local.set(ClientSideKeyName.FoldersLashHash, '');
getApp().foldersPromisesActionHelper(

View file

@ -55,7 +55,7 @@ class GeneralUserSettings {
this.identityMain = ko.computed(() => {
const list = this.identities();
return isArray(list) ? list.find(item => item && '' === item.id()) : null;
return isArray(list) ? list.find(item => item && !item.id()) : null;
});
this.identityMainDesc = ko.computed(() => {

View file

@ -16,7 +16,7 @@ class TemplatesUserSettings {
this.processText = ko.computed(() =>
TemplateStore.templates.loading() ? i18n('SETTINGS_TEMPLETS/LOADING_PROCESS') : ''
);
this.visibility = ko.computed(() => ('' === this.processText() ? 'hidden' : 'visible'));
this.visibility = ko.computed(() => this.processText() ? 'visible' : 'hidden');
this.templateForDeletion = ko.observable(null).deleteAccessHelper();
}

View file

@ -42,7 +42,7 @@ class AccountUserStore {
* @returns {boolean}
*/
isRootAccount() {
return '' === this.parentEmail();
return !this.parentEmail();
}
}

View file

@ -42,7 +42,7 @@ class FolderUserStore {
computers() {
this.draftFolderNotEnabled = ko.computed(
() => '' === this.draftFolder() || UNUSED_OPTION_VALUE === this.draftFolder()
() => !this.draftFolder() || UNUSED_OPTION_VALUE === this.draftFolder()
);
this.foldersListWithSingleInboxRootFolder = ko.computed(
@ -73,19 +73,19 @@ class FolderUserStore {
archiveFolder = this.archiveFolder();
if (isArray(folders) && folders.length) {
if ('' !== sentFolder && UNUSED_OPTION_VALUE !== sentFolder) {
if (sentFolder && UNUSED_OPTION_VALUE !== sentFolder) {
list.push(sentFolder);
}
if ('' !== draftFolder && UNUSED_OPTION_VALUE !== draftFolder) {
if (draftFolder && UNUSED_OPTION_VALUE !== draftFolder) {
list.push(draftFolder);
}
if ('' !== spamFolder && UNUSED_OPTION_VALUE !== spamFolder) {
if (spamFolder && UNUSED_OPTION_VALUE !== spamFolder) {
list.push(spamFolder);
}
if ('' !== trashFolder && UNUSED_OPTION_VALUE !== trashFolder) {
if (trashFolder && UNUSED_OPTION_VALUE !== trashFolder) {
list.push(trashFolder);
}
if ('' !== archiveFolder && UNUSED_OPTION_VALUE !== archiveFolder) {
if (archiveFolder && UNUSED_OPTION_VALUE !== archiveFolder) {
list.push(archiveFolder);
}
}

View file

@ -248,7 +248,7 @@ class MessageUserStore {
}
initUidNextAndNewMessages(folder, uidNext, newMessages) {
if (getFolderInboxName() === folder && isNormal(uidNext) && '' !== uidNext) {
if (getFolderInboxName() === folder && isNormal(uidNext) && uidNext) {
if (isArray(newMessages) && newMessages.length) {
newMessages.forEach(item => {
addNewMessageCache(folder, item.Uid);
@ -305,7 +305,7 @@ class MessageUserStore {
const trashFolder = FolderStore.trashFolder(),
spamFolder = FolderStore.spamFolder(),
fromFolder = getFolderFromCacheList(fromFolderFullNameRaw),
toFolder = '' === toFolderFullNameRaw ? null : getFolderFromCacheList(toFolderFullNameRaw || ''),
toFolder = toFolderFullNameRaw ? getFolderFromCacheList(toFolderFullNameRaw) : null,
currentFolderFullNameRaw = FolderStore.currentFolderFullNameRaw(),
messages =
currentFolderFullNameRaw === fromFolderFullNameRaw
@ -368,15 +368,15 @@ class MessageUserStore {
}
}
if ('' !== fromFolderFullNameRaw) {
if (fromFolderFullNameRaw) {
setFolderHash(fromFolderFullNameRaw, '');
}
if ('' !== toFolderFullNameRaw) {
if (toFolderFullNameRaw) {
setFolderHash(toFolderFullNameRaw, '');
}
if ('' !== this.messageListThreadUid()) {
if (this.messageListThreadUid()) {
messageList = this.messageList();
if (
@ -448,7 +448,7 @@ class MessageUserStore {
h = getRealHeight($this);
}
if ('' !== trim($this.text()) && (0 === h || 100 < h)) {
if (trim($this.text()) && (0 === h || 100 < h)) {
$this.addClass('rl-bq-switcher hidden-bq');
$('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>')
.insertBefore($this)
@ -525,10 +525,10 @@ class MessageUserStore {
const textBody = messagesDom.find('#' + id);
if (!textBody || !textBody[0]) {
let isHtml = false;
if (isNormal(data.Result.Html) && '' !== data.Result.Html) {
if (isNormal(data.Result.Html) && data.Result.Html) {
isHtml = true;
resultHtml = data.Result.Html.toString();
} else if (isNormal(data.Result.Plain) && '' !== data.Result.Plain) {
} else if (isNormal(data.Result.Plain) && data.Result.Plain) {
isHtml = false;
resultHtml = plainToHtml(data.Result.Plain.toString(), false);

View file

@ -65,8 +65,8 @@ class LoginAdminView extends AbstractViewNext {
this.loginError(false);
this.passwordError(false);
this.loginError('' === trim(this.login()));
this.passwordError('' === trim(this.password()));
this.loginError(!trim(this.login()));
this.passwordError(!trim(this.password()));
if (this.loginError() || this.passwordError()) {
return false;

View file

@ -44,8 +44,8 @@ class AccountPopupView extends AbstractViewNext {
@command((self) => !self.submitRequest())
addAccountCommand() {
this.emailError('' === trim(this.email()));
this.passwordError('' === trim(this.password()));
this.emailError(!trim(this.email()));
this.passwordError(!trim(this.password()));
if (this.emailError() || this.passwordError()) {
return false;

View file

@ -47,7 +47,7 @@ class ActivatePopupView extends AbstractViewNext {
}
@command(
(self) => !self.activateProcess() && '' !== self.domain() && '' !== self.key() && !self.activationSuccessed()
(self) => !self.activateProcess() && self.domain() && self.key() && !self.activationSuccessed()
)
activateCommand() {
this.activateProcess(true);
@ -110,7 +110,7 @@ class ActivatePopupView extends AbstractViewNext {
validateSubscriptionKey() {
const value = this.key();
return (
'' === value ||
!value ||
RAINLOOP_TRIAL_KEY === value ||
!!/^RL[\d]+-[A-Z0-9-]+Z$/.test(trim(value).replace(/[^A-Z0-9-]/gi, ''))
);

View file

@ -39,7 +39,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
keyTrimmed = keyTrimmed.replace(/[\r]+/g, '').replace(/[\n]{2,}/g, '\n\n');
}
this.key.error('' === keyTrimmed);
this.key.error(!keyTrimmed);
this.key.errorMessage('');
if (!openpgpKeyring || this.key.error()) {

View file

@ -46,7 +46,7 @@ class AdvancedSearchPopupView extends AbstractViewNext {
@command()
searchCommand() {
const search = this.buildSearchString();
if ('' !== search) {
if (search) {
MessageStore.mainMessageListSearch(search);
}
@ -87,15 +87,15 @@ class AdvancedSearchPopupView extends AbstractViewNext {
isPart = [],
hasPart = [];
if (from_ && '' !== from_) {
if (from_) {
result.push('from:' + this.buildSearchStringValue(from_));
}
if (to && '' !== to) {
if (to) {
result.push('to:' + this.buildSearchStringValue(to));
}
if (subject && '' !== subject) {
if (subject) {
result.push('subject:' + this.buildSearchStringValue(subject));
}
@ -123,7 +123,7 @@ class AdvancedSearchPopupView extends AbstractViewNext {
result.push('date:' + searchSubtractFormatDateHelper(this.selectedDateValue()) + '/');
}
if (text && '' !== text) {
if (text) {
result.push('text:' + this.buildSearchStringValue(text));
}

View file

@ -227,12 +227,12 @@ class ComposePopupView extends AbstractViewNext {
this.attachmentsInProcess = ko.computed(() => this.attachments().filter(item => item && !item.complete()));
this.attachmentsInReady = ko.computed(() => this.attachments().filter(item => item && item.complete()));
this.attachmentsInError = ko.computed(() => this.attachments().filter(item => item && '' !== item.error()));
this.attachmentsInError = ko.computed(() => this.attachments().filter(item => item && item.error()));
this.attachmentsCount = ko.computed(() => this.attachments().length);
this.attachmentsInErrorCount = ko.computed(() => this.attachmentsInError().length);
this.attachmentsInProcessCount = ko.computed(() => this.attachmentsInProcess().length);
this.isDraftFolderMessage = ko.computed(() => '' !== this.draftFolder() && '' !== this.draftUid());
this.isDraftFolderMessage = ko.computed(() => this.draftFolder() && this.draftUid());
this.attachmentsPlace = ko.observable(false);
@ -360,7 +360,7 @@ class ComposePopupView extends AbstractViewNext {
this.attachmentsPlace(true);
}
if ('' === sTo && '' === sCc && '' === sBcc) {
if (!sTo && !sCc && !sBcc) {
this.emptyToError(true);
}
@ -380,7 +380,7 @@ class ComposePopupView extends AbstractViewNext {
sSentFolder = UNUSED_OPTION_VALUE;
}
if ('' === sSentFolder) {
if (!sSentFolder) {
showScreenPopup(require('View/Popup/FolderSystem'), [SetSystemFoldersNotification.Sent]);
} else {
this.sendError(false);
@ -564,7 +564,7 @@ class ComposePopupView extends AbstractViewNext {
reloadDraftFolder() {
const draftFolder = FolderStore.draftFolder();
if ('' !== draftFolder && UNUSED_OPTION_VALUE !== draftFolder) {
if (draftFolder && UNUSED_OPTION_VALUE !== draftFolder) {
setFolderHash(draftFolder, '');
if (FolderStore.currentFolderFullNameRaw() === draftFolder) {
getApp().reloadMessageList(true);
@ -736,7 +736,7 @@ class ComposePopupView extends AbstractViewNext {
signature = signature.replace(/[\r]/g, '');
fromLine = this.oLastMessage ? this.emailArrayToStringLineHelper(this.oLastMessage.from, true) : '';
if ('' !== fromLine) {
if (fromLine) {
signature = signature.replace(/{{FROM-FULL}}/g, fromLine);
if (!fromLine.includes(' ') && 0 < fromLine.indexOf('@')) {
@ -793,7 +793,7 @@ class ComposePopupView extends AbstractViewNext {
let isHtml = false,
signature = identity.signature();
if ('' !== signature) {
if (signature) {
if (':HTML:' === signature.substr(0, 6)) {
isHtml = true;
signature = signature.substr(6);
@ -837,7 +837,7 @@ class ComposePopupView extends AbstractViewNext {
this.addEmailsTo(this.cc, aCcEmails);
this.addEmailsTo(this.bcc, aBccEmails);
if (isNormal(sCustomSubject) && '' !== sCustomSubject && '' === this.subject()) {
if (isNormal(sCustomSubject) && sCustomSubject && !this.subject()) {
this.subject(sCustomSubject);
}
}
@ -862,7 +862,7 @@ class ComposePopupView extends AbstractViewNext {
values = emails.map(item => item ? item.toLine(false) : null)
.filter((value, index, self) => !!value && self.indexOf(value) == index);
fKoValue(value + ('' === value ? '' : ', ') + trim(values.join(', ')));
fKoValue(value + (value ? ', ' : '') + trim(values.join(', ')));
}
}
@ -939,7 +939,7 @@ class ComposePopupView extends AbstractViewNext {
this.bcc(this.emailArrayToStringLineHelper(aBccEmails));
}
if ('' !== lineComposeType && message) {
if (lineComposeType && message) {
sDate = momentorFormat(message.dateTimeStampInUTC(), 'FULL');
sSubject = message.subject();
aDraftInfo = message.aDraftInfo;
@ -1171,7 +1171,7 @@ class ComposePopupView extends AbstractViewNext {
setFocusInPopup() {
if (!bMobileDevice) {
setTimeout(() => {
if ('' === this.to()) {
if (!this.to()) {
this.to.focused(true);
} else if (this.oEditor) {
if (!this.to.focused()) {
@ -1379,7 +1379,7 @@ class ComposePopupView extends AbstractViewNext {
}
if (attachment) {
if ('' !== error && error.length) {
if (error && error.length) {
attachment
.waiting(false)
.uploading(false)
@ -1413,7 +1413,7 @@ class ComposePopupView extends AbstractViewNext {
prepearAttachmentsForSendOrSave() {
const result = {};
this.attachmentsInReady().forEach(item => {
if (item && '' !== item.tempName() && item.enabled()) {
if (item && item.tempName() && item.enabled()) {
result[item.tempName()] = [item.fileName(), item.isInline ? '1' : '0', item.CID, item.contentLocation];
}
});
@ -1552,7 +1552,7 @@ class ComposePopupView extends AbstractViewNext {
!this.replyTo().length &&
!this.subject().length &&
withoutAttachment &&
(!this.oEditor || '' === this.oEditor.getData())
(!this.oEditor || !this.oEditor.getData())
);
}
@ -1606,7 +1606,7 @@ class ComposePopupView extends AbstractViewNext {
* @returns {Array}
*/
getAttachmentsDownloadsForUpload() {
return this.attachments().filter(item => item && '' === item.tempName()).map(
return this.attachments().filter(item => item && !item.tempName()).map(
item => item.id
);
}

View file

@ -345,15 +345,15 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
this.resultCallback = fCallback;
if ('' !== sTo) {
if (sTo) {
rec.push(sTo);
}
if ('' !== sCc) {
if (sCc) {
rec.push(sCc);
}
if ('' !== sBcc) {
if (sBcc) {
rec.push(sBcc);
}
@ -361,7 +361,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
rec = rec.map(value => {
email.clear();
email.parse(trim(value));
return '' === email.email ? false : email.email;
return email.email || false;
}).filter(value => !!value);
if (identity && identity.email()) {

View file

@ -116,7 +116,7 @@ class ContactsPopupView extends AbstractViewNext {
this.viewHasNonEmptyRequiredProperties = ko.computed(() => {
const names = this.viewPropertiesNames(),
emails = this.viewPropertiesEmails(),
fFilter = (property) => '' !== trim(property.value());
fFilter = (property) => !!trim(property.value());
return !!(names.find(fFilter) || emails.find(fFilter));
});
@ -126,12 +126,12 @@ class ContactsPopupView extends AbstractViewNext {
);
this.viewPropertiesEmailsNonEmpty = ko.computed(() =>
this.viewPropertiesNames().filter(property => '' !== trim(property.value()))
this.viewPropertiesNames().filter(property => !!trim(property.value()))
);
const propertyFocused = (property) => {
const focused = property.focused();
return '' === trim(property.value()) && !focused;
return !trim(property.value()) && !focused;
};
this.viewPropertiesEmailsEmptyAndOnFocused = ko.computed(() =>
@ -303,7 +303,7 @@ class ContactsPopupView extends AbstractViewNext {
properties = [];
this.viewProperties().forEach(oItem => {
if (oItem.type() && oItem.type() !== ContactPropertyType.FullName && '' !== trim(oItem.value())) {
if (oItem.type() && oItem.type() !== ContactPropertyType.FullName && trim(oItem.value())) {
properties.push([oItem.type(), oItem.value(), oItem.typeStr()]);
}
});
@ -320,7 +320,7 @@ class ContactsPopupView extends AbstractViewNext {
oData.Result.RequestUid === requestUid &&
0 < pInt(oData.Result.ResultID)
) {
if ('' === this.viewID()) {
if (!this.viewID()) {
this.viewID(pInt(oData.Result.ResultID));
}
@ -610,7 +610,7 @@ class ContactsPopupView extends AbstractViewNext {
this.contacts(list);
this.contacts.loading(false);
this.viewClearSearch('' !== this.search());
this.viewClearSearch(!!this.search());
},
offset,
CONTACTS_PER_PAGE,

View file

@ -97,10 +97,9 @@ class DomainPopupView extends AbstractViewNext {
result += ' ← ' + aliasName;
}
} else {
result =
'' === name
? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN')
: i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { 'NAME': name });
result = name
? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { 'NAME': name })
: i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN');
}
return result;
@ -117,11 +116,11 @@ class DomainPopupView extends AbstractViewNext {
useSieve = this.useSieve();
return (
'' !== this.name() &&
'' !== this.imapServer() &&
'' !== this.imapPort() &&
(allowSieve && useSieve ? '' !== this.sieveServer() && '' !== this.sievePort() : true) &&
(('' !== this.smtpServer() && '' !== this.smtpPort()) || usePhpMail)
this.name() &&
this.imapServer() &&
this.imapPort() &&
(allowSieve && useSieve ? this.sieveServer() && this.sievePort() : true) &&
((this.smtpServer() && this.smtpPort()) || usePhpMail)
);
});
@ -134,19 +133,19 @@ class DomainPopupView extends AbstractViewNext {
// smart form improvements
this.imapServerFocus.subscribe((value) => {
if (value && '' !== this.name() && '' === this.imapServer()) {
if (value && this.name() && !this.imapServer()) {
this.imapServer(this.name().replace(/[.]?[*][.]?/g, ''));
}
});
this.sieveServerFocus.subscribe((value) => {
if (value && '' !== this.imapServer() && '' === this.sieveServer()) {
if (value && this.imapServer() && !this.sieveServer()) {
this.sieveServer(this.imapServer());
}
});
this.smtpServerFocus.subscribe((value) => {
if (value && '' !== this.imapServer() && '' === this.smtpServer()) {
if (value && this.imapServer() && !this.smtpServer()) {
this.smtpServer(this.imapServer().replace(/imap/gi, 'smtp'));
}
});
@ -381,7 +380,7 @@ class DomainPopupView extends AbstractViewNext {
}
onShowWithDelay() {
if ('' === this.name() && !bMobileDevice) {
if (!this.name() && !bMobileDevice) {
this.name.focused(true);
}
}

View file

@ -35,7 +35,7 @@ class DomainAliasPopupView extends AbstractViewNext {
this.domains().map(item => ({ optValue: item.name, optText: item.name }))
);
this.canBeSaved = ko.computed(() => !this.saving() && '' !== this.name() && '' !== this.alias());
this.canBeSaved = ko.computed(() => !this.saving() && this.name() && this.alias());
this.onDomainAliasCreateOrSaveResponse = this.onDomainAliasCreateOrSaveResponse.bind(this);
}
@ -65,7 +65,7 @@ class DomainAliasPopupView extends AbstractViewNext {
}
onShowWithDelay() {
if ('' === this.name() && !bMobileDevice) {
if (!this.name() && !bMobileDevice) {
this.name.focused(true);
}
}

View file

@ -36,7 +36,7 @@ class FolderCreateView extends AbstractViewNext {
top.push(['', '']);
let fDisableCallback = null;
if ('' !== FolderStore.namespace) {
if (FolderStore.namespace) {
fDisableCallback = (item) => FolderStore.namespace !== item.fullNameRaw.substr(0, FolderStore.namespace.length);
}
@ -49,7 +49,7 @@ class FolderCreateView extends AbstractViewNext {
@command((self) => self.simpleFolderNameValidation(self.folderName()))
createFolderCommand() {
let parentFolderName = this.selectedParentValue();
if ('' === parentFolderName && 1 < FolderStore.namespace.length) {
if (!parentFolderName && 1 < FolderStore.namespace.length) {
parentFolderName = FolderStore.namespace.substr(0, FolderStore.namespace.length - 1);
}

View file

@ -62,7 +62,7 @@ class IdentityPopupView extends AbstractViewNext {
}
if (!this.email.hasError()) {
this.email.hasError('' === trim(this.email()));
this.email.hasError(!trim(this.email()));
}
if (this.email.hasError()) {
@ -151,7 +151,7 @@ class IdentityPopupView extends AbstractViewNext {
this.signature(identity.signature());
this.signatureInsertBefore(identity.signatureInsertBefore());
this.owner('' === this.id);
this.owner(!this.id);
} else {
this.id = fakeMd5();
}

View file

@ -39,13 +39,13 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
const userId = {},
openpgpKeyring = PgpStore.openpgpKeyring;
this.email.error('' === trim(this.email()));
this.email.error(!trim(this.email()));
if (!openpgpKeyring || this.email.error()) {
return false;
}
userId.email = this.email();
if ('' !== this.name()) {
if (this.name()) {
userId.name = this.name();
}

View file

@ -28,7 +28,7 @@ class PluginPopupView extends AbstractViewNext {
this.configures = ko.observableArray([]);
this.hasReadme = ko.computed(() => '' !== this.readme());
this.hasReadme = ko.computed(() => !!this.readme());
this.hasConfiguration = ko.computed(() => 0 < this.configures().length);
this.readmePopoverConf = {

View file

@ -49,8 +49,8 @@ class TemplatePopupView extends AbstractViewNext {
addTemplateCommand() {
this.populateBodyFromEditor();
this.name.error('' === trim(this.name()));
this.body.error('' === trim(this.body()) || ':HTML:' === trim(this.body()));
this.name.error(!trim(this.name()));
this.body.error(!trim(this.body()) || ':HTML:' === trim(this.body()));
if (this.name.error() || this.body.error()) {
return false;

View file

@ -25,7 +25,7 @@ class TwoFactorTestPopupView extends AbstractViewNext {
this.testing = ko.observable(false);
}
@command((self) => '' !== self.code() && !self.testing())
@command((self) => self.code() && !self.testing())
testCodeCommand() {
this.testing(true);
Remote.testTwoFactor((result, data) => {

View file

@ -115,7 +115,7 @@ class LoginUserView extends AbstractViewNext {
this.submitErrorAddidional = ko.observable('');
this.submitError.subscribe((value) => {
if ('' === value) {
if (!value) {
this.submitErrorAddidional('');
}
});
@ -154,12 +154,12 @@ class LoginUserView extends AbstractViewNext {
this.emailError(false);
this.passwordError(false);
this.emailError('' === trim(this.email()));
this.passwordError('' === trim(this.password()));
this.emailError(!trim(this.email()));
this.passwordError(!trim(this.password()));
if (this.additionalCode.visibility()) {
this.additionalCode.error(false);
this.additionalCode.error('' === trim(this.additionalCode()));
this.additionalCode.error(!trim(this.additionalCode()));
}
if (
@ -195,7 +195,7 @@ class LoginUserView extends AbstractViewNext {
if (0 < pluginResultCode) {
this.submitError(getNotification(pluginResultCode));
return false;
} else if ('' !== pluginResultMessage) {
} else if (pluginResultMessage) {
this.submitError(pluginResultMessage);
return false;
}
@ -230,7 +230,7 @@ class LoginUserView extends AbstractViewNext {
this.submitError(getNotificationFromResponse(oData));
if ('' === this.submitError()) {
if (!this.submitError()) {
this.submitError(getNotification(Notification.UnknownError));
} else if (oData.ErrorMessageAdditional) {
this.submitErrorAddidional(oData.ErrorMessageAdditional);
@ -269,11 +269,11 @@ class LoginUserView extends AbstractViewNext {
}
onShowWithDelay() {
if ('' !== this.email() && '' !== this.password()) {
if (this.email() && this.password()) {
this.passwordFocus(true);
} else if ('' === this.email()) {
} else if (!this.email()) {
this.emailFocus(true);
} else if ('' === this.password()) {
} else if (!this.password()) {
this.passwordFocus(true);
} else {
this.emailFocus(true);

View file

@ -245,7 +245,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
copy = $htmlCL.contains('rl-ctrl-key-pressed'),
uids = ui.helper.data('rl-uids');
if (isNormal(fromFolderFullNameRaw) && '' !== fromFolderFullNameRaw && isArray(uids)) {
if (fromFolderFullNameRaw && isNormal(fromFolderFullNameRaw) && isArray(uids)) {
getApp().moveMessagesToFolder(fromFolderFullNameRaw, uids, toFolder.fullNameRaw, copy);
}
}

View file

@ -135,7 +135,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
this.messageListSearchDesc = ko.computed(() => {
const value = MessageStore.messageListEndSearch();
return '' === value ? '' : i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', { 'SEARCH': value });
return value ? i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', { 'SEARCH': value }) : '';
});
this.messageListPagenator = ko.computed(
@ -172,25 +172,25 @@ class MessageListMailBoxUserView extends AbstractViewNext {
this.hasCheckedOrSelectedLines = ko.computed(() => 0 < this.messageListCheckedOrSelected().length);
this.isSpamFolder = ko.computed(
() => FolderStore.spamFolder() === this.messageListEndFolder() && '' !== FolderStore.spamFolder()
() => FolderStore.spamFolder() === this.messageListEndFolder() && FolderStore.spamFolder()
);
this.isSpamDisabled = ko.computed(() => UNUSED_OPTION_VALUE === FolderStore.spamFolder());
this.isTrashFolder = ko.computed(
() => FolderStore.trashFolder() === this.messageListEndFolder() && '' !== FolderStore.trashFolder()
() => FolderStore.trashFolder() === this.messageListEndFolder() && FolderStore.trashFolder()
);
this.isDraftFolder = ko.computed(
() => FolderStore.draftFolder() === this.messageListEndFolder() && '' !== FolderStore.draftFolder()
() => FolderStore.draftFolder() === this.messageListEndFolder() && FolderStore.draftFolder()
);
this.isSentFolder = ko.computed(
() => FolderStore.sentFolder() === this.messageListEndFolder() && '' !== FolderStore.sentFolder()
() => FolderStore.sentFolder() === this.messageListEndFolder() && FolderStore.sentFolder()
);
this.isArchiveFolder = ko.computed(
() => FolderStore.archiveFolder() === this.messageListEndFolder() && '' !== FolderStore.archiveFolder()
() => FolderStore.archiveFolder() === this.messageListEndFolder() && FolderStore.archiveFolder()
);
this.isArchiveDisabled = ko.computed(() => UNUSED_OPTION_VALUE === FolderStore.archiveFolder());
@ -538,7 +538,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
* @returns {void}
*/
setActionForAll(sFolderFullNameRaw, iSetAction, sThreadUid = '') {
if ('' !== sFolderFullNameRaw) {
if (sFolderFullNameRaw) {
let cnt = 0;
const uids = [];
@ -728,9 +728,9 @@ class MessageListMailBoxUserView extends AbstractViewNext {
clearListIsVisible() {
return (
'' === this.messageListSearchDesc() &&
'' === this.messageListError() &&
'' === this.messageListEndThreadUid() &&
!this.messageListSearchDesc() &&
!this.messageListError() &&
!this.messageListEndThreadUid() &&
this.messageList().length &&
(this.isSpamFolder() || this.isTrashFolder())
);
@ -910,10 +910,10 @@ class MessageListMailBoxUserView extends AbstractViewNext {
// cancel search
key('esc', KeyState.MessageList, () => {
if ('' !== this.messageListSearchDesc()) {
if (this.messageListSearchDesc()) {
this.cancelSearch();
return false;
} else if ('' !== this.messageListEndThreadUid()) {
} else if (this.messageListEndThreadUid()) {
this.cancelThreadUid();
return false;
}

View file

@ -297,7 +297,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
if (pic !== this.viewUserPic() && lastEmail === email) {
this.viewUserPicVisible(false);
this.viewUserPic(DATA_IMAGE_USER_DOT_PIC);
if ('' !== pic) {
if (pic) {
this.viewUserPicVisible(true);
this.viewUserPic(pic);
}
@ -386,7 +386,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
if (dom && 1 === dom.length) {
let aC = dom;
while ('' === result) {
while (!result) {
limit -= 1;
if (0 >= limit) {
break;
@ -456,7 +456,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
// return sLine ? [window.decodeURIComponent(sLine)].map(sItem => {
// var oEmailModel = new EmailModel();
// oEmailModel.parse(sItem);
// return '' !== oEmailModel.email ? oEmailModel : null;
// return oEmailModel.email ? oEmailModel : null;
// }).filter(value => !!value) : null;
// }
// ;
@ -930,7 +930,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
* @returns {void}
*/
readReceipt(oMessage) {
if (oMessage && '' !== oMessage.readReceipt()) {
if (oMessage && oMessage.readReceipt()) {
Remote.sendReadReceiptMessage(
noop,
oMessage.folderFullNameRaw,

View file

@ -1,5 +1,5 @@
(function(CKEDITOR, $, undefined) {
(function(CKEDITOR, $) {
'use strict';
@ -13,10 +13,10 @@
return $.trim(editor.__textUtils.htmlToPlain(html));
};
isEmptyText = '' === $.trim(text);
isEmptyText = !$.trim(text);
if (!isEmptyText && isHtml)
{
isEmptyText = '' === clearHtmlLine(text);
isEmptyText = !clearHtmlLine(text);
}
if (editor.__previos_signature && !isEmptyText)

2
vendors/jua/jua.js vendored
View file

@ -190,7 +190,7 @@
sFileName = sFileName.substr(1);
}
if ('' === sType && 0 === iSize)
if (!sType && 0 === iSize)
{
return null; // Folder
}