aboutsummaryrefslogtreecommitdiff
path: root/src/components/report/report.js
blob: 760557646f7e13503940d7c9dafdf7d3554437c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import Select from '../select/select.vue'
import StatusContent from '../status_content/status_content.vue'
import Timeago from '../timeago/timeago.vue'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'

const Report = {
  props: [
    'reportId'
  ],
  components: {
    Select,
    StatusContent,
    Timeago
  },
  computed: {
    report () {
      return this.$store.state.reports.reports[this.reportId] || {}
    },
    state: {
      get: function () { return this.report.state },
      set: function (val) { this.setReportState(val) }
    }
  },
  methods: {
    generateUserProfileLink (user) {
      return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
    },
    setReportState (state) {
      return this.$store.dispatch('setReportState', { id: this.report.id, state })
    }
  }
}

export default Report