Replace deprecated String.substr with String.slice

This commit is contained in:
djmaze 2021-12-08 11:35:41 +01:00
parent 2719f08e26
commit b98762dd68
17 changed files with 54 additions and 54 deletions

View file

@ -681,10 +681,10 @@ class ComposePopupView extends AbstractViewPopup {
if (identity) {
this.editor(editor => {
let signature = identity.signature(),
isHtml = signature && ':HTML:' === signature.substr(0, 6);
isHtml = signature && ':HTML:' === signature.slice(0, 6);
editor.setSignature(
this.convertSignature(isHtml ? signature.substr(6) : signature),
this.convertSignature(isHtml ? signature.slice(6) : signature),
isHtml, !!identity.signatureInsertBefore());
});
}
@ -1293,7 +1293,7 @@ class ComposePopupView extends AbstractViewPopup {
addMessageAsAttachment(message) {
if (message) {
let temp = message.subject();
temp = '.eml' === temp.substr(-4).toLowerCase() ? temp : temp + '.eml';
temp = '.eml' === temp.slice(-4).toLowerCase() ? temp : temp + '.eml';
const attachment = new ComposeAttachmentModel(message.requestHash, temp, message.size());

View file

@ -51,7 +51,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
}
return oKey.users.map(user => ({
id: oKey.guid,
name: '(' + oKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user,
name: '(' + oKey.id.slice(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user,
key: oKey
}));
});
@ -66,7 +66,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
}
return oKey.users.map(user => ({
id: oKey.guid,
name: '(' + oKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user,
name: '(' + oKey.id.slice(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user,
key: oKey
}));
});
@ -241,7 +241,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
empty: !option.key,
selected: ko.observable(!!option.key),
users: option.key.users,
hash: option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
hash: option.key.id.slice(KEY_NAME_SUBSTR).toUpperCase(),
key: option.key
});
}
@ -257,7 +257,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
selected: ko.observable(!!option.key),
removable: ko.observable(!this.sign() || !this.signKey() || this.signKey().key.id !== option.key.id),
users: option.key.users,
hash: option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
hash: option.key.id.slice(KEY_NAME_SUBSTR).toUpperCase(),
key: option.key
});
}
@ -345,7 +345,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
if (keys && keys[0]) {
this.signKey({
users: keys[0].users || [emailLine],
hash: keys[0].id.substr(KEY_NAME_SUBSTR).toUpperCase(),
hash: keys[0].id.slice(KEY_NAME_SUBSTR).toUpperCase(),
key: keys[0]
});
}
@ -367,7 +367,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
!this.sign() || !this.signKey() || this.signKey().key.id !== publicKey.id
),
users: publicKey ? publicKey.users || [recEmail] : [recEmail],
hash: publicKey ? publicKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() : '',
hash: publicKey ? publicKey.id.slice(KEY_NAME_SUBSTR).toUpperCase() : '',
key: publicKey
}))
: [];

View file

@ -34,7 +34,7 @@ class FolderCreatePopupView extends AbstractViewPopup {
oItem =>
oItem ? (oItem.isSystemFolder() ? oItem.name() + ' ' + oItem.manageFolderSystemName() : oItem.name()) : '',
FolderUserStore.namespace
? item => FolderUserStore.namespace !== item.fullName.substr(0, FolderUserStore.namespace.length)
? item => FolderUserStore.namespace !== item.fullName.slice(0, FolderUserStore.namespace.length)
: null,
true
)
@ -50,7 +50,7 @@ class FolderCreatePopupView extends AbstractViewPopup {
createFolderCommand() {
let parentFolderName = this.selectedParentValue();
if (!parentFolderName && 1 < FolderUserStore.namespace.length) {
parentFolderName = FolderUserStore.namespace.substr(0, FolderUserStore.namespace.length - 1);
parentFolderName = FolderUserStore.namespace.slice(0, FolderUserStore.namespace.length - 1);
}
Remote.abort('Folders').post('FolderCreate', FolderUserStore.foldersCreating, {