diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 805b46745..886feabc7 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -152,6 +152,9 @@ const PostStatusForm = {
DraftCloser,
Popover,
},
+ created() {
+ this.initQuote()
+ },
mounted() {
this.updateIdempotencyKey()
this.resize(this.$refs.textarea)
@@ -858,6 +861,19 @@ const PostStatusForm = {
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() {
if (this.$refs.quoteForm) {
this.$refs.quoteForm.clear()
@@ -865,11 +881,6 @@ const PostStatusForm = {
},
toggleQuoteForm() {
this.newStatus.hasQuote = !this.newStatus.hasQuote
-
- this.newStatus.quote = {}
- this.newStatus.quote.thread = false
- this.newStatus.quote.id = null
- this.newStatus.quote.url = ''
},
dismissScopeNotice() {
useSyncConfigStore().setSimplePrefAndSave({
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 3d5e27d77..3a319e85a 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -256,20 +256,18 @@
-
- newStatus.quote.url = url"
- @update:id="id => newStatus.quote.id = id"
+ :reply="isReply"
+ :params="newStatus.quote"
/>
{
@@ -37,15 +34,16 @@ export default {
}
},
created() {
- if (this.url && !this.id) {
- this.fetchStatus(this.url)
- } else if (this.id) {
+ if (this.params.url && !this.params.id) {
+ this.fetchStatus(this.params.url)
+ } else if (this.params.id) {
this.text =
window.location.protocol +
'//' +
this.instanceHost +
'/notice/' +
- this.id
+ this.params.id
+ this.params.url = this.text
}
},
computed: {
@@ -58,23 +56,22 @@ export default {
)
},
quoteVisible() {
- return (!!this.id || this.loading) && !this.error
+ return (!!this.params.id || this.loading) && !this.error
},
},
watch: {
text(value) {
this.debounceSetQuote(value)
- this.$emit('update:url', value)
},
visible(value) {
- if (value && this.url) {
- this.fetchStatus(this.url)
+ if (value && this.params.url) {
+ this.fetchStatus(this.params.url)
}
},
},
methods: {
clear() {
- this.text = this.url
+ this.text = this.params.url
this.loading = false
this.error = false
},
@@ -82,15 +79,16 @@ export default {
this.loading = value
},
handleError(error) {
- this.id = null
+ this.params.id = null
this.error = !!error
},
fetchStatus(value) {
+ this.params.url = value
this.error = false
const notice = this.noticeRegex.exec(value)
if (notice && notice.length === 4) {
- this.$emit('update:id', notice[3])
+ this.params.id = notice[3]
} else if (value) {
this.loading = true
this.$store
@@ -103,7 +101,7 @@ export default {
})
.then((data) => {
if (data && data.statuses && data.statuses.length === 1) {
- this.$emit('update:id', data.statuses[0].id)
+ this.params.id = data.statuses[0].id
} else {
this.handleError(true)
}
@@ -113,7 +111,7 @@ export default {
this.loading = false
})
} else {
- this.$emit('update:id', null)
+ this.params.id = null
}
},
},
diff --git a/src/components/quote/quote_form.vue b/src/components/quote/quote_form.vue
index 2e7200d7f..b0b277a2b 100644
--- a/src/components/quote/quote_form.vue
+++ b/src/components/quote/quote_form.vue
@@ -13,8 +13,8 @@
>