Merge pull request 'quote-small-fix' (#3532) from quote-small-fix into develop

Reviewed-on: https://git.pleroma.social/pleroma/pleroma-fe/pulls/3532
This commit is contained in:
HJ 2026-08-05 14:34:55 +00:00
commit de2b6fba8a
5 changed files with 37 additions and 19 deletions

View file

@ -25,6 +25,10 @@ export default {
}, },
emits: ['update:modelValue'], emits: ['update:modelValue'],
computed: { computed: {
// Model value
options() {
return pollFallback(this.modelValue, 'options')
},
pollType: { pollType: {
get() { get() {
return pollFallback(this.modelValue, 'pollType') return pollFallback(this.modelValue, 'pollType')
@ -36,14 +40,6 @@ export default {
}) })
}, },
}, },
options: {
get() {
return pollFallback(this.modelValue, 'options')
},
set(newVal) {
this.$emit('update:modelValue', { ...this.modelValue, options: newVal })
},
},
expiryAmount: { expiryAmount: {
get() { get() {
return pollFallback(this.modelValue, 'expiryAmount') return pollFallback(this.modelValue, 'expiryAmount')
@ -66,6 +62,8 @@ export default {
}) })
}, },
}, },
// Configuration
pollLimits() { pollLimits() {
return useInstanceStore().limits.pollLimits return useInstanceStore().limits.pollLimits
}, },
@ -116,19 +114,34 @@ export default {
}, },
addOption() { addOption() {
if (this.options.length < this.maxOptions) { if (this.options.length < this.maxOptions) {
this.options = [...this.options, ''] this.$emit('update:modelValue', {
...this.modelValue,
options: [...this.options, ''],
})
return true return true
} }
return false return false
}, },
deleteOption(index) { deleteOption(index) {
if (this.options.length > 2) { if (this.options.length > 2) {
this.options.splice(index, 1) const options = [...this.options]
this.options = this.options options.splice(index, 1)
this.$emit('update:modelValue', {
...this.modelValue,
options,
})
} }
}, },
updateOption(index, value) { updateOption(index, value) {
this.options = this.options const options = [...this.options]
options[index] = value
this.$emit('update:modelValue', {
...this.modelValue,
options,
})
}, },
convertExpiryToUnit(unit, amount) { convertExpiryToUnit(unit, amount) {
// Note: we want seconds and not milliseconds // Note: we want seconds and not milliseconds

View file

@ -11,14 +11,15 @@
<div class="input-container"> <div class="input-container">
<input <input
:id="`poll-${index}`" :id="`poll-${index}`"
v-model="options[index]" :model-value="options[index]"
size="1" size="1"
class="input poll-option-input" class="input poll-option-input"
type="text" type="text"
:placeholder="$t('polls.option')" :placeholder="$t('polls.option')"
:maxlength="maxLength" :maxlength="maxLength"
:aria-label="$t('polls.option')"
@keydown.enter.stop.prevent="nextOption(index)" @keydown.enter.stop.prevent="nextOption(index)"
@change="updateOption" @change="(e) => updateOption(index, e.target.value)"
> >
</div> </div>
<button <button
@ -69,6 +70,7 @@
class="input expiry-amount hide-number-spinner" class="input expiry-amount hide-number-spinner"
:min="minExpirationInCurrentUnit" :min="minExpirationInCurrentUnit"
:max="maxExpirationInCurrentUnit" :max="maxExpirationInCurrentUnit"
:aria-label="$t('polls.expiry_amount')"
@change="expiryAmountChange" @change="expiryAmountChange"
> >
{{ ' ' }} {{ ' ' }}
@ -77,6 +79,7 @@
unstyled="true" unstyled="true"
class="expiry-unit" class="expiry-unit"
@change="expiryAmountChange" @change="expiryAmountChange"
:aria-label="$t('polls.expiry_unit')"
> >
<option <option
v-for="unit in expiryUnits" v-for="unit in expiryUnits"

View file

@ -378,8 +378,8 @@ const PostStatusForm = {
set(value) { set(value) {
if (value) { if (value) {
this.newStatus.quote = {} this.newStatus.quote = {}
this.newStatus.quote.thread = value this.newStatus.quote.thread = true
this.newStatus.quote.id = value ? this.repliedStatus.id : '' this.newStatus.quote.id = this.repliedStatus.id
} else { } else {
this.newStatus.quote = null this.newStatus.quote = null
} }
@ -509,9 +509,7 @@ const PostStatusForm = {
// Error handling // Error handling
pollContentError() { pollContentError() {
return ( return this.pollFormVisible && this.newStatus.poll?.error
this.pollFormVisible && this.newStatus.poll && this.newStatus.poll.error
)
}, },
// Featureset detection // Featureset detection
@ -959,6 +957,7 @@ const PostStatusForm = {
// Quote // Quote
toggleQuoteForm() { toggleQuoteForm() {
// This is for the "attach quote" button // This is for the "attach quote" button
if (this.newStatus.quote?.thread) return
if (!this.hasQuote) { if (!this.hasQuote) {
this.newStatus.quote = {} this.newStatus.quote = {}
this.newStatus.quote.thread = false this.newStatus.quote.thread = false

View file

@ -10,6 +10,7 @@
size="1" size="1"
class="input" class="input"
:placeholder="$t('post_status.quote_url')" :placeholder="$t('post_status.quote_url')"
:aria-label="$t('post_status.quote_url')"
> >
</div> </div>
<Quote <Quote

View file

@ -242,6 +242,8 @@
"single_choice": "Single choice", "single_choice": "Single choice",
"multiple_choices": "Multiple choices", "multiple_choices": "Multiple choices",
"expiry": "Poll age", "expiry": "Poll age",
"expiry_unit": "Expiry unit",
"expiry_amount": "Expiry amount",
"expires_at": "Poll ends {0}", "expires_at": "Poll ends {0}",
"expires_in": "Poll ends in {0}", "expires_in": "Poll ends in {0}",
"expired": "Poll ended {0} ago", "expired": "Poll ended {0} ago",