feat(frontend): show audit log entry for closed reports

This commit is contained in:
sam 2025-02-03 17:35:34 +01:00
parent cacd3a30b7
commit 6bb01f0bf1
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
6 changed files with 81 additions and 12 deletions

View file

@ -0,0 +1,37 @@
<script lang="ts">
import { AuditLogEntryType, type AuditLogEntry } from "$api/models/moderation";
import { idTimestamp } from "$lib";
import { renderMarkdown } from "$lib/markdown";
import { DateTime } from "luxon";
import AuditLogEntity from "./AuditLogEntity.svelte";
type Props = { entry: AuditLogEntry };
let { entry }: Props = $props();
</script>
<div class="row">
<h3 id="report-status">
Closed by <AuditLogEntity entity={entry.moderator} /> at
{idTimestamp(entry.id).toLocaleString(DateTime.DATETIME_MED)}
</h3>
<p>
{#if entry.type === AuditLogEntryType.IgnoreReport}
Report was ignored
{:else if entry.type === AuditLogEntryType.WarnUser || entry.type === AuditLogEntryType.WarnUserAndClearProfile}
User was warned
{#if entry.cleared_fields && entry.cleared_fields.length > 0}
<br />Cleared fields: {entry.cleared_fields.join(", ")}
{/if}
{:else if entry.type === AuditLogEntryType.SuspendUser}
User was suspended
{/if}
</p>
<h4>Reason</h4>
<p>
{#if entry.reason}
{@html renderMarkdown(entry.reason)}
{:else}
<em class="text-secondary">(no reason given)</em>
{/if}
</p>
</div>