logo

pleroma-fe

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

action_button_container.js (2075B)


  1. import ActionButton from './action_button.vue'
  2. import Popover from 'src/components/popover/popover.vue'
  3. import MuteConfirm from 'src/components/confirm_modal/mute_confirm.vue'
  4. import { library } from '@fortawesome/fontawesome-svg-core'
  5. import {
  6. faUser,
  7. faGlobe,
  8. faFolderTree
  9. } from '@fortawesome/free-solid-svg-icons'
  10. library.add(
  11. faUser,
  12. faGlobe,
  13. faFolderTree
  14. )
  15. export default {
  16. components: {
  17. ActionButton,
  18. Popover,
  19. MuteConfirm
  20. },
  21. props: ['button', 'status'],
  22. mounted () {
  23. if (this.button.name === 'mute') {
  24. this.$store.dispatch('fetchDomainMutes')
  25. }
  26. },
  27. computed: {
  28. buttonClass () {
  29. return [
  30. this.button.name + '-button',
  31. {
  32. '-with-extra': this.button.name === 'bookmark',
  33. '-extra': this.extra,
  34. '-quick': !this.extra
  35. }
  36. ]
  37. },
  38. user () {
  39. return this.status.user
  40. },
  41. userIsMuted () {
  42. return this.$store.getters.relationship(this.user.id).muting
  43. },
  44. conversationIsMuted () {
  45. return this.status.thread_muted
  46. },
  47. domain () {
  48. return this.user.fqn.split('@')[1]
  49. },
  50. domainIsMuted () {
  51. return new Set(this.$store.state.users.currentUser.domainMutes).has(this.domain)
  52. }
  53. },
  54. methods: {
  55. unmuteUser () {
  56. return this.$store.dispatch('unmuteUser', this.user.id)
  57. },
  58. unmuteThread () {
  59. return this.$store.dispatch('unmuteConversation', this.user.id)
  60. },
  61. unmuteDomain () {
  62. return this.$store.dispatch('unmuteDomain', this.user.id)
  63. },
  64. toggleUserMute () {
  65. if (this.userIsMuted) {
  66. this.unmuteUser()
  67. } else {
  68. this.$refs.confirmUser.optionallyPrompt()
  69. }
  70. },
  71. toggleConversationMute () {
  72. if (this.conversationIsMuted) {
  73. this.unmuteConversation()
  74. } else {
  75. this.$refs.confirmConversation.optionallyPrompt()
  76. }
  77. },
  78. toggleDomainMute () {
  79. if (this.domainIsMuted) {
  80. this.unmuteDomain()
  81. } else {
  82. this.$refs.confirmDomain.optionallyPrompt()
  83. }
  84. }
  85. }
  86. }