From 9b95077885c4a7c03e9f4124f81cd39e2c6cbf26 Mon Sep 17 00:00:00 2001 From: CommanderRoot Date: Mon, 4 Apr 2022 18:19:45 +0200 Subject: [PATCH] [Glitch] Replace deprecated String.prototype.substr() Port 0ec695e036dab45d57598f451266bd0b176df9fd to glitch-soc Signed-off-by: Tobias Speicher Signed-off-by: Claire --- .../flavours/glitch/features/status/components/card.js | 2 +- app/javascript/flavours/glitch/features/video/index.js | 2 +- .../flavours/glitch/util/emoji/emoji_mart_search_light.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/status/components/card.js b/app/javascript/flavours/glitch/features/status/components/card.js index 14abe9838b..0ca2508e71 100644 --- a/app/javascript/flavours/glitch/features/status/components/card.js +++ b/app/javascript/flavours/glitch/features/status/components/card.js @@ -24,7 +24,7 @@ const trim = (text, len) => { return text; } - return text.substring(0, cut) + (text.length > len ? '…' : ''); + return text.slice(0, cut) + (text.length > len ? '…' : ''); }; const domParser = new DOMParser(); diff --git a/app/javascript/flavours/glitch/features/video/index.js b/app/javascript/flavours/glitch/features/video/index.js index 53e3dfda38..25c94bb2c5 100644 --- a/app/javascript/flavours/glitch/features/video/index.js +++ b/app/javascript/flavours/glitch/features/video/index.js @@ -90,7 +90,7 @@ export const fileNameFromURL = str => { const pathname = url.pathname; const index = pathname.lastIndexOf('/'); - return pathname.substring(index + 1); + return pathname.slice(index + 1); }; export default @injectIntl diff --git a/app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js b/app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js index e4519a13e6..70694ab6dd 100644 --- a/app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js +++ b/app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js @@ -124,7 +124,7 @@ function search(value, { emojisToShowFilter, maxResults, include, exclude, custo for (let id in aPool) { let emoji = aPool[id], { search } = emoji, - sub = value.substr(0, length), + sub = value.slice(0, length), subIndex = search.indexOf(sub); if (subIndex !== -1) {