logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 832019b2c26f7b219db75e47060ab95251c14c26
parent 998aa8f732bbf9d074abeb5916ceb5effd8afe5c
Author: Alexander Tumin <iamtakingiteasy@eientei.org>
Date:   Thu,  2 Mar 2023 11:13:05 +0300

Hide custom emoji in reaction picker when BE does not advertise pleroma_custom_emoji_reactions

Diffstat:

Msrc/boot/after_store.js1+
Msrc/components/emoji_picker/emoji_picker.js8++++++++
Msrc/components/react_button/react_button.js4++--
Msrc/components/react_button/react_button.vue1+
Msrc/modules/instance.js1+
5 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/boot/after_store.js b/src/boot/after_store.js @@ -253,6 +253,7 @@ const getNodeInfo = async ({ store }) => { store.dispatch('setInstanceOption', { name: 'safeDM', value: features.includes('safe_dm_mentions') }) store.dispatch('setInstanceOption', { name: 'shoutAvailable', value: features.includes('chat') }) store.dispatch('setInstanceOption', { name: 'pleromaChatMessagesAvailable', value: features.includes('pleroma_chat_messages') }) + store.dispatch('setInstanceOption', { name: 'pleromaCustomEmojiReactionsAvailable', value: features.includes('pleroma_custom_emoji_reactions') }) store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') }) store.dispatch('setInstanceOption', { name: 'pollsAvailable', value: features.includes('polls') }) store.dispatch('setInstanceOption', { name: 'editingAvailable', value: features.includes('editing') }) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js @@ -98,6 +98,11 @@ const EmojiPicker = { required: false, type: Boolean, default: false + }, + hideCustomEmoji: { + required: false, + type: Boolean, + default: false } }, data () { @@ -280,6 +285,9 @@ const EmojiPicker = { return 0 }, allCustomGroups () { + if (this.hideCustomEmoji) { + return {} + } const emojis = this.$store.getters.groupedCustomEmojis if (emojis.unpacked) { emojis.unpacked.text = this.$t('emoji.unpacked') diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js @@ -45,8 +45,8 @@ const ReactButton = { } }, computed: { - mergedConfig () { - return this.$store.getters.mergedConfig + hideCustomEmoji () { + return !this.$store.state.instance.pleromaChatMessagesAvailable } } } diff --git a/src/components/react_button/react_button.vue b/src/components/react_button/react_button.vue @@ -3,6 +3,7 @@ <EmojiPicker ref="picker" :enable-sticker-picker="enableStickerPicker" + :hide-custom-emoji="hideCustomEmoji" class="emoji-picker-panel" @emoji="addReaction" @show="onShow" diff --git a/src/modules/instance.js b/src/modules/instance.js @@ -123,6 +123,7 @@ const defaultState = { // Feature-set, apparently, not everything here is reported... shoutAvailable: false, pleromaChatMessagesAvailable: false, + pleromaCustomEmojiReactionsAvailable: false, gopherAvailable: false, mediaProxyAvailable: false, suggestionsEnabled: false,