-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: dont html encode ampersands in subject #1686
base: trunk
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #1686 +/- ##
=========================================
Coverage 20.38% 20.38%
Complexity 2664 2664
=========================================
Files 48 48
Lines 10619 10619
=========================================
Hits 2165 2165
Misses 8454 8454 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leogermani this didn't work for me for some reason—the ampersands were still coming in as &
in the the subject text input when editing the post title field, and when synced to the ESP the subject still contained &
. I think WP converts certain characters into HTML entities when the strings are saved into the DB.
Here's what I had to do to fix the issue: #1687
This doesn't try to save the title with unescaped characters, it just displays the unescaped string in the sidebar field, and then decodes the HTML entities in the sync payload that gets sent to the ESP. Let me know what you think!
@dkoo Your PR looks much more robust! Feel free to take it over! |
fix: decode HTML entities in both editor JS and sync payloads
@leogermani I've merged #1678 into this PR. Paging @Automattic/newspack-product for another review! |
All Submissions:
Changes proposed in this Pull Request:
Fixes a small issue where ampersands are HTML encoded in the Subject.
Not sure if there's a better way to do it. But it's weird because the only character that is being HTML encoded is the ampersand, so loading a library to html_decode everything looked unnecessary.
How to test the changes in this Pull Request:
trunk
edit a newsletters&
to the title and see that$amp;
is added to the Subject input in the Newsletter sidebar&
is preserved as isOther information: