logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

post_status_modal.js (1299B)


  1. import PostStatusForm from '../post_status_form/post_status_form.vue'
  2. import Modal from '../modal/modal.vue'
  3. import get from 'lodash/get'
  4. const PostStatusModal = {
  5. components: {
  6. PostStatusForm,
  7. Modal
  8. },
  9. data () {
  10. return {
  11. resettingForm: false
  12. }
  13. },
  14. computed: {
  15. isLoggedIn () {
  16. return !!this.$store.state.users.currentUser
  17. },
  18. modalActivated () {
  19. return this.$store.state.postStatus.modalActivated
  20. },
  21. isFormVisible () {
  22. return this.isLoggedIn && !this.resettingForm && this.modalActivated
  23. },
  24. params () {
  25. return this.$store.state.postStatus.params || {}
  26. }
  27. },
  28. watch: {
  29. params (newVal, oldVal) {
  30. if (get(newVal, 'repliedUser.id') !== get(oldVal, 'repliedUser.id')) {
  31. this.resettingForm = true
  32. this.$nextTick(() => {
  33. this.resettingForm = false
  34. })
  35. }
  36. },
  37. isFormVisible (val) {
  38. if (val) {
  39. this.$nextTick(() => this.$el && this.$el.querySelector('textarea').focus())
  40. }
  41. }
  42. },
  43. methods: {
  44. closeModal () {
  45. this.$store.dispatch('closePostStatusModal')
  46. },
  47. resetAndClose () {
  48. this.$store.dispatch('resetPostStatusModal')
  49. this.$store.dispatch('closePostStatusModal')
  50. }
  51. }
  52. }
  53. export default PostStatusModal