change emoji reactions to use new format
This commit is contained in:
parent
b10b92a876
commit
a018ea622c
7 changed files with 99 additions and 37 deletions
|
@ -150,7 +150,7 @@ const conversation = {
|
|||
if (!id) return
|
||||
this.highlight = id
|
||||
this.$store.dispatch('fetchFavsAndRepeats', id)
|
||||
this.$store.dispatch('fetchEmojiReactions', id)
|
||||
this.$store.dispatch('fetchEmojiReactionsBy', id)
|
||||
},
|
||||
getHighlight () {
|
||||
return this.isExpanded ? this.highlight : null
|
||||
|
|
|
@ -4,12 +4,17 @@ const EmojiReactions = {
|
|||
props: ['status'],
|
||||
computed: {
|
||||
emojiReactions () {
|
||||
return this.status.emojiReactions
|
||||
console.log(this.status.emoji_reactions)
|
||||
return this.status.emoji_reactions
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reactedWith (emoji) {
|
||||
return this.status.reactedWithEmoji.includes(emoji)
|
||||
// return []
|
||||
const user = this.$store.state.users.currentUser
|
||||
const reaction = this.status.emoji_reactions.find(r => r.emoji === emoji)
|
||||
console.log(reaction)
|
||||
return reaction.accounts && reaction.accounts.find(u => u.id === user.id)
|
||||
},
|
||||
reactWith (emoji) {
|
||||
this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<template>
|
||||
<div class="emoji-reactions">
|
||||
<button
|
||||
v-for="(users, emoji) in emojiReactions"
|
||||
:key="emoji"
|
||||
v-for="(reaction) in emojiReactions"
|
||||
:key="reaction.emoji"
|
||||
class="emoji-reaction btn btn-default"
|
||||
:class="{ 'picked-reaction': reactedWith(emoji) }"
|
||||
@click="emojiOnClick(emoji, $event)"
|
||||
:class="{ 'picked-reaction': reactedWith(reaction.emoji) }"
|
||||
@click="emojiOnClick(reaction.emoji, $event)"
|
||||
>
|
||||
<span v-if="users">{{ users.length }}</span>
|
||||
<span>{{ emoji }}</span>
|
||||
<span>{{ reaction.count }}</span>
|
||||
<span>{{ reaction.emoji }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -355,7 +355,6 @@
|
|||
</transition>
|
||||
|
||||
<EmojiReactions
|
||||
v-if="isFocused"
|
||||
:status="status"
|
||||
/>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue