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
This commit is contained in:
commit
767b965780
2 changed files with 23 additions and 5 deletions
|
@ -1,24 +1,41 @@
|
||||||
import PostStatusForm from '../post_status_form/post_status_form.vue'
|
import PostStatusForm from '../post_status_form/post_status_form.vue'
|
||||||
|
import get from 'lodash/get'
|
||||||
|
|
||||||
const PostStatusModal = {
|
const PostStatusModal = {
|
||||||
components: {
|
components: {
|
||||||
PostStatusForm
|
PostStatusForm
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
resettingForm: false
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isLoggedIn () {
|
isLoggedIn () {
|
||||||
return !!this.$store.state.users.currentUser
|
return !!this.$store.state.users.currentUser
|
||||||
},
|
},
|
||||||
isOpen () {
|
modalActivated () {
|
||||||
return this.isLoggedIn && this.$store.state.postStatus.modalActivated
|
return this.$store.state.postStatus.modalActivated
|
||||||
|
},
|
||||||
|
isFormVisible () {
|
||||||
|
return this.isLoggedIn && !this.resettingForm && this.modalActivated
|
||||||
},
|
},
|
||||||
params () {
|
params () {
|
||||||
return this.$store.state.postStatus.params || {}
|
return this.$store.state.postStatus.params || {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
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) {
|
if (val) {
|
||||||
this.$nextTick(() => this.$el.querySelector('textarea').focus())
|
this.$nextTick(() => this.$el && this.$el.querySelector('textarea').focus())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="isOpen"
|
v-if="isLoggedIn && !resettingForm"
|
||||||
|
v-show="modalActivated"
|
||||||
class="post-form-modal-view modal-view"
|
class="post-form-modal-view modal-view"
|
||||||
@click="closeModal"
|
@click="closeModal"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue