Merge pull request #1426 from h3poteto/iss-1425
closes #1425 Fix update after react emoji to the statuses
This commit is contained in:
commit
033ef86ca0
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue