Skip to content

Keep comment content maps in the visitor rendering context - #3984

Merged
pfefferle merged 1 commit into
trunkfrom
fix/comment-content-map-visitor
Oct 28, 2026
Merged

pfefferle merged 1 commit into
trunkfrom
fix/comment-content-map-visitor

Conversation

@pfefferle

Copy link
Copy Markdown
Member

Follow-up to #3876.

Proposed changes:

  • Remove the comment transformer's redundant contentMap rebuild. The base transformer already builds it as a logged-out visitor; rebuilding it after restoring the current user could include member-only text added by content filters.
  • Add regression coverage for both comment_text and activitypub_the_content, verifying public content in the language map and restoration of the current user.

Other information:

  • Have you written new tests for your changes, if applicable?

Both regression cases fail against the original code. All 11 comment-transformer tests (26 assertions), repository PHP lint, and PHPStan pass with the fix. The code review found no actionable issues.

The full local suite ran 4,080 tests with two failures: Test_Actors_Inbox_Controller::test_user_inbox_post_verification (also present in the saved trunk run) and Test_Remote_Posts::test_add_recipients (passes when rerun in isolation). These results are not a clean full-suite pass.

The existing unreleased .github/changelog/fix-render-as-visitor entry covers this correction; this PR uses Skip Changelog.

Testing instructions:

  • Run npm run env-test -- --filter=Transformer.Test_Comment.
  • The two test_content_map_renders_as_visitor cases simulate filters that append different text for members and visitors. Confirm that content and every language-map value contain the visitor text and that the logged-in user is restored.
  • Restore the removed set_content_map() block to verify both new cases fail because the map contains member-only text.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

@pfefferle pfefferle added Bug Something isn't working Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. [Feature] Federated comments [Tests] Includes Tests labels Oct 28, 2026
@pfefferle pfefferle self-assigned this Oct 28, 2026
@pfefferle
pfefferle requested a review from a team October 28, 2026 20:04
@pfefferle
pfefferle merged commit 6688f15 into trunk Oct 28, 2026
16 of 18 checks passed
@pfefferle
pfefferle deleted the fix/comment-content-map-visitor branch October 28, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working [Feature] Federated comments Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant