pleroma-fe/src/components/report/report.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2026-01-06 16:23:17 +02:00
import RichContent from 'src/components/rich_content/rich_content.jsx'
import Select from '../select/select.vue'
2021-01-11 19:32:58 +02:00
import StatusContent from '../status_content/status_content.vue'
import Timeago from '../timeago/timeago.vue'
2026-01-29 20:40:00 +02:00
import { useInstanceStore } from 'src/stores/instance.js'
2026-01-29 20:44:55 +02:00
import { useReportsStore } from 'src/stores/reports.js'
2026-01-29 20:40:00 +02:00
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
2021-01-11 19:32:58 +02:00
const Report = {
2026-01-06 16:22:52 +02:00
props: ['reportId'],
2021-01-11 19:32:58 +02:00
components: {
Select,
2021-01-11 19:32:58 +02:00
StatusContent,
2023-10-27 02:44:22 +03:00
Timeago,
2026-01-06 16:22:52 +02:00
RichContent,
2021-01-11 19:32:58 +02:00
},
2021-01-18 15:26:08 +02:00
computed: {
2026-01-06 16:22:52 +02:00
report() {
2023-04-06 17:59:12 -06:00
return useReportsStore().reports[this.reportId] || {}
2021-01-27 13:13:10 +02:00
},
state: {
2026-01-06 16:22:52 +02:00
get: function () {
return this.report.state
},
set: function (val) {
this.setReportState(val)
},
},
2021-01-18 15:26:08 +02:00
},
2021-01-11 19:32:58 +02:00
methods: {
2026-01-06 16:22:52 +02:00
generateUserProfileLink(user) {
return generateProfileLink(
user.id,
user.screen_name,
useInstanceStore().restrictedNicknames,
2026-01-06 16:22:52 +02:00
)
2021-01-11 19:32:58 +02:00
},
2026-01-06 16:22:52 +02:00
setReportState(state) {
2023-04-06 17:59:12 -06:00
return useReportsStore().setReportState({ id: this.report.id, state })
2026-01-06 16:22:52 +02:00
},
},
2021-01-11 19:32:58 +02:00
}
export default Report