Bug #8692
closedHTML not rendering in email notifications
0%
Description
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
Files
Related issues
Updated by Boone Gorges almost 7 years ago
- Assignee changed from Boone Gorges to Raymond Hoh
- Target version set to 1.11.13
Ray, could you have a look? I wonder if this is a case of inconsistent tag whitelists, since some tags are being rendered in the email.
Updated by Raymond Hoh almost 7 years ago
I'll take a closer look.
Chances are I am not applying a filter for bbPress to strip element tags that are not supported in the BPGES plugin.
Updated by Raymond Hoh almost 7 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:
http://jonathannicol.com/blog/2015/02/19/clean-pasted-text-in-wordpress/
Updated by Boone Gorges almost 7 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 :)
Updated by Matt Gold almost 7 years ago
Just noting another instance of this
Updated by Matt Gold almost 7 years ago
Here is another example (not sure whether additional examples are helpful or not)
Updated by Boone Gorges almost 7 years ago
- Target version changed from 1.11.13 to 1.11.14
Updated by Boone Gorges almost 7 years ago
- Target version changed from 1.11.14 to 1.11.15
Updated by Raymond Hoh almost 7 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 paste_preprocess
javascript function callback, which allows us to do some clean-up before the pasted content is inserted into the editor. Here, I'm checking if the pasted content has HTML elements that bbPress doesn't support, if it doesn't, we strip it.
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.
Updated by Matt Gold almost 7 years ago
great to hear this, Ray -- thank you. After it is live, I'll let you know whether the problem reappears
Updated by Boone Gorges almost 7 years ago
- Status changed from Staged for Production Release to Resolved
This is about to go out. Thanks for your work on it!
Updated by Raymond Hoh almost 7 years ago
- Related to Bug #8246: Copy/Paste from a Google Doc into Forum is funky added