diff --git a/components/report/ReportModal.vue b/components/report/ReportModal.vue index 4ffc9215ee..05d10c0795 100644 --- a/components/report/ReportModal.vue +++ b/components/report/ReportModal.vue @@ -16,6 +16,9 @@ const { client } = useMasto() const step = ref('selectCategory') const serverRules = ref((await client.value.v2.instance.fetch()).rules || []) const reportReason = ref('') +const considersIllegal = ref(false) +const considersIllegalCountry = ref('') +const considersIllegalSignature = ref(false) const selectedRuleIds = ref([]) const availableStatuses = ref(status ? [status] : []) const selectedStatusIds = ref(status ? [status.id] : []) @@ -24,7 +27,7 @@ const forwardReport = ref(false) const isAuthorized = ref(await checkAuthorization()) const server = useRuntimeConfig().public.defaultServer -const anonymousReportUrl = `https://${server}/api/v1/anonymous-reports` +const reportUrl = `https://${server}/api/v1/reports` const dismissButton = ref() @@ -74,19 +77,6 @@ async function loadStatuses() { } async function submitReport() { - await client.value.v1.reports.create({ - accountId: account.id, - statusIds: selectedStatusIds.value, - comment: additionalComments.value, - forward: forwardReport.value, - category: reportReason.value === 'spam' ? 'spam' : reportReason.value === 'violation' ? 'violation' : 'other', - ruleIds: reportReason.value === 'violation' ? selectedRuleIds.value : null, - }) - step.value = 'furtherActions' - resetModal() -} - -async function submitAnonymousReport() { const body = JSON.stringify({ account_id: account.id, status_ids: selectedStatusIds.value, @@ -94,18 +84,26 @@ async function submitAnonymousReport() { forward: forwardReport.value, category: reportReason.value === 'spam' ? 'spam' : reportReason.value === 'violation' ? 'violation' : 'other', rule_ids: reportReason.value === 'violation' ? selectedRuleIds.value : null, + considers_illegal: considersIllegal.value, + considers_illegal_country: considersIllegalCountry.value, }) - await fetch(anonymousReportUrl, { + const headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + } + + const accessToken = client?.value?.config?.props?.accessToken + if (accessToken) + headers.Authorization = accessToken + + await fetch(reportUrl, { method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - }, + headers, body, }) - step.value = 'finalAnonymous' + step.value = isAuthorized.value ? 'furtherActions' : 'finalAnonymous' resetModal() } @@ -193,11 +191,30 @@ function resetModal() {

-
-

+
+ + +
+ +
+

{{ $t('report.anything_else') }}

+

+ {{ $t('report.anything_else_considers_illegal') }} +