aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/poll/poll.js12
-rw-r--r--src/components/status/status.vue2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/components/poll/poll.js b/src/components/poll/poll.js
index 9988070e..98db5582 100644
--- a/src/components/poll/poll.js
+++ b/src/components/poll/poll.js
@@ -3,7 +3,7 @@ import { forEach, map } from 'lodash'
export default {
name: 'Poll',
- props: ['pollId'],
+ props: ['basePoll'],
components: { Timeago },
data () {
return {
@@ -11,13 +11,19 @@ export default {
choices: []
}
},
- mounted () {
+ created () {
+ if (!this.$store.state.polls.pollsObject[this.pollId]) {
+ this.$store.dispatch('mergeOrAddPoll', this.basePoll)
+ }
this.$store.dispatch('trackPoll', this.pollId)
},
destroyed () {
this.$store.dispatch('untrackPoll', this.pollId)
},
computed: {
+ pollId () {
+ return this.basePoll.id
+ },
poll () {
const storePoll = this.$store.state.polls.pollsObject[this.pollId]
return storePoll || {}
@@ -29,7 +35,7 @@ export default {
return (this.poll && this.poll.expires_at) || 0
},
expired () {
- return Date.now() > Date.parse(this.expiresAt)
+ return (this.poll && this.poll.expired) || false
},
loggedIn () {
return this.$store.state.users.currentUser
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index 821a7a83..440e1957 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -124,7 +124,7 @@
</div>
<div v-if="status.poll && status.poll.options">
- <poll :poll-id="status.poll.id" />
+ <poll :base-poll="status.poll" />
</div>
<div v-if="status.attachments && (!hideSubjectStatus || showingLongSubject)" class="attachments media-body">