From 0ff98009899a60b5fb0aaee35f6f78241b51e5a6 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 27 Feb 2024 16:42:05 +0100 Subject: [PATCH] [Glitch] Use modern ES syntax rather than `.call` Port 899eac1a92c802c334606a49d538ef37bd47c91a to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/containers/media_container.jsx | 2 +- .../flavours/glitch/features/emoji/emoji_compressed.js | 4 ++-- .../flavours/glitch/features/emoji/emoji_utils.js | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/javascript/flavours/glitch/containers/media_container.jsx b/app/javascript/flavours/glitch/containers/media_container.jsx index 52aac5ebe4..a7b20bc249 100644 --- a/app/javascript/flavours/glitch/containers/media_container.jsx +++ b/app/javascript/flavours/glitch/containers/media_container.jsx @@ -80,7 +80,7 @@ export default class MediaContainer extends PureComponent { return ( <> - {[].map.call(components, (component, i) => { + {Array.from(components).map((component, i) => { const componentName = component.getAttribute('data-component'); const Component = MEDIA_COMPONENTS[componentName]; const { media, card, poll, hashtag, ...props } = JSON.parse(component.getAttribute('data-props')); diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js b/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js index 792137b76f..59978a391b 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js @@ -36,7 +36,7 @@ Object.keys(emojiIndex.emojis).forEach(key => { let emoji = emojiIndex.emojis[key]; // Emojis with skin tone modifiers are stored like this - if (Object.prototype.hasOwnProperty.call(emoji, '1')) { + if (Object.hasOwn(emoji, '1')) { emoji = emoji['1']; } @@ -88,7 +88,7 @@ Object.keys(emojiIndex.emojis).forEach(key => { let emoji = emojiIndex.emojis[key]; // Emojis with skin tone modifiers are stored like this - if (Object.prototype.hasOwnProperty.call(emoji, '1')) { + if (Object.hasOwn(emoji, '1')) { emoji = emoji['1']; } diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_utils.js b/app/javascript/flavours/glitch/features/emoji/emoji_utils.js index 83bcc9d82f..c13d250567 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji_utils.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji_utils.js @@ -135,19 +135,19 @@ function getData(emoji, skin, set) { } } - if (Object.prototype.hasOwnProperty.call(data.short_names, emoji)) { + if (Object.hasOwn(data.short_names, emoji)) { emoji = data.short_names[emoji]; } - if (Object.prototype.hasOwnProperty.call(data.emojis, emoji)) { + if (Object.hasOwn(data.emojis, emoji)) { emojiData = data.emojis[emoji]; } } else if (emoji.id) { - if (Object.prototype.hasOwnProperty.call(data.short_names, emoji.id)) { + if (Object.hasOwn(data.short_names, emoji.id)) { emoji.id = data.short_names[emoji.id]; } - if (Object.prototype.hasOwnProperty.call(data.emojis, emoji.id)) { + if (Object.hasOwn(data.emojis, emoji.id)) { emojiData = data.emojis[emoji.id]; skin = skin || emoji.skin; } @@ -216,7 +216,7 @@ function deepMerge(a, b) { let originalValue = a[key], value = originalValue; - if (Object.prototype.hasOwnProperty.call(b, key)) { + if (Object.hasOwn(b, key)) { value = b[key]; }