logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: 767b9657803746d04dd139c6a5a6efd7425df054
parent: aadd36f3ec2d5131deae43a4e8042455a90ca16f
Author: Shpuld Shpludson <shp@cock.li>
Date:   Mon, 30 Sep 2019 05:05:12 +0000

Merge branch '672' into 'develop'

Make post status modal state persistent unless reply user is changed

Closes #672

See merge request pleroma/pleroma-fe!959

Diffstat:

Msrc/components/post_status_modal/post_status_modal.js25+++++++++++++++++++++----
Msrc/components/post_status_modal/post_status_modal.vue3++-
2 files changed, 23 insertions(+), 5 deletions(-)

diff --git 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()) } } }, diff --git a/src/components/post_status_modal/post_status_modal.vue b/src/components/post_status_modal/post_status_modal.vue @@ -1,6 +1,7 @@ <template> <div - v-if="isOpen" + v-if="isLoggedIn && !resettingForm" + v-show="modalActivated" class="post-form-modal-view modal-view" @click="closeModal" >