diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-12-26 23:05:47 +0900 |
|---|---|---|
| committer | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-12-26 23:05:47 +0900 |
| commit | 9b746f3eb5fcefd1ce75f0b9d10e800c240bfc86 (patch) | |
| tree | 1a412a432aff96d376847fb3d5a41f8a02a773f9 /src/client/app/common/scripts/note-subscriber.ts | |
| parent | Remove trailing whitespaces (diff) | |
| download | sharkey-9b746f3eb5fcefd1ce75f0b9d10e800c240bfc86.tar.gz sharkey-9b746f3eb5fcefd1ce75f0b9d10e800c240bfc86.tar.bz2 sharkey-9b746f3eb5fcefd1ce75f0b9d10e800c240bfc86.zip | |
Make reactions removable
Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
Resolve #367, resolve #2260, close #3503
Diffstat (limited to 'src/client/app/common/scripts/note-subscriber.ts')
| -rw-r--r-- | src/client/app/common/scripts/note-subscriber.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/client/app/common/scripts/note-subscriber.ts b/src/client/app/common/scripts/note-subscriber.ts index bc434c4360..9545b5406b 100644 --- a/src/client/app/common/scripts/note-subscriber.ts +++ b/src/client/app/common/scripts/note-subscriber.ts @@ -95,6 +95,7 @@ export default prop => ({ Vue.set(this.$_ns_target.reactionCounts, reaction, 0); } + // Increment the count this.$_ns_target.reactionCounts[reaction]++; if (body.userId == this.$store.state.i.id) { @@ -103,6 +104,26 @@ export default prop => ({ break; } + case 'unreacted': { + const reaction = body.reaction; + + if (this.$_ns_target.reactionCounts == null) { + return; + } + + if (this.$_ns_target.reactionCounts[reaction] == null) { + return; + } + + // Decrement the count + if (this.$_ns_target.reactionCounts[reaction] > 0) this.$_ns_target.reactionCounts[reaction]--; + + if (body.userId == this.$store.state.i.id) { + Vue.set(this.$_ns_target, 'myReaction', null); + } + break; + } + case 'pollVoted': { if (body.userId == this.$store.state.i.id) return; const choice = body.choice; |