Skip to content

fix(banlist/commslist): restore per-punishment comment buttons (#1544) - #28

Open
Rushaway wants to merge 2 commits into
mainfrom
fix/issue-1544
Open

fix(banlist/commslist): restore per-punishment comment buttons (#1544)#28
Rushaway wants to merge 2 commits into
mainfrom
fix/issue-1544

Conversation

@Rushaway

@Rushaway Rushaway commented Sep 3, 2026

Copy link
Copy Markdown
Member

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.

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.php already build addcomment, editcomlink and delcomlink for every row (and editcomlink / delcomlink are 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

  • page_bans.tpl / page_comms.tpl
    • Render $com.editcomlink + $com.delcomlink beneath each inline comment. Delete reuses the existing data-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.
    • Add an "Add comment" footer link inside the comments disclosure.
    • For admins the disclosure now also renders on rows with zero comments (summary count 0) so a thread can be started there; public viewers are unchanged (disclosure only on rows that have comments, no CTA).
    • Multi-comment blocks already iterate a <ul> foreach, so the "render with multiple comments" concern from the issue is covered.
  • BanListView / CommsListView: new can_comment flag, splatted as $userbank->is_admin() (matches the login-only bans.add_comment API gate). Defaulted false so 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.

Testing

No local SourcePawn/PHP toolchain for the full suite; relying on CI. php -l clean on all changed PHP files.

🤖 Generated with Claude Code

Rushaway and others added 2 commits September 3, 2026 10:59
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant