From 11f437135a349c2993656302711526660084ae46 Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Thu, 24 Mar 2022 16:17:46 +0100 Subject: [PATCH] Replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher --- cypress/utils/index.js | 2 +- src/components/MessageContent.js | 6 +++--- src/components/ProfileInfo.vue | 2 +- src/views/TimelineSinglePost.vue | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cypress/utils/index.js b/cypress/utils/index.js index cee81c0f..901c9bd0 100644 --- a/cypress/utils/index.js +++ b/cypress/utils/index.js @@ -30,6 +30,6 @@ const getSearchParams = url => { }, {}) } -const randHash = () => Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10) +const randHash = () => Math.random().toString(36).replace(/[^a-z]+/g, '').slice(0, 10) export default { getSearchParams, randHash } diff --git a/src/components/MessageContent.js b/src/components/MessageContent.js index d8fe78a8..5abb1c08 100644 --- a/src/components/MessageContent.js +++ b/src/components/MessageContent.js @@ -67,7 +67,7 @@ function transformText(createElement, text) { props: { to: { name: 'profile', - params: { account: match[2].substr(1) } + params: { account: match[2].slice(1) } } } }, @@ -85,7 +85,7 @@ function transformText(createElement, text) { props: { to: { name: 'tags', - params: { tag: match[2].substr(1) } + params: { tag: match[2].slice(1) } } } }, @@ -139,7 +139,7 @@ function cleanLink(createElement, node, context) { props: { to: { name: 'tags', - params: { tag: node.textContent.substr(1) } + params: { tag: node.textContent.slice(1) } } } }, diff --git a/src/components/ProfileInfo.vue b/src/components/ProfileInfo.vue index 53a1e8b9..39f7d707 100644 --- a/src/components/ProfileInfo.vue +++ b/src/components/ProfileInfo.vue @@ -128,7 +128,7 @@ export default { computed: { localUid() { // Returns only the local part of a username - return (this.uid.indexOf('@') === -1) ? this.uid : this.uid.substr(0, this.uid.indexOf('@')) + return (this.uid.indexOf('@') === -1) ? this.uid : this.uid.slice(0, this.uid.indexOf('@')) }, displayName() { if (typeof this.accountInfo.name !== 'undefined' && this.accountInfo.name !== '') { diff --git a/src/views/TimelineSinglePost.vue b/src/views/TimelineSinglePost.vue index fdab3258..cc9ed9d8 100644 --- a/src/views/TimelineSinglePost.vue +++ b/src/views/TimelineSinglePost.vue @@ -62,7 +62,7 @@ export default { * @returns {String} */ account() { - return window.location.href.split('/')[window.location.href.split('/').length - 2].substr(1) + return window.location.href.split('/')[window.location.href.split('/').length - 2].slice(1) }, /** * @description Returns the timeline currently loaded in the store