From f32dd6940138c16a0af0c026c374a2f80c941080 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Wed, 6 May 2020 00:05:19 +0900
Subject: [PATCH] refs #1425 Fix update after react emoji to the statuses
---
package-lock.json | 2 +-
src/renderer/components/organisms/Toot.vue | 24 ++++++++--------------
src/renderer/store/organisms/Toot.ts | 14 ++++---------
3 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 3442d9d0..c02c20fb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7800,7 +7800,7 @@
"dependencies": {
"resolve": {
"version": "1.1.7",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
+ "resolved": "http://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
"integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
"dev": true
}
diff --git a/src/renderer/components/organisms/Toot.vue b/src/renderer/components/organisms/Toot.vue
index ec8659fe..199443ef 100644
--- a/src/renderer/components/organisms/Toot.vue
+++ b/src/renderer/components/organisms/Toot.vue
@@ -104,7 +104,7 @@
-
+
{{ reaction.name }} {{ reaction.count }}
@@ -238,8 +238,7 @@ export default {
hideAllAttachments: this.$store.state.App.hideAllAttachments,
now: Date.now(),
pollResponse: null,
- openEmojiPicker: false,
- reactionResponse: null
+ openEmojiPicker: false
}
},
props: {
@@ -332,13 +331,6 @@ export default {
return this.originalMessage.poll
}
},
- reactions: function () {
- if (this.reactionResponse) {
- return this.reactionResponse
- } else {
- return this.originalMessage.emoji_reactions
- }
- },
sensitive: function () {
return (this.hideAllAttachments || this.originalMessage.sensitive) && this.mediaAttachments.length > 0
},
@@ -635,26 +627,26 @@ export default {
this.openEmojiPicker = false
},
async selectEmoji(emoji) {
- const res = await this.$store.dispatch('organisms/Toot/sendReaction', {
+ const status = await this.$store.dispatch('organisms/Toot/sendReaction', {
status_id: this.originalMessage.id,
native: emoji.native
})
- this.reactionResponse = res
+ this.$emit('update', status)
this.hideEmojiPicker()
},
async addReaction(native) {
- const res = await this.$store.dispatch('organisms/Toot/sendReaction', {
+ const status = await this.$store.dispatch('organisms/Toot/sendReaction', {
status_id: this.originalMessage.id,
native: native
})
- this.reactionResponse = res
+ this.$emit('update', status)
},
async removeReaction(native) {
- const res = await this.$store.dispatch('organisms/Toot/deleteReaction', {
+ const status = await this.$store.dispatch('organisms/Toot/deleteReaction', {
status_id: this.originalMessage.id,
native: native
})
- this.reactionResponse = res
+ this.$emit('update', status)
}
}
}
diff --git a/src/renderer/store/organisms/Toot.ts b/src/renderer/store/organisms/Toot.ts
index d02c9eed..65c0f3b6 100644
--- a/src/renderer/store/organisms/Toot.ts
+++ b/src/renderer/store/organisms/Toot.ts
@@ -116,7 +116,7 @@ const actions: ActionTree = {
const res = await client.getPoll(id)
return res.data
},
- sendReaction: async ({ rootState }, params: ReactionParam): Promise> => {
+ sendReaction: async ({ rootState }, params: ReactionParam): Promise => {
const client = generator(
rootState.TimelineSpace.sns,
rootState.TimelineSpace.account.baseURL,
@@ -125,12 +125,9 @@ const actions: ActionTree = {
rootState.App.proxyConfiguration
)
const res = await client.createEmojiReaction(params.status_id, params.native)
- if (res.data.reblog) {
- return res.data.reblog.emoji_reactions
- }
- return res.data.emoji_reactions
+ return res.data
},
- deleteReaction: async ({ rootState }, params: ReactionParam): Promise> => {
+ deleteReaction: async ({ rootState }, params: ReactionParam): Promise => {
const client = generator(
rootState.TimelineSpace.sns,
rootState.TimelineSpace.account.baseURL,
@@ -139,10 +136,7 @@ const actions: ActionTree = {
rootState.App.proxyConfiguration
)
const res = await client.deleteEmojiReaction(params.status_id, params.native)
- if (res.data.reblog) {
- return res.data.reblog.emoji_reactions
- }
- return res.data.emoji_reactions
+ return res.data
}
}