fix: capture server nickname (member displayName) per action

Rename server_name (guild name) to server_nick and populate it from
the member's server-specific display name (metadata.member.displayName)
at write time. This is what the moderation dashboard should show as
TARGET — e.g. server nick 'Bandar Togel「✔ ᵛᵉʳᶦᶠᶦᵉᵈ 」' for global
username '.nichiyobi'. Backfilled 210 existing actions from messages
metadata (reset_nickname rows now show 'Sarjana .jav', 'Penindas
Minoritas', etc). Frontend TARGET shows server nick with global
username as secondary context.
This commit is contained in:
asepharyana
2026-08-27 13:50:37 +07:00
parent 4991164591
commit ea23c405fa
10 changed files with 46 additions and 19 deletions
@@ -149,14 +149,15 @@ export function LiveModerationFeed({
<div className="mt-1.5 flex items-center gap-2 font-mono text-[10px] text-ink-faint">
<span>TARGET:</span>
<span className="text-ink-soft">
{a.username ?? a.user_id ?? "UNKNOWN_SUBJECT"}
{a.server_nick ??
a.username ??
a.user_id ??
"UNKNOWN_SUBJECT"}
</span>
{a.server_name && (
{a.username && a.username !== a.server_nick && (
<>
<span>·</span>
<span className="text-ink-soft">
{a.server_name}
</span>
<span className="text-ink-soft">@{a.username}</span>
</>
)}
</div>
@@ -20,7 +20,7 @@ export interface ModerationAction {
created_at: number | null;
executed_at: number | null;
username: string | null;
server_name: string | null;
server_nick: string | null;
content: string | null;
// ── Explainability (structured verdict, surfaced read-only to public web) ──
flags: string[] | null;
@@ -81,7 +81,7 @@ export interface CategoryAction {
confidence: number | null;
score: number | null;
username: string | null;
server_name: string | null;
server_nick: string | null;
content: string | null;
}