fix(banlist/commslist): restore per-punishment comment buttons (#1544) - #28
Open
Rushaway wants to merge 2 commits into
Open
fix(banlist/commslist): restore per-punishment comment buttons (#1544)#28Rushaway wants to merge 2 commits into
Rushaway wants to merge 2 commits into
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.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
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.Testing
No local SourcePawn/PHP toolchain for the full suite; relying on CI.
php -lclean on all changed PHP files.🤖 Generated with Claude Code