logo

pleroma-fe

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

edit_status_modal.js (1231B)


  1. import EditStatusForm from '../edit_status_form/edit_status_form.vue'
  2. import Modal from '../modal/modal.vue'
  3. import get from 'lodash/get'
  4. const EditStatusModal = {
  5. components: {
  6. EditStatusForm,
  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.editStatus.modalActivated
  20. },
  21. isFormVisible () {
  22. return this.isLoggedIn && !this.resettingForm && this.modalActivated
  23. },
  24. params () {
  25. return this.$store.state.editStatus.params || {}
  26. }
  27. },
  28. watch: {
  29. params (newVal, oldVal) {
  30. if (get(newVal, 'statusId') !== get(oldVal, 'statusId')) {
  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.$refs.editStatusForm.requestClose()
  46. },
  47. doCloseModal () {
  48. this.$store.dispatch('closeEditStatusModal')
  49. }
  50. }
  51. }
  52. export default EditStatusModal