logo

pleroma-fe

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

thread_tree.js (2260B)


  1. import Status from '../status/status.vue'
  2. import { library } from '@fortawesome/fontawesome-svg-core'
  3. import {
  4. faAngleDoubleDown,
  5. faAngleDoubleRight
  6. } from '@fortawesome/free-solid-svg-icons'
  7. library.add(
  8. faAngleDoubleDown,
  9. faAngleDoubleRight
  10. )
  11. const ThreadTree = {
  12. components: {
  13. Status
  14. },
  15. name: 'ThreadTree',
  16. props: {
  17. depth: Number,
  18. status: Object,
  19. inProfile: Boolean,
  20. conversation: Array,
  21. collapsable: Boolean,
  22. isExpanded: Boolean,
  23. pinnedStatusIdsObject: Object,
  24. profileUserId: String,
  25. focused: Function,
  26. highlight: String,
  27. getReplies: Function,
  28. setHighlight: Function,
  29. toggleExpanded: Function,
  30. simple: Boolean,
  31. // to control display of the whole thread forest
  32. toggleThreadDisplay: Function,
  33. threadDisplayStatus: Object,
  34. showThreadRecursively: Function,
  35. totalReplyCount: Object,
  36. totalReplyDepth: Object,
  37. statusContentProperties: Object,
  38. setStatusContentProperty: Function,
  39. toggleStatusContentProperty: Function,
  40. dive: Function
  41. },
  42. computed: {
  43. suspendable () {
  44. const selfSuspendable = this.$refs.statusComponent ? this.$refs.statusComponent.suspendable : true
  45. if (this.$refs.childComponent) {
  46. return selfSuspendable && this.$refs.childComponent.every(s => s.suspendable)
  47. }
  48. return selfSuspendable
  49. },
  50. reverseLookupTable () {
  51. return this.conversation.reduce((table, status, index) => {
  52. table[status.id] = index
  53. return table
  54. }, {})
  55. },
  56. currentReplies () {
  57. return this.getReplies(this.status.id).map(({ id }) => this.statusById(id))
  58. },
  59. threadShowing () {
  60. return this.threadDisplayStatus[this.status.id] === 'showing'
  61. },
  62. currentProp () {
  63. return this.statusContentProperties[this.status.id]
  64. }
  65. },
  66. methods: {
  67. statusById (id) {
  68. return this.conversation[this.reverseLookupTable[id]]
  69. },
  70. collapseThread () {
  71. },
  72. showThread () {
  73. },
  74. showAllSubthreads () {
  75. },
  76. toggleCurrentProp (name) {
  77. this.toggleStatusContentProperty(this.status.id, name)
  78. },
  79. setCurrentProp (name, newVal) {
  80. this.setStatusContentProperty(this.status.id, name)
  81. }
  82. }
  83. }
  84. export default ThreadTree