logo

pleroma-fe

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

user_note.js (826B)


  1. const UserNote = {
  2. props: {
  3. user: Object,
  4. relationship: Object,
  5. editable: Boolean
  6. },
  7. data () {
  8. return {
  9. localNote: '',
  10. editing: false,
  11. frozen: false
  12. }
  13. },
  14. computed: {
  15. shouldShow () {
  16. return this.relationship.note || this.editing
  17. }
  18. },
  19. methods: {
  20. startEditing () {
  21. this.localNote = this.relationship.note
  22. this.editing = true
  23. },
  24. cancelEditing () {
  25. this.editing = false
  26. },
  27. finalizeEditing () {
  28. this.frozen = true
  29. this.$store.dispatch('editUserNote', {
  30. id: this.user.id,
  31. comment: this.localNote
  32. })
  33. .then(() => {
  34. this.frozen = false
  35. this.editing = false
  36. })
  37. .catch(() => {
  38. this.frozen = false
  39. })
  40. }
  41. }
  42. }
  43. export default UserNote