fix(audience): decode HTML entities in campaign prompt titles#4711
Open
adekbadek wants to merge 2 commits into
Open
fix(audience): decode HTML entities in campaign prompt titles#4711adekbadek wants to merge 2 commits into
adekbadek wants to merge 2 commits into
Conversation
Prompt titles arrive from the REST API HTML-encoded (e.g. "Foo & Bar"), so the Campaigns wizard rendered the raw entity in two spots: the "Conflict detected" notice and the preview modal title. Run both through decodeEntities, matching how prompt titles are shown elsewhere. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes HTML-encoded prompt titles (e.g. &) showing up literally in the Audience → Campaigns UI by decoding entities before rendering, aligning these surfaces with other components that already decode prompt titles.
Changes:
- Decode HTML entities for conflicting prompt titles shown in the “Conflict detected” notice.
- Decode HTML entities for the prompt preview modal title (
Prompt: …). - Add a unit test to verify entity decoding in conflict notice titles.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/wizards/audience/views/campaigns/utils.js |
Decodes entities when rendering conflicting prompt titles in the conflict warning UI. |
src/wizards/audience/views/campaigns/index.js |
Decodes entities in the preview modal title before interpolating into Prompt: %s. |
src/wizards/audience/components/segment-group/SegmentGroup.test.js |
Adds coverage ensuring conflicting prompt titles are decoded in rendered notices. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
All Submissions:
Changes proposed in this Pull Request:
Prompt titles come back from the REST API HTML-encoded (a prompt named
Foo & Bararrives asFoo & Bar). The Campaigns wizard rendered the raw title string in two places, so the entity showed through literally:Prompt: …).Both now run the title through
decodeEntitiesfrom@wordpress/html-entities, matching how prompt titles are already displayed elsewhere (e.g.prompt-action-card).Before / After (conflict notice)
Spring Membership Drive & Renewal: If multiple overlays are rendered…Spring Membership Drive & Renewal: If multiple overlays are rendered…How to test the changes in this Pull Request:
&that WordPress stored as&(e.g. set it directly:wp db query "UPDATE wp_posts SET post_title='Donate & Subscribe' WHERE ID=<prompt_id>").&, not&.Prompt: Donate & Subscribe, notPrompt: Donate & Subscribe.Other information:
SegmentGroup.test.js– "decodes HTML entities in conflicting prompt titles"; red/green verified)SegmentGroup.test.jssuite passes;wp-scripts lint-jsclean on changed files)🤖 Generated with Claude Code