From f6b482be515ea4f0281050f71296ffe0ec2ab305 Mon Sep 17 00:00:00 2001 From: Shpuld Shpludson Date: Tue, 11 Feb 2020 12:24:51 +0000 Subject: Emoji Reactions - fixes and improvements --- src/components/react_button/react_button.js | 7 ++++++- src/components/react_button/react_button.vue | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/components/react_button') diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js index 6fb2a780..a6cf5b94 100644 --- a/src/components/react_button/react_button.js +++ b/src/components/react_button/react_button.js @@ -22,7 +22,12 @@ const ReactButton = { this.showTooltip = false }, addReaction (event, emoji) { - this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji }) + 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 }) + } this.closeReactionSelect() } }, diff --git a/src/components/react_button/react_button.vue b/src/components/react_button/react_button.vue index c925dd71..fb43ebaf 100644 --- a/src/components/react_button/react_button.vue +++ b/src/components/react_button/react_button.vue @@ -54,6 +54,10 @@ .reaction-picker-filter { padding: 0.5em; + display: flex; + input { + flex: 1; + } } .reaction-picker-divider { -- cgit v1.2.3-70-g09d2