fix(banlist): hide comment author/editor under banlist.hideadminname (#1500)#1501
Merged
Conversation
…1500) The `banlist.hideadminname` setting masked the focal ban/comm admin name and the unban "removed by" admin for public viewers, but the per-row comment author and editor (also admin usernames) leaked across every comment surface: the inline `<details>` disclosure on the public banlist + commslist, the `?comment=N` "Other comments" comment-edit view (reachable by any caller), and the JSON drawer (bans.detail / comms.detail) consumed by theme.js. Suppress the comment author + editor for public callers when hideadminname is on, matching the focal admin.name / removed_by gate: - Page handlers (page.banlist.php, page.commslist.php) null comname / editname at the DATA layer for both the inline-disclosure data path and the ?comment=N othercomments path, so a third-party theme that renders the name directly can't re-leak it. edittime is preserved so the "last edit" indicator survives. - Templates (page_bans.tpl, page_comms.tpl) render a three-way Hidden / name / "deleted admin" branch for both author and editor, gating the edit line on edittime (not editname, now nulled). - API handlers (bans.php, comms.php) null the comment author / edited_by and add an `author_hidden` boolean sentinel so the drawer (theme.js, partials/player-drawer.tpl) renders "Hidden" (policy) distinctly from "unknown" (deleted admin). Regression coverage: BanlistCommentsVisibilityTest gains the ?comment=N author/editor-hidden branches + an admin control; BansTest / CommsTest::testDetailHidesCommentAuthorForPublicWhenHideAdminName assert the author / edited_by / author_hidden API contract. Snapshot detail_admin_view.json carries the new author_hidden field.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Closes #1500.
banlist.hideadminnamemasked the focal ban/comm admin name and the unban "removed by" admin for public viewers, but the per-row comment author and editor (also admin usernames) leaked across every comment surface:<details>comment disclosure on the public banlist + commslist,?comment=N"Other comments" comment-edit view (reachable by any caller, no admin gate),bans.detail/comms.detail) rendered bytheme.js.This suppresses the comment author + editor for public callers when
hideadminnameis on, matching the existing focaladmin.name/removed_bygate.Changes
page.banlist.php,page.commslist.php): nullcomname/editnamefor public viewers on both the inline-disclosure path and the?comment=Nothercomments path, so a third-party theme rendering the name directly can't re-leak it.edittimeis preserved so the "last edit" indicator still shows.page_bans.tpl,page_comms.tpl): three-wayHidden/ name / "deleted admin" branch for author and editor; the edit line now gates onedittime(not the now-nullableeditname).bans.php,comms.php): null commentauthor/edited_byand add anauthor_hiddenboolean sentinel.theme.js,partials/player-drawer.tpl): useauthor_hiddento render "Hidden" (policy) distinctly from "unknown" (deleted admin →authoralready null).Defense-in-depth: the name is removed at the data/API layer (protects custom themes and curl callers), with the default theme rendering the nicer "Hidden" placeholder on top.
Test plan
BanlistCommentsVisibilityTest— inline disclosure +?comment=Nauthor/editor-hidden branches + admin control (13 tests, 47 assertions).BansTest/CommsTest::testDetailHidesCommentAuthorForPublicWhenHideAdminName— APIauthor/edited_by/author_hiddencontract for public + admin (94 tests, 462 assertions).bans/detail_admin_view.jsonupdated for the newauthor_hiddenfield.Notes
Out of scope (separate follow-up, not a name leak): the
?comment=Ncomment-edit view renders comment bodies regardless ofconfig.enablepubliccomments. Documented as a known follow-up in the AGENTS.md row.