logo

pleroma-fe

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

account_actions.js (2627B)


  1. import { mapState } from 'vuex'
  2. import ProgressButton from '../progress_button/progress_button.vue'
  3. import Popover from '../popover/popover.vue'
  4. import UserListMenu from 'src/components/user_list_menu/user_list_menu.vue'
  5. import ConfirmModal from '../confirm_modal/confirm_modal.vue'
  6. import { library } from '@fortawesome/fontawesome-svg-core'
  7. import {
  8. faEllipsisV
  9. } from '@fortawesome/free-solid-svg-icons'
  10. library.add(
  11. faEllipsisV
  12. )
  13. const AccountActions = {
  14. props: [
  15. 'user', 'relationship'
  16. ],
  17. data () {
  18. return {
  19. showingConfirmBlock: false,
  20. showingConfirmRemoveFollower: false
  21. }
  22. },
  23. components: {
  24. ProgressButton,
  25. Popover,
  26. UserListMenu,
  27. ConfirmModal
  28. },
  29. methods: {
  30. showConfirmBlock () {
  31. this.showingConfirmBlock = true
  32. },
  33. hideConfirmBlock () {
  34. this.showingConfirmBlock = false
  35. },
  36. showConfirmRemoveUserFromFollowers () {
  37. this.showingConfirmRemoveFollower = true
  38. },
  39. hideConfirmRemoveUserFromFollowers () {
  40. this.showingConfirmRemoveFollower = false
  41. },
  42. showRepeats () {
  43. this.$store.dispatch('showReblogs', this.user.id)
  44. },
  45. hideRepeats () {
  46. this.$store.dispatch('hideReblogs', this.user.id)
  47. },
  48. blockUser () {
  49. if (!this.shouldConfirmBlock) {
  50. this.doBlockUser()
  51. } else {
  52. this.showConfirmBlock()
  53. }
  54. },
  55. doBlockUser () {
  56. this.$store.dispatch('blockUser', this.user.id)
  57. this.hideConfirmBlock()
  58. },
  59. unblockUser () {
  60. this.$store.dispatch('unblockUser', this.user.id)
  61. },
  62. removeUserFromFollowers () {
  63. if (!this.shouldConfirmRemoveUserFromFollowers) {
  64. this.doRemoveUserFromFollowers()
  65. } else {
  66. this.showConfirmRemoveUserFromFollowers()
  67. }
  68. },
  69. doRemoveUserFromFollowers () {
  70. this.$store.dispatch('removeUserFromFollowers', this.user.id)
  71. this.hideConfirmRemoveUserFromFollowers()
  72. },
  73. reportUser () {
  74. this.$store.dispatch('openUserReportingModal', { userId: this.user.id })
  75. },
  76. openChat () {
  77. this.$router.push({
  78. name: 'chat',
  79. params: { username: this.$store.state.users.currentUser.screen_name, recipient_id: this.user.id }
  80. })
  81. }
  82. },
  83. computed: {
  84. shouldConfirmBlock () {
  85. return this.$store.getters.mergedConfig.modalOnBlock
  86. },
  87. shouldConfirmRemoveUserFromFollowers () {
  88. return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers
  89. },
  90. ...mapState({
  91. pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable
  92. })
  93. }
  94. }
  95. export default AccountActions