diff options
| author | Maksim Pechnikov <parallel588@gmail.com> | 2019-10-08 16:49:03 +0300 |
|---|---|---|
| committer | Maksim Pechnikov <parallel588@gmail.com> | 2019-10-08 16:49:03 +0300 |
| commit | 541a71c3a561e74d273c0b210bde70f4e0b31681 (patch) | |
| tree | 5a06decc988fb422c0431b4df270939d204fcc00 /src/components/post_status_modal/post_status_modal.js | |
| parent | a26d55013779d7b41e4a4aa0dc2477a6926116ae (diff) | |
| parent | 122323f35c32a4f12a345a8b3f163e9318f5dea3 (diff) | |
Merge branch 'develop' into feature/following_reblogs
Diffstat (limited to 'src/components/post_status_modal/post_status_modal.js')
| -rw-r--r-- | src/components/post_status_modal/post_status_modal.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/components/post_status_modal/post_status_modal.js b/src/components/post_status_modal/post_status_modal.js index 1033ba11..38258296 100644 --- a/src/components/post_status_modal/post_status_modal.js +++ b/src/components/post_status_modal/post_status_modal.js @@ -1,24 +1,41 @@ import PostStatusForm from '../post_status_form/post_status_form.vue' +import get from 'lodash/get' const PostStatusModal = { components: { PostStatusForm }, + data () { + return { + resettingForm: false + } + }, computed: { isLoggedIn () { return !!this.$store.state.users.currentUser }, - isOpen () { - return this.isLoggedIn && this.$store.state.postStatus.modalActivated + modalActivated () { + return this.$store.state.postStatus.modalActivated + }, + isFormVisible () { + return this.isLoggedIn && !this.resettingForm && this.modalActivated }, params () { return this.$store.state.postStatus.params || {} } }, watch: { - isOpen (val) { + params (newVal, oldVal) { + if (get(newVal, 'repliedUser.id') !== get(oldVal, 'repliedUser.id')) { + this.resettingForm = true + this.$nextTick(() => { + this.resettingForm = false + }) + } + }, + isFormVisible (val) { if (val) { - this.$nextTick(() => this.$el.querySelector('textarea').focus()) + this.$nextTick(() => this.$el && this.$el.querySelector('textarea').focus()) } } }, |
