feat(modpanel): the mod log as its own page

The admin panel's "What they did" table, in the moderator panel too: the
latest 300 entries. A new permission, staff.log, which moderators and
admins have by default, guards the page and its route.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
BurrowdevandClaude Opus 5.5 committed 2026-10-20 23:44:16 +03:00
1 parent 0f367c55b8
commit 8368692b99
3 files changed
+38 -1

No files matched your search

+25
View File
@@ -475,6 +475,7 @@
<button role="tab" data-tab="masterpieces" data-needs="player.view" aria-selected="false"><span class="icon" aria-hidden="true">&#9635;</span>Masterpieces<span id="masterpiece-count"></span></button>
<button role="tab" data-tab="bans" data-needs="player.view" aria-selected="false"><span class="icon" aria-hidden="true">&#8856;</span>Bans</button>
<button role="tab" data-tab="stats" data-needs="player.view" aria-selected="false"><span class="icon" aria-hidden="true">&#9636;</span>Stats</button>
<button role="tab" data-tab="mod-log" data-needs="staff.log" aria-selected="false" hidden><span class="icon" aria-hidden="true">&#9776;</span>Mod log</button>
<button role="tab" data-tab="review" data-needs="items.approve" aria-selected="false" hidden><span class="icon" aria-hidden="true">&#10004;</span>Review</button>
<button role="tab" data-tab="wear-rules" data-needs="items.restrict" aria-selected="false" hidden><span class="icon" aria-hidden="true">&#9873;</span>Wear rules</button>
<button role="tab" data-tab="items" data-needs="items.create" aria-selected="false" hidden><span class="icon" aria-hidden="true">&#10070;</span>Items</button>
@@ -992,6 +993,17 @@
</section>
</div>
<div data-view="mod-log" hidden>
<section>
<h2>What staff did</h2>
<div class="table-wrap"><table>
<thead><tr><th>When</th><th>Who</th><th>What</th><th>Player</th><th>Detail</th></tr></thead>
<tbody id="mod-log"></tbody>
</table></div>
<div class="empty" id="no-mod-log" hidden>Nothing yet.</div>
</section>
</div>
<div data-view="bans" hidden>
<section>
<h2>Banned and silenced</h2>
@@ -2961,6 +2973,19 @@
else if (shown === "stats") {
await window.statsView.load(api);
}
else if (shown === "mod-log") {
const result = await api("modlog");
if (result.ok) {
$("mod-log").replaceChildren(...result.data.log.map(entry => {
const row = el("tr");
const detail = el("td", entry.detail);
detail.style.whiteSpace = "normal";
row.append(el("td", when(entry.at)), el("td", entry.by), el("td", entry.action), el("td", entry.target || "—"), detail);
return row;
}));
$("no-mod-log").hidden = result.data.log.length > 0;
}
}
else if (shown === "bans") {
const [result, hits] = await Promise.all([api("bans"), api("filterhits")]);
if (result.ok) {