Merge branch 'small-fixes-and-improvements' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2026-05-12 19:01:00 +03:00
commit f7de259e53
4 changed files with 35 additions and 42 deletions

View file

@ -152,9 +152,6 @@ const PostStatusForm = {
DraftCloser, DraftCloser,
Popover, Popover,
}, },
created() {
this.initQuote()
},
mounted() { mounted() {
this.updateIdempotencyKey() this.updateIdempotencyKey()
this.resize(this.$refs.textarea) this.resize(this.$refs.textarea)
@ -861,19 +858,6 @@ const PostStatusForm = {
this.$refs.pollForm.clear() this.$refs.pollForm.clear()
} }
}, },
initQuote() {
const quote = this.newStatus.quote
if (Object.keys(quote).length > 0) {
return
}
const quotable = this.defaultQuotable
quote.id = quotable ? this.replyTo : ''
quote.url = ''
quote.thread = quotable
},
clearQuoteForm() { clearQuoteForm() {
if (this.$refs.quoteForm) { if (this.$refs.quoteForm) {
this.$refs.quoteForm.clear() this.$refs.quoteForm.clear()
@ -881,6 +865,11 @@ const PostStatusForm = {
}, },
toggleQuoteForm() { toggleQuoteForm() {
this.newStatus.hasQuote = !this.newStatus.hasQuote this.newStatus.hasQuote = !this.newStatus.hasQuote
this.newStatus.quote = {}
this.newStatus.quote.thread = false
this.newStatus.quote.id = null
this.newStatus.quote.url = ''
}, },
dismissScopeNotice() { dismissScopeNotice() {
useSyncConfigStore().setSimplePrefAndSave({ useSyncConfigStore().setSimplePrefAndSave({

View file

@ -256,18 +256,20 @@
</div> </div>
</div> </div>
</div> </div>
<poll-form <PollForm
v-if="pollsAvailable" v-if="pollsAvailable"
ref="pollForm" ref="pollForm"
:visible="pollFormVisible" :visible="pollFormVisible"
:params="newStatus.poll" :params="newStatus.poll"
/> />
<quote-form <QuoteForm
v-if="quotingAvailable" v-if="quotingAvailable"
ref="quoteForm" ref="quoteForm"
:visible="quoteFormVisible" :visible="quoteFormVisible"
:reply="isReply" :url="newStatus.quote.url"
:params="newStatus.quote" :id="newStatus.quote.id"
@update:url="url => newStatus.quote.url = url"
@update:id="id => newStatus.quote.id = id"
/> />
<span <span
v-if="!disableDraft && shouldAutoSaveDraft" v-if="!disableDraft && shouldAutoSaveDraft"

View file

@ -15,17 +15,20 @@ export default {
visible: { visible: {
type: Boolean, type: Boolean,
}, },
reply: { url: {
type: Boolean, type: String,
required: false,
default: '',
}, },
params: { id: {
type: Object, type: String,
required: true, required: false,
default: '',
}, },
}, },
data() { data() {
return { return {
text: this.params.url, text: this.url,
loading: false, loading: false,
error: false, error: false,
debounceSetQuote: debounce((value) => { debounceSetQuote: debounce((value) => {
@ -34,16 +37,15 @@ export default {
} }
}, },
created() { created() {
if (this.params.url && !this.params.id) { if (this.url && !this.id) {
this.fetchStatus(this.params.url) this.fetchStatus(this.url)
} else if (this.params.id) { } else if (this.id) {
this.text = this.text =
window.location.protocol + window.location.protocol +
'//' + '//' +
this.instanceHost + this.instanceHost +
'/notice/' + '/notice/' +
this.params.id this.id
this.params.url = this.text
} }
}, },
computed: { computed: {
@ -56,22 +58,23 @@ export default {
) )
}, },
quoteVisible() { quoteVisible() {
return (!!this.params.id || this.loading) && !this.error return (!!this.id || this.loading) && !this.error
}, },
}, },
watch: { watch: {
text(value) { text(value) {
this.debounceSetQuote(value) this.debounceSetQuote(value)
this.$emit('update:url', value)
}, },
visible(value) { visible(value) {
if (value && this.params.url) { if (value && this.url) {
this.fetchStatus(this.params.url) this.fetchStatus(this.url)
} }
}, },
}, },
methods: { methods: {
clear() { clear() {
this.text = this.params.url this.text = this.url
this.loading = false this.loading = false
this.error = false this.error = false
}, },
@ -79,16 +82,15 @@ export default {
this.loading = value this.loading = value
}, },
handleError(error) { handleError(error) {
this.params.id = null this.id = null
this.error = !!error this.error = !!error
}, },
fetchStatus(value) { fetchStatus(value) {
this.params.url = value
this.error = false this.error = false
const notice = this.noticeRegex.exec(value) const notice = this.noticeRegex.exec(value)
if (notice && notice.length === 4) { if (notice && notice.length === 4) {
this.params.id = notice[3] this.$emit('update:id', notice[3])
} else if (value) { } else if (value) {
this.loading = true this.loading = true
this.$store this.$store
@ -101,7 +103,7 @@ export default {
}) })
.then((data) => { .then((data) => {
if (data && data.statuses && data.statuses.length === 1) { if (data && data.statuses && data.statuses.length === 1) {
this.params.id = data.statuses[0].id this.$emit('update:id', data.statuses[0].id)
} else { } else {
this.handleError(true) this.handleError(true)
} }
@ -111,7 +113,7 @@ export default {
this.loading = false this.loading = false
}) })
} else { } else {
this.params.id = null this.$emit('update:id', null)
} }
}, },
}, },

View file

@ -13,8 +13,8 @@
> >
</div> </div>
<Quote <Quote
:status-id="params.id" :status-id="id"
:status-url="params.url" :status-url="url"
:status-visible="quoteVisible" :status-visible="quoteVisible"
:initially-expanded="true" :initially-expanded="true"
:loading="loading" :loading="loading"