From dc4e84cebd287e1c341454972ade8b444e41e840 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 12 Oct 2022 19:03:28 +0200 Subject: [PATCH] Port various forgotten fixes from upstream (#1864) * [Glitch] Fix crash when failing to load emoji picker Port 09b322872adf9be854d5e564666441a3a6c43e9d to glitch-soc Signed-off-by: Claire * [Glitch] Remove duplicate frequently used emojis Port f7c306596f63d431af0a2e76ba4b500420618d67 to glitch-soc Signed-off-by: Claire Signed-off-by: Claire Co-authored-by: Harmon --- .../features/compose/components/emoji_picker_dropdown.js | 2 +- .../compose/containers/emoji_picker_dropdown_container.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.js b/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.js index 0e49a35c3e..546d398a0b 100644 --- a/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.js +++ b/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.js @@ -345,7 +345,7 @@ class EmojiPickerDropdown extends React.PureComponent { this.setState({ loading: false }); }).catch(() => { - this.setState({ loading: false }); + this.setState({ loading: false, active: false }); }); } diff --git a/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js b/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js index ba85edd873..66d51947a8 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/emoji_picker_dropdown_container.js @@ -38,7 +38,8 @@ const getFrequentlyUsedEmojis = createSelector([ .toArray(); if (emojis.length < DEFAULTS.length) { - emojis = emojis.concat(DEFAULTS.slice(0, DEFAULTS.length - emojis.length)); + let uniqueDefaults = DEFAULTS.filter(emoji => !emojis.includes(emoji)); + emojis = emojis.concat(uniqueDefaults.slice(0, DEFAULTS.length - emojis.length)); } return emojis;