logo

pleroma-fe

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

remove_follower_button.js (1240B)


  1. import ConfirmModal from '../confirm_modal/confirm_modal.vue'
  2. export default {
  3. props: ['user', 'relationship'],
  4. data () {
  5. return {
  6. inProgress: false,
  7. showingConfirmRemoveFollower: false
  8. }
  9. },
  10. components: {
  11. ConfirmModal
  12. },
  13. computed: {
  14. label () {
  15. if (this.inProgress) {
  16. return this.$t('user_card.follow_progress')
  17. } else {
  18. return this.$t('user_card.remove_follower')
  19. }
  20. },
  21. shouldConfirmRemoveUserFromFollowers () {
  22. return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers
  23. }
  24. },
  25. methods: {
  26. showConfirmRemoveUserFromFollowers () {
  27. this.showingConfirmRemoveFollower = true
  28. },
  29. hideConfirmRemoveUserFromFollowers () {
  30. this.showingConfirmRemoveFollower = false
  31. },
  32. onClick () {
  33. if (!this.shouldConfirmRemoveUserFromFollowers) {
  34. this.doRemoveUserFromFollowers()
  35. } else {
  36. this.showConfirmRemoveUserFromFollowers()
  37. }
  38. },
  39. doRemoveUserFromFollowers () {
  40. this.inProgress = true
  41. this.$store.dispatch('removeUserFromFollowers', this.relationship.id).then(() => {
  42. this.inProgress = false
  43. })
  44. this.hideConfirmRemoveUserFromFollowers()
  45. }
  46. }
  47. }