mirror of
https://git.pleroma.social/sjw/pleroma-fe.git
synced 2024-12-23 01:29:47 +01:00
Fix react button not working if reaction accounts are not loaded
This commit is contained in:
parent
624af7ed00
commit
8ba22a2481
1
changelog.d/react-button.fix
Normal file
1
changelog.d/react-button.fix
Normal file
@ -0,0 +1 @@
|
||||
Fix react button not working if reaction accounts are not loaded
|
@ -57,10 +57,10 @@ const EmojiReactions = {
|
||||
reactedWith (emoji) {
|
||||
return this.status.emoji_reactions.find(r => r.name === emoji).me
|
||||
},
|
||||
fetchEmojiReactionsByIfMissing () {
|
||||
async fetchEmojiReactionsByIfMissing () {
|
||||
const hasNoAccounts = this.status.emoji_reactions.find(r => !r.accounts)
|
||||
if (hasNoAccounts) {
|
||||
this.$store.dispatch('fetchEmojiReactionsBy', this.status.id)
|
||||
return await this.$store.dispatch('fetchEmojiReactionsBy', this.status.id)
|
||||
}
|
||||
},
|
||||
reactWith (emoji) {
|
||||
@ -69,9 +69,10 @@ const EmojiReactions = {
|
||||
unreact (emoji) {
|
||||
this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji })
|
||||
},
|
||||
emojiOnClick (emoji, event) {
|
||||
async emojiOnClick (emoji, event) {
|
||||
if (!this.loggedIn) return
|
||||
|
||||
await this.fetchEmojiReactionsByIfMissing()
|
||||
if (this.reactedWith(emoji)) {
|
||||
this.unreact(emoji)
|
||||
} else {
|
||||
|
@ -757,7 +757,7 @@ const statuses = {
|
||||
)
|
||||
},
|
||||
fetchEmojiReactionsBy ({ rootState, commit }, id) {
|
||||
rootState.api.backendInteractor.fetchEmojiReactions({ id }).then(
|
||||
return rootState.api.backendInteractor.fetchEmojiReactions({ id }).then(
|
||||
emojiReactions => {
|
||||
commit('addEmojiReactionsBy', { id, emojiReactions, currentUser: rootState.users.currentUser })
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user