Project

General

Profile

Actions

Bug #8692

closed

HTML not rendering in email notifications

Added by Matt Gold over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Email Notifications
Target version:
Start date:
2017-09-12
Due date:
% Done:

0%

Estimated time:
Deployment actions:

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

Related to CUNY Academic Commons - Bug #8246: Copy/Paste from a Google Doc into Forum is funkyDuplicateDaniel Jones2017-06-07

Actions
Actions #1

Updated by Boone Gorges over 6 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.

Actions #2

Updated by Raymond Hoh over 6 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.

Actions #3

Updated by Raymond Hoh over 6 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/

Actions #4

Updated by Boone Gorges over 6 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 -

&lt;
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 :)

Actions #5

Updated by Matt Gold over 6 years ago

Just noting another instance of this

Actions #6

Updated by Matt Gold over 6 years ago

Here is another example (not sure whether additional examples are helpful or not)

Actions #7

Updated by Boone Gorges over 6 years ago

  • Target version changed from 1.11.13 to 1.11.14
Actions #8

Updated by Boone Gorges over 6 years ago

  • Target version changed from 1.11.14 to 1.11.15
Actions #9

Updated by Raymond Hoh over 6 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.

Actions #10

Updated by Matt Gold over 6 years ago

great to hear this, Ray -- thank you. After it is live, I'll let you know whether the problem reappears

Actions #11

Updated by Boone Gorges over 6 years ago

  • Status changed from Staged for Production Release to Resolved

This is about to go out. Thanks for your work on it!

Actions #12

Updated by Matt Gold over 6 years ago

That's exciting -- thank you!

Actions #13

Updated by Raymond Hoh over 6 years ago

  • Related to Bug #8246: Copy/Paste from a Google Doc into Forum is funky added
Actions

Also available in: Atom PDF