Merge pull request #1426 from h3poteto/iss-1425

closes #1425 Fix update after react emoji to the statuses
This commit is contained in:
AkiraFukushima 2020-05-06 00:14:57 +09:00 committed by GitHub
commit 033ef86ca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 27 deletions

2
package-lock.json generated
View File

@ -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
}

View File

@ -104,7 +104,7 @@
</span>
</div>
<div class="emoji-reactions">
<template v-for="reaction in reactions">
<template v-for="reaction in originalMessage.emoji_reactions">
<el-button v-if="reaction.me" type="success" size="medium" class="reaction" @click="removeReaction(reaction.name)"
>{{ reaction.name }} {{ reaction.count }}</el-button
>
@ -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)
}
}
}

View File

@ -116,7 +116,7 @@ const actions: ActionTree<TootState, RootState> = {
const res = await client.getPoll(id)
return res.data
},
sendReaction: async ({ rootState }, params: ReactionParam): Promise<Array<Entity.Reaction>> => {
sendReaction: async ({ rootState }, params: ReactionParam): Promise<Entity.Status> => {
const client = generator(
rootState.TimelineSpace.sns,
rootState.TimelineSpace.account.baseURL,
@ -125,12 +125,9 @@ const actions: ActionTree<TootState, RootState> = {
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<Array<Entity.Reaction>> => {
deleteReaction: async ({ rootState }, params: ReactionParam): Promise<Entity.Status> => {
const client = generator(
rootState.TimelineSpace.sns,
rootState.TimelineSpace.account.baseURL,
@ -139,10 +136,7 @@ const actions: ActionTree<TootState, RootState> = {
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
}
}