From 81cfcae4338576b23053749b7e9b02edc6646463 Mon Sep 17 00:00:00 2001 From: tusooa Date: Tue, 2 May 2023 08:06:55 -0400 Subject: [PATCH] Fix adding poll options not working --- src/components/poll/poll_form.js | 24 ++++++++++--------- .../post_status_form/post_status_form.vue | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/poll/poll_form.js b/src/components/poll/poll_form.js index 032b3695..29ccbc4b 100644 --- a/src/components/poll/poll_form.js +++ b/src/components/poll/poll_form.js @@ -19,28 +19,30 @@ export default { name: 'PollForm', props: { visible: {}, - modelValue: { + params: { type: Object, required: true } }, - emits: ['update:modelValue'], computed: { pollType: { - get () { return pollFallback(this.modelValue, 'pollType') }, - set (newVal) { this.modelValue.pollType = newVal } + get () { return pollFallback(this.params, 'pollType') }, + set (newVal) { this.params.pollType = newVal } }, - options: { - get () { return pollFallback(this.modelValue, 'options') }, - set (newVal) { this.modelValue.options = newVal } + options () { + const hasOptions = !!this.params.options + if (!hasOptions) { + this.params.options = pollFallback(this.params, 'options') + } + return this.params.options }, expiryAmount: { - get () { return pollFallback(this.modelValue, 'expiryAmount') }, - set (newVal) { this.modelValue.expiryAmount = newVal } + get () { return pollFallback(this.params, 'expiryAmount') }, + set (newVal) { this.params.expiryAmount = newVal } }, expiryUnit: { - get () { return pollFallback(this.modelValue, 'expiryUnit') }, - set (newVal) { this.modelValue.expiryUnit = newVal } + get () { return pollFallback(this.params, 'expiryUnit') }, + set (newVal) { this.params.expiryUnit = newVal } }, pollLimits () { return this.$store.state.instance.pollLimits diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index b8523802..a863fbbc 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -233,7 +233,7 @@ v-if="pollsAvailable" ref="pollForm" :visible="pollFormVisible" - v-model="newStatus.poll" + :params="newStatus.poll" />