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