logo

pleroma-fe

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

account_actions.js (2674B)


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