$.proxy is deprecated

$.trim is deprecated
This commit is contained in:
djmaze 2020-08-06 18:24:46 +02:00
parent ae1b7610fd
commit bbd9f49dcd
39 changed files with 153 additions and 173 deletions

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { trim, triggerAutocompleteInputChange } from 'Common/Utils';
import { triggerAutocompleteInputChange } from 'Common/Utils';
import { StorageResultType, Notification, Magics } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
@ -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(!this.login().trim());
this.passwordError(!this.password().trim());
if (this.loginError() || this.passwordError()) {
return false;

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { trim } from 'Common/Utils';
import { getNotification } from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
@ -44,8 +43,8 @@ class AccountPopupView extends AbstractViewNext {
@command((self) => !self.submitRequest())
addAccountCommand() {
this.emailError(!trim(this.email()));
this.passwordError(!trim(this.password()));
this.emailError(!this.email().trim());
this.passwordError(!this.password().trim());
if (this.emailError() || this.passwordError()) {
return false;

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { trim } from 'Common/Utils';
import { RAINLOOP_TRIAL_KEY } from 'Common/Consts';
import { i18n, getNotification } from 'Common/Translator';
@ -112,7 +111,7 @@ class ActivatePopupView extends AbstractViewNext {
return (
!value ||
RAINLOOP_TRIAL_KEY === value ||
!!/^RL[\d]+-[A-Z0-9-]+Z$/.test(trim(value).replace(/[^A-Z0-9-]/gi, ''))
!!/^RL[\d]+-[A-Z0-9-]+Z$/.test(value.trim().replace(/[^A-Z0-9-]/gi, ''))
);
}
}

View file

@ -1,5 +1,5 @@
import ko from 'ko';
import { trim, delegateRun, log } from 'Common/Utils';
import { delegateRun, log } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
@ -33,7 +33,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
const reg = /[-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[-]{3,6}[\s\S]+?[-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[-]{3,6}/gi,
openpgpKeyring = PgpStore.openpgpKeyring;
let keyTrimmed = trim(this.key());
let keyTrimmed = this.key().trim();
if (/[\n]/.test(keyTrimmed)) {
keyTrimmed = keyTrimmed.replace(/[\r]+/g, '').replace(/[\n]{2,}/g, '\n\n');

View file

@ -1,6 +1,5 @@
import ko from 'ko';
import { trim } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import MessageStore from 'Stores/User/Message';
@ -79,10 +78,10 @@ class AdvancedSearchPopupView extends AbstractViewNext {
buildSearchString() {
const result = [],
from_ = trim(this.from()),
to = trim(this.to()),
subject = trim(this.subject()),
text = trim(this.text()),
from_ = this.from().trim(),
to = this.to().trim(),
subject = this.subject().trim(),
text = this.text().trim(),
isPart = [],
hasPart = [];
@ -128,7 +127,7 @@ class AdvancedSearchPopupView extends AbstractViewNext {
result.push('text:' + this.buildSearchStringValue(text));
}
return trim(result.join(' '));
return result.join(' ').trim();
}
clearPopup() {

View file

@ -16,7 +16,6 @@ import {
} from 'Common/Enums';
import {
trim,
isNormal,
delegateRun,
isNonEmptyArray,
@ -68,11 +67,11 @@ class ComposePopupView extends AbstractViewNext {
const fEmailOutInHelper = (context, identity, name, isIn) => {
if (identity && context && identity[name]() && (isIn ? true : context[name]())) {
const identityEmail = identity[name]();
let list = trim(context[name]()).split(/[,]/);
let list = context[name]().trim().split(/[,]/);
list = list.filter(email => {
email = trim(email);
return email && trim(identityEmail) !== email;
email = email.trim();
return email && identityEmail.trim() !== email;
});
if (isIn) {
@ -343,9 +342,9 @@ class ComposePopupView extends AbstractViewNext {
@command((self) => self.canBeSentOrSaved())
sendCommand() {
const sTo = trim(this.to()),
sCc = trim(this.cc()),
sBcc = trim(this.bcc());
const sTo = this.to().trim(),
sCc = this.cc().trim(),
sBcc = this.bcc().trim();
let sSentFolder = FolderStore.sentFolder();
this.attachmentsInProcessError(false);
@ -638,7 +637,7 @@ class ComposePopupView extends AbstractViewNext {
if (this.modalVisibility() && !result) {
if (data && Notification.CantSaveMessage === data.ErrorCode) {
this.sendSuccessButSaveError(true);
this.savedErrorDesc(trim(i18n('COMPOSE/SAVED_ERROR_ON_SEND')));
this.savedErrorDesc(i18n('COMPOSE/SAVED_ERROR_ON_SEND').trim());
} else {
message = getNotification(
data && data.ErrorCode ? data.ErrorCode : Notification.CantSendMessage,
@ -858,11 +857,11 @@ class ComposePopupView extends AbstractViewNext {
*/
addEmailsTo(fKoValue, emails) {
if (isNonEmptyArray(emails)) {
const value = trim(fKoValue()),
const value = fKoValue().trim(),
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 ? ', ' : '') + values.join(', ').trim());
}
}
@ -962,7 +961,7 @@ class ComposePopupView extends AbstractViewNext {
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = ['reply', message.uid, message.folderFullNameRaw];
this.sInReplyTo = message.sMessageId;
this.sReferences = trim(this.sInReplyTo + ' ' + message.sReferences);
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
break;
case ComposeType.ReplyAll:
@ -973,7 +972,7 @@ class ComposePopupView extends AbstractViewNext {
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = ['reply', message.uid, message.folderFullNameRaw];
this.sInReplyTo = message.sMessageId;
this.sReferences = trim(this.sInReplyTo + ' ' + message.references());
this.sReferences = (this.sInReplyTo + ' ' + message.references()).trim();
break;
case ComposeType.Forward:
@ -981,7 +980,7 @@ class ComposePopupView extends AbstractViewNext {
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = ['forward', message.uid, message.folderFullNameRaw];
this.sInReplyTo = message.sMessageId;
this.sReferences = trim(this.sInReplyTo + ' ' + message.sReferences);
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
break;
case ComposeType.ForwardAsAttachment:
@ -989,7 +988,7 @@ class ComposePopupView extends AbstractViewNext {
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = ['forward', message.uid, message.folderFullNameRaw];
this.sInReplyTo = message.sMessageId;
this.sReferences = trim(this.sInReplyTo + ' ' + message.sReferences);
this.sReferences = (this.sInReplyTo + ' ' + message.sReferences).trim();
break;
case ComposeType.Draft:
@ -1036,7 +1035,7 @@ class ComposePopupView extends AbstractViewNext {
'EMAIL': sFrom
});
sText = '<br /><br />' + sReplyTitle + ':' + '<br /><br />' + '<blockquote>' + trim(sText) + '</blockquote>';
sText = '<br /><br />' + sReplyTitle + ':' + '<br /><br />' + '<blockquote>' + sText.trim() + '</blockquote>';
break;
@ -1065,7 +1064,7 @@ class ComposePopupView extends AbstractViewNext {
': ' +
encodeHtml(sSubject) +
'<br /><br />' +
trim(sText) +
sText.trim() +
'<br /><br />';
break;

View file

@ -2,7 +2,7 @@ import $ from '$';
import ko from 'ko';
import key from 'key';
import { pString, log, trim, defautOptionsAfterRender } from 'Common/Utils';
import { pString, log, defautOptionsAfterRender } from 'Common/Utils';
import { Magics, KeyState } from 'Common/Enums';
import { i18n } from 'Common/Translator';
@ -360,7 +360,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
rec = rec.join(', ').split(',');
rec = rec.map(value => {
email.clear();
email.parse(trim(value));
email.parse(value.trim());
return email.email || false;
}).filter(value => !!value);

View file

@ -3,7 +3,7 @@ import ko from 'ko';
import { StorageResultType, ServerSecure, Ports, Notification } from 'Common/Enums';
import { IMAP_DEFAULT_PORT, SIEVE_DEFAULT_PORT, SMTP_DEFAULT_PORT } from 'Common/Consts';
import { bMobileDevice } from 'Common/Globals';
import { trim, pInt, pString } from 'Common/Utils';
import { pInt, pString } from 'Common/Utils';
import { i18n } from 'Common/Translator';
import CapaAdminStore from 'Stores/Admin/Capa';
@ -356,24 +356,24 @@ class DomainPopupView extends AbstractViewNext {
this.edit(true);
this.name(trim(oDomain.Name));
this.imapServer(trim(oDomain.IncHost));
this.name(oDomain.Name.trim());
this.imapServer(oDomain.IncHost.trim());
this.imapPort('' + pInt(oDomain.IncPort));
this.imapSecure(trim(oDomain.IncSecure));
this.imapSecure(oDomain.IncSecure.trim());
this.imapShortLogin(!!oDomain.IncShortLogin);
this.useSieve(!!oDomain.UseSieve);
this.sieveAllowRaw(!!oDomain.SieveAllowRaw);
this.sieveServer(trim(oDomain.SieveHost));
this.sieveServer(oDomain.SieveHost.trim());
this.sievePort('' + pInt(oDomain.SievePort));
this.sieveSecure(trim(oDomain.SieveSecure));
this.smtpServer(trim(oDomain.OutHost));
this.sieveSecure(oDomain.SieveSecure.trim());
this.smtpServer(oDomain.OutHost.trim());
this.smtpPort('' + pInt(oDomain.OutPort));
this.smtpSecure(trim(oDomain.OutSecure));
this.smtpSecure(oDomain.OutSecure.trim());
this.smtpShortLogin(!!oDomain.OutShortLogin);
this.smtpAuth(!!oDomain.OutAuth);
this.smtpPhpMail(!!oDomain.OutUsePhpMail);
this.whiteList(trim(oDomain.WhiteList));
this.aliasName(trim(oDomain.AliasName));
this.whiteList(oDomain.WhiteList.trim());
this.aliasName(oDomain.AliasName.trim());
this.enableSmartPorts(true);
}

View file

@ -3,7 +3,7 @@ import ko from 'ko';
import { Notification } from 'Common/Enums';
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { bMobileDevice } from 'Common/Globals';
import { trim, defautOptionsAfterRender, folderListOptionsBuilder } from 'Common/Utils';
import { defautOptionsAfterRender, folderListOptionsBuilder } from 'Common/Utils';
import FolderStore from 'Stores/User/Folder';
@ -62,7 +62,7 @@ class FolderCreateView extends AbstractViewNext {
}
simpleFolderNameValidation(sName) {
return /^[^\\/]+$/g.test(trim(sName));
return /^[^\\/]+$/g.test(sName.trim());
}
clearPopup() {

View file

@ -2,7 +2,7 @@ import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { bMobileDevice } from 'Common/Globals';
import { trim, fakeMd5 } from 'Common/Utils';
import { fakeMd5 } from 'Common/Utils';
import { getNotification } from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
@ -62,7 +62,7 @@ class IdentityPopupView extends AbstractViewNext {
}
if (!this.email.hasError()) {
this.email.hasError(!trim(this.email()));
this.email.hasError(!this.email().trim());
}
if (this.email.hasError()) {

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { Magics } from 'Common/Enums';
import { trim, log, delegateRun, pInt } from 'Common/Utils';
import { log, delegateRun, pInt } from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
@ -39,7 +39,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
const userId = {},
openpgpKeyring = PgpStore.openpgpKeyring;
this.email.error(!trim(this.email()));
this.email.error(!this.email().trim());
if (!openpgpKeyring || this.email.error()) {
return false;
}
@ -58,7 +58,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
.generateKey({
userIds: [userId],
numBits: pInt(this.keyBitLength()),
passphrase: trim(this.password())
passphrase: this.password().trim()
})
.then((keyPair) => {
this.submitRequest(false);

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { trim, isNormal } from 'Common/Utils';
import { isNormal } from 'Common/Utils';
import { getNotification } from 'Common/Translator';
import { HtmlEditor } from 'Common/HtmlEditor';
@ -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(!this.name().trim());
this.body.error(!this.body().trim() || ':HTML:' === this.body().trim());
if (this.name.error() || this.body.error()) {
return false;

View file

@ -6,7 +6,6 @@ import AccountStore from 'Stores/User/Account';
import MessageStore from 'Stores/User/Message';
import { Capa, Magics, KeyState } from 'Common/Enums';
import { trim } from 'Common/Utils';
import { settings } from 'Common/Links';
import * as Events from 'Common/Events';
@ -21,8 +20,8 @@ class AbstractSystemDropDownUserView extends AbstractViewNext {
constructor() {
super();
this.logoImg = trim(Settings.settingsGet('UserLogo'));
this.logoTitle = trim(Settings.settingsGet('UserLogoTitle'));
this.logoImg = (Settings.settingsGet('UserLogo')||'').trim();
this.logoTitle = (Settings.settingsGet('UserLogoTitle')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');

View file

@ -9,7 +9,7 @@ import {
Notification
} from 'Common/Enums';
import { trim, convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
import { convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
import { $win } from 'Common/Globals';
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
@ -53,8 +53,8 @@ class LoginUserView extends AbstractViewNext {
this.additionalCode.visibility = ko.observable(false);
this.additionalCodeSignMe = ko.observable(false);
this.logoImg = trim(Settings.settingsGet('LoginLogo'));
this.loginDescription = trim(Settings.settingsGet('LoginDescription'));
this.logoImg = (Settings.settingsGet('LoginLogo')||'').trim();
this.loginDescription = (Settings.settingsGet('LoginDescription')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
@ -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(!this.email().trim());
this.passwordError(!this.password().trim());
if (this.additionalCode.visibility()) {
this.additionalCode.error(false);
this.additionalCode.error(!trim(this.additionalCode()));
this.additionalCode.error(!this.additionalCode().trim());
}
if (

View file

@ -3,7 +3,7 @@ import $ from '$';
import ko from 'ko';
import key from 'key';
import { trim, isNormal, windowResize } from 'Common/Utils';
import { isNormal, windowResize } from 'Common/Utils';
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
import { $htmlCL, leftPanelDisabled, moveAction } from 'Common/Globals';
import { mailBox, settings } from 'Common/Links';
@ -58,7 +58,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
() =>
FolderStore.currentFolder() &&
FolderStore.currentFolder().isInbox() &&
trim(MessageStore.messageListSearch()).includes('is:flagged')
MessageStore.messageListSearch().trim().includes('is:flagged')
);
}

View file

@ -20,7 +20,6 @@ import { $htmlCL, leftPanelDisabled, keyScopeReal, useKeyboardShortcuts, moveAct
import {
isNonEmptyArray,
trim,
windowResize,
windowResizeCallback,
inFocus,
@ -95,8 +94,8 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.allowMessageActions = !!Settings.capa(Capa.MessageActions);
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
this.logoImg = trim(Settings.settingsGet('UserLogoMessage'));
this.logoIframe = trim(Settings.settingsGet('UserIframeMessage'));
this.logoImg = (Settings.settingsGet('UserLogoMessage')||'').trim();
this.logoIframe = (Settings.settingsGet('UserIframeMessage')||'').trim();
this.mobile = !!Settings.appSettingsGet('mobile');