mt: surface System auto-hide rows in the mod log (LEFT JOIN)
list_mod_log INNER JOINed the actor user, so every NULL-actor row silently
vanished from the listing — exactly the flag-threshold auto-hide entries
migration 032 made actor_id nullable to record. count_mod_log counted them,
so pagination overcounted against a listing that couldn't show them. LEFT
JOIN the actor and COALESCE a missing username to 'System', restoring the
auto-moderation audit trail on the page.
Co-Authored-By
Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-07 15:00 UTC
"query": "SELECT ml.id,\n actor.username AS actor_username,\n ml.action AS \"action: ModAction\",\n target.username AS \"target_username?\",\n ml.reason,\n ml.created_at AS \"created_at: chrono::DateTime<chrono::Utc>\"\n FROM mod_log ml\n JOIN users actor ON actor.mnw_account_id = ml.actor_id\n LEFT JOIN users target ON target.mnw_account_id = ml.target_user\n WHERE ml.community_id = $1\n ORDER BY ml.created_at DESC\n LIMIT $2 OFFSET $3",
3
+
"query": "SELECT ml.id,\n COALESCE(actor.username, 'System') AS \"actor_username!\",\n ml.action AS \"action: ModAction\",\n target.username AS \"target_username?\",\n ml.reason,\n ml.created_at AS \"created_at: chrono::DateTime<chrono::Utc>\"\n FROM mod_log ml\n LEFT JOIN users actor ON actor.mnw_account_id = ml.actor_id\n LEFT JOIN users target ON target.mnw_account_id = ml.target_user\n WHERE ml.community_id = $1\n ORDER BY ml.created_at DESC\n LIMIT $2 OFFSET $3",