HTML not rendering in email notifications
please see the attached screenshots, which show 1) the rendering of a forum post in a Commons forum, and 2) the email notification, which contains HTML markup. should that markup be there? I feel like I've seen a few posts go out recently where the email notifications showed markup characters rather than a rendered version of the HTML
#3 Updated by Raymond Hoh over 4 years ago
After looking at this a bit more, it appears that Maura copied the frontend blog content from the CUNY Games Network post - https://games.commons.gc.cuny.edu/2017/07/31/2018-cuny-games-conference-call-for-proposals-is-open/
And pasted it into the group forum "Visual" editor and submitted the post. The forum post and the email notification that went out contained the HTML markup. Next, I'm guessing Maura saw the HTML markup and edited the post later to remove the offending tags. The
post_modified date shows that the forum topic was edited five minutes later, which kind of confirms my suspicions.
If the forum post was live-previewed, then the mistake would have been caught.
This is an issue when people copy and paste things into the Visual editor. We could maybe whitelist the bold element (
<b>), but not the rest of the tags. Or perhaps install or write some code that strips various HTML tags from the TinyMCE editor before the post is submitted.
Something like this:
#4 Updated by Boone Gorges over 4 years ago
A thought - maybe too complex to implement just for the Commons, but maybe worth it if integrated into bbPress or whatever.
- You paste some junk into the Visual tab
- After TinyMCE has finished rendering, look at the content for what looks like unrendered markup -
<etc, maybe some regular expression that matches known tags?
- If any are found, indicate it in the UI: maybe a little thing next to the Submit button that says "It looks like you have some unintended code..."
Ray, have you ever done anything like this? I assume it's possible but I have no idea how hard it'd be :)
#9 Updated by Raymond Hoh over 4 years ago
- Status changed from Assigned to Staged for Production Release
I've addressed the issue when people copy and paste rich-text content into the bbPress Visual editor here - https://github.com/cuny-academic-commons/cac/commit/2b8852f9feea0b6de9d1bf3dd720318b16cef838
I'm hooking into TinyMCE's
I'm hoping that this will fix the other reported issues (the last two screenshots), but I'm not entirely sure. If there is a way to duplicate those instances, let me know.