diff options
Diffstat (limited to 'src/components/react_button/react_button.js')
| -rw-r--r-- | src/components/react_button/react_button.js | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js index 6fb2a780..19949563 100644 --- a/src/components/react_button/react_button.js +++ b/src/components/react_button/react_button.js @@ -1,29 +1,25 @@ +import Popover from '../popover/popover.vue' import { mapGetters } from 'vuex' const ReactButton = { props: ['status', 'loggedIn'], data () { return { - showTooltip: false, - filterWord: '', - popperOptions: { - modifiers: { - preventOverflow: { padding: { top: 50 }, boundariesElement: 'viewport' } - } - } + filterWord: '' } }, + components: { + Popover + }, methods: { - openReactionSelect () { - this.showTooltip = true - this.filterWord = '' - }, - closeReactionSelect () { - this.showTooltip = false - }, - addReaction (event, emoji) { - this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji }) - this.closeReactionSelect() + addReaction (event, emoji, close) { + const existingReaction = this.status.emoji_reactions.find(r => r.name === emoji) + if (existingReaction && existingReaction.me) { + this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji }) + } else { + this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji }) + } + close() } }, computed: { |
