emoji reacts fix
This commit is contained in:
parent
08b06e7c01
commit
8ca71beef0
3 changed files with 14 additions and 6 deletions
|
|
@ -37,9 +37,9 @@ const EmojiReactions = {
|
||||||
},
|
},
|
||||||
accountsForEmoji() {
|
accountsForEmoji() {
|
||||||
return this.status.emoji_reactions.reduce((acc, reaction) => {
|
return this.status.emoji_reactions.reduce((acc, reaction) => {
|
||||||
acc[reaction.name] = reaction.accounts || []
|
acc.set(reaction.name, new Set(reaction.account_ids))
|
||||||
return acc
|
return acc
|
||||||
}, {})
|
}, new Map())
|
||||||
},
|
},
|
||||||
loggedIn() {
|
loggedIn() {
|
||||||
return !!useUsersStore().currentUser
|
return !!useUsersStore().currentUser
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
</FALayers>
|
</FALayers>
|
||||||
</component>
|
</component>
|
||||||
<UserListPopover
|
<UserListPopover
|
||||||
:users="accountsForEmoji[reaction.name]"
|
:user-ids="accountsForEmoji.get(reaction.name)"
|
||||||
class="emoji-reaction-popover"
|
class="emoji-reaction-popover"
|
||||||
:normal-button="true"
|
:normal-button="true"
|
||||||
:trigger-attrs="counterTriggerAttrs(reaction)"
|
:trigger-attrs="counterTriggerAttrs(reaction)"
|
||||||
|
|
|
||||||
|
|
@ -191,14 +191,22 @@ export const useStatusesStore = defineStore('statuses', {
|
||||||
id,
|
id,
|
||||||
credentials: useOAuthStore().token,
|
credentials: useOAuthStore().token,
|
||||||
}).then(({ data, timestamp }) => {
|
}).then(({ data, timestamp }) => {
|
||||||
data.forEach((reaction) => {
|
const reactions = data.map((reaction) => {
|
||||||
const users = useUsersStore().addNewUsers({
|
const users = useUsersStore().addNewUsers({
|
||||||
timestamp,
|
timestamp,
|
||||||
data: reaction.accounts,
|
data: reaction.accounts,
|
||||||
})
|
})
|
||||||
reaction.accounts = users
|
|
||||||
|
// Backend inconsistency - status data only has ids (account_ids)
|
||||||
|
// but reactions data has full info (accounts)
|
||||||
|
return {
|
||||||
|
...reaction,
|
||||||
|
accounts: users,
|
||||||
|
account_ids: users.map(({ id }) => id),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.addEmojiReactionsBy(id, data)
|
|
||||||
|
this.addEmojiReactionsBy(id, reactions)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchFavs(id) {
|
fetchFavs(id) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue