fix(banlist/commslist): restore per-punishment comment buttons (#1544) - #28
Conversation
The 2.0.0 theme rebuild rendered the inline comment thread on the public ban list and comms list but dropped the add / edit / delete call-to-action buttons. page.banlist.php / page.commslist.php still build addcomment, editcomlink and delcomlink for every row (already permission-gated), the templates just never printed them. - page_bans.tpl / page_comms.tpl: render $com.editcomlink + $com.delcomlink under each inline comment (delete reuses the existing data-action="comment-delete" dispatcher in comment-actions.js), and an "Add comment" footer link in the disclosure. For admins the disclosure now also renders on rows with zero comments so a thread can be started there. - BanListView / CommsListView: new can_comment flag ($userbank->is_admin(), matching the login-only bans.add_comment API gate), defaulted false for third-party callers. - theme.css: styles for the new action row + add-comment footer. - BanlistCommentsVisibilityTest: cover the admin add-comment CTA and the public no-CTA path (replaces the now-obsolete "disclosure never renders on an uncommented row" assertion). Upstream issue: sbpp#1544 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
page_bans.tpl accessed $ban.commentdata before the $view_comments gate, tripping an 'Undefined array key' warning (PHPUnit treats it as a failure) for anonymous callers when config.enablepubliccomments=0 — the handler doesn't build commentdata in that branch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Review (Sonnet — Opus quota exhausted, resets 19:00 Europe/Paris)Verdict: LGTM, no code changes needed. CI green on Verified:
Minor, non-blocking: |
|
LGTM on the restore itself. Delete correctly reuses Two follow-ups, neither blocking:
|
The restored per-comment edit/delete controls and the "Add comment" link were still emitting Font Awesome markup (`<i class="fas fa-edit fa-lg">` / `fa-trash` / `fa-comment-dots`). The 2.0 theme dropped Font Awesome, so `editcomlink` and `delcomlink` — which are icon-only — rendered as empty `<a>` elements; `addcomment` lost its glyph but kept the visible "Add Comment" text. Swap all three to `<i data-lucide="…">` (pencil / trash-2 / message-square-plus), matching the icon vocabulary the rest of the banlist/commslist chrome uses (and the Lucide-not-glyph rule PublicBanListRegressionTest pins for the row-action buttons). Add `aria-label` to the icon-only edit/delete anchors so they carry an accessible name the way the row-action buttons do. Follow-up to #28 review. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The 2.0 player drawer's Comments section was read-only, so once a ban/comm had comments the only way to add another from the list view was to expand the inline disclosure and scroll past the thread (the review's "only the raw ?comment= URL" point). 1.x kept an always- present "Add comment" admin action on the expanded row. - api_bans_detail / api_comms_detail: new `can_comment` (login-only, mirrors the page handlers' `can_comment` splat) plus per-comment `can_edit` (own comment or Owner) / `can_delete` (Owner) — same gating as page.banlist.php's `$commentres` loop. `C.aid` added to the comment SELECT to compute ownership. - theme.js renderOverviewPane: render the per-comment edit/delete row and an "Add comment" CTA. Edit/add link to the same server-rendered `?p=…&comment=…` surface the inline disclosure uses; delete reuses the global `data-action="comment-delete"` dispatcher (comment-actions.js) with `data-page="-1"`. - api-contract.js: regenerated (also picks up the stale ApiSystemCheckVersion re-wrap left by #18's hand-edit). - player-drawer.tpl: reference shape + variable contract updated. - Tests: bans/comms detail snapshots + assertions for the new flags; e2e drawer-mirror asserts the admin Add-comment CTA. Follow-up to #28 review. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts: # web/themes/default/js/theme.js
|
@maxijabase both follow-ups addressed — re-requested your review. 1. FA icons in a Lucide theme ( You were right, and it was worse than flagged: All three now emit 2. Add-comment CTA when the thread is non-empty ( Small correction on the premise: Rather than move the inline link, I surfaced add/edit/delete in the player drawer (the 2.0 equivalent of 1.x's always-present admin action on the expanded row):
Also merged current No local PHP/Playwright toolchain here — |
|
LGTM! |
What
Restores the per-punishment comment call-to-action buttons on the public ban list and comms list that were dropped in the 2.0.0 theme rebuild, and surfaces the same add/edit/delete affordances in the player drawer.
Ports upstream issue sbpp#1544 ("bug: Missing comment buttons on banlist/commslist"). No upstream fix exists yet; this is an original fix in fork style.
Why
page.banlist.php/page.commslist.phpalready buildaddcomment,editcomlinkanddelcomlinkfor every row (andeditcomlink/delcomlinkare permission-gated in the handler). The 2.0 templates render the inline comment thread but never printed these controls, so there was no way to add / edit / delete a comment from the list — only view.Changes
Inline disclosure (banlist / commslist)
page_bans.tpl/page_comms.tpl$com.editcomlink+$com.delcomlinkbeneath each inline comment. Delete reuses the existingdata-action="comment-delete"dispatcher (web/scripts/comment-actions.js, Audit follow-up: hard-broken admin surfaces from removed sourcebans.js helpers (#1397 cluster) sbpp/sourcebans-pp#1402) — confirm dialog + JSON API round-trip, no new JS.0) so a thread can be started there; public viewers are unchanged (disclosure only on rows that have comments, no CTA).<ul>foreach, so the "render with multiple comments" concern from the issue is covered.BanListView/CommsListView: newcan_commentflag, splatted as$userbank->is_admin()(matches the login-onlybans.add_commentAPI gate). Defaultedfalseso third-party callers / existing tests keep working.theme.css: styling for the action row + add-comment footer (theme-token based, light/dark safe).BanlistCommentsVisibilityTest: replaced the now-obsolete "disclosure never renders on an uncommented row" assertion with coverage for the admin Add-comment CTA and the public no-CTA path.Review follow-ups
Lucide icons (
6d0be6ef):editcomlink/delcomlink/addcommentwere still emitting Font Awesome markup (<i class="fas fa-edit fa-lg">etc.). The 2.0 theme dropped Font Awesome, so the icon-only edit/delete controls rendered as empty<a>elements. Swapped all three to<i data-lucide="…">(pencil/trash-2/message-square-plus), matching the icon vocabulary the rest of the banlist chrome uses (and the Lucide-not-glyph rulePublicBanListRegressionTestpins for the row-action buttons). Icon-only anchors gainedaria-label.Player-drawer comment affordances (
a77efe66): the drawer's Comments section was read-only, so once a punishment had comments the only add path was to expand the inline disclosure and scroll past the thread. 1.x kept an always-present "Add comment" admin action on the expanded row.api_bans_detail/api_comms_detail: newcan_comment(login-only, mirrors the page handlers' splat) plus per-commentcan_edit(own comment or Owner) /can_delete(Owner) — same gating aspage.banlist.php's$commentresloop.C.aidadded to the comment SELECT to compute ownership.theme.jsrenderOverviewPane: renders the per-comment edit/delete row and an "Add comment" CTA. Edit/add link to the same server-rendered?p=…&comment=…surface the inline disclosure uses; delete reuses the globaldata-action="comment-delete"dispatcher withdata-page="-1".api-contract.jsregenerated (also absorbs the staleApiSystemCheckVersiondoc re-wrap left by Retarget GHCR, releases, and docs to this repo #18's hand-edit).partials/player-drawer.tpl: reference shape + variable contract updated.bans.detail/comms.detailsnapshots +BansTest/CommsTestassertions for the new flags;banlist-comments-visibility.spec.tsasserts the admin Add-comment CTA in the drawer.Testing
No local SourcePawn/PHP toolchain for the full suite; relying on CI.
php -lclean on all changed PHP files,node -cclean ontheme.js,composer api-contractregenerated deterministically.🤖 Generated with Claude Code