refs #1921 Update status in vuex after vote polls

This commit is contained in:
AkiraFukushima 2020-11-28 18:28:07 +09:00
parent e035d7569e
commit 62b5542e09
1 changed files with 10 additions and 11 deletions

View File

@ -25,9 +25,7 @@
role="article" role="article"
aria-label="toot" aria-label="toot"
> >
<div v-show="filtered" class="filtered"> <div v-show="filtered" class="filtered">Filtered</div>
Filtered
</div>
<div v-show="!filtered" class="toot"> <div v-show="!filtered" class="toot">
<div class="icon" role="presentation"> <div class="icon" role="presentation">
<FailoverImg <FailoverImg
@ -275,7 +273,6 @@ export default {
showAttachments: this.$store.state.App.ignoreNFSW, showAttachments: this.$store.state.App.ignoreNFSW,
hideAllAttachments: this.$store.state.App.hideAllAttachments, hideAllAttachments: this.$store.state.App.hideAllAttachments,
now: Date.now(), now: Date.now(),
pollResponse: null,
openEmojiPicker: false openEmojiPicker: false
} }
}, },
@ -367,11 +364,7 @@ export default {
return !this.spoilered || this.showContent return !this.spoilered || this.showContent
}, },
poll: function () { poll: function () {
if (this.pollResponse) {
return this.pollResponse
} else {
return this.originalMessage.poll return this.originalMessage.poll
}
}, },
sensitive: function () { sensitive: function () {
return (this.hideAllAttachments || this.originalMessage.sensitive) && this.mediaAttachments.length > 0 return (this.hideAllAttachments || this.originalMessage.sensitive) && this.mediaAttachments.length > 0
@ -684,11 +677,17 @@ export default {
id: this.poll.id, id: this.poll.id,
choices: choices choices: choices
}) })
this.pollResponse = res const status = Object.assign({}, this.originalMessage, {
poll: res
})
this.$emit('update', status)
}, },
async refresh(id) { async refresh(id) {
const res = await this.$store.dispatch('organisms/Toot/refresh', id) const res = await this.$store.dispatch('organisms/Toot/refresh', id)
this.pollResponse = res const status = Object.assign({}, this.originalMessage, {
poll: res
})
this.$emit('update', status)
}, },
toggleEmojiPicker() { toggleEmojiPicker() {
this.openEmojiPicker = !this.openEmojiPicker this.openEmojiPicker = !this.openEmojiPicker