logo

pleroma-fe

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

retweet_button.js (1482B)


  1. import ConfirmModal from '../confirm_modal/confirm_modal.vue'
  2. import { library } from '@fortawesome/fontawesome-svg-core'
  3. import {
  4. faRetweet,
  5. faPlus,
  6. faMinus,
  7. faCheck
  8. } from '@fortawesome/free-solid-svg-icons'
  9. library.add(
  10. faRetweet,
  11. faPlus,
  12. faMinus,
  13. faCheck
  14. )
  15. const RetweetButton = {
  16. props: ['status', 'loggedIn', 'visibility'],
  17. components: {
  18. ConfirmModal
  19. },
  20. data () {
  21. return {
  22. animated: false,
  23. showingConfirmDialog: false
  24. }
  25. },
  26. methods: {
  27. retweet () {
  28. if (!this.status.repeated && this.shouldConfirmRepeat) {
  29. this.showConfirmDialog()
  30. } else {
  31. this.doRetweet()
  32. }
  33. },
  34. doRetweet () {
  35. if (!this.status.repeated) {
  36. this.$store.dispatch('retweet', { id: this.status.id })
  37. } else {
  38. this.$store.dispatch('unretweet', { id: this.status.id })
  39. }
  40. this.animated = true
  41. setTimeout(() => {
  42. this.animated = false
  43. }, 500)
  44. this.hideConfirmDialog()
  45. },
  46. showConfirmDialog () {
  47. this.showingConfirmDialog = true
  48. },
  49. hideConfirmDialog () {
  50. this.showingConfirmDialog = false
  51. }
  52. },
  53. computed: {
  54. mergedConfig () {
  55. return this.$store.getters.mergedConfig
  56. },
  57. remoteInteractionLink () {
  58. return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
  59. },
  60. shouldConfirmRepeat () {
  61. return this.mergedConfig.modalOnRepeat
  62. }
  63. }
  64. }
  65. export default RetweetButton