Users @mentioned in email replies are not notified


(Clay Heaton) #1

I’m running 1.1.0.beta3.

When a user responds to an email notification (reply by email feature) and includes an @user notification of somebody, that is not picked up and parsed by Discourse and @user is not notified through the forum or email.

For instance, I just had a user respond to a notification (in Outlook) and the following appeared in the body of the response, as posted to the thread:

<p class="MsoListParagraph" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-indent:-.25in;mso-list:l0 level1 lfo4">·        
I can imagine this could be a useful feature.  @username1 @username2 what do you think?
<p></p>

Neither @username1 nor @username2 was notified of the emailed response.


@mentions aren't linked when emailing in via HTML
Linebreaks in posts created via email in from Gmail
(Jeff Atwood) #2

@techapj can you have a look at this?


(Sam Saffron) #3

This sounds real odd @clay same parser / pipeline is used when creating posts via mail


(Sam Saffron) #4

Hmm … no repro here @clay ^^^


(Clay Heaton) #5

I’ll PM you the full text that appears in the edit box when I edit the post, along with a screenshot of how it appears on the site. I don’t want to share all of that in the open here.


(Sam Saffron) #6

This is the bug:

<p class="MsoNormal">Hi @clay </p>

Hi @clay

@eviltrout @elberet mohr markdown phun ?

@techAPJ you can skip this one, its a very tangled bit of complexity


(Jeff Atwood) #7

That is MS Outlook HTML schmutz. I have some regexes to clean that up in an old blog entry.

Or really just strip all classes from p tags.


(Sam Saffron) #8

Stripping the class is not enough, p tag exhibits the issue unadorned, afaik we are not converting the html to an ast so this is not being intercepted properly


(Jeff Atwood) #9

Hmm so this is another side effect of us switching to HTML for processing incoming email @riking. We used to use plain text, which has issues as well, but would have avoided this.


(Sam Saffron) #10

I guess … at the root though the markdown parser should handle

<p>@mention</p> and @mention in the same way. Since it renders both in the same way.

A simple fix is ironing out all P tags from the emails we send in to post creator which would leave us with saner markdown anyway.


(Jens Maier) #11

Technically, not parsing Markdown in HTML block tags is the intended behaviour.

Stripping <p>s from emails would probably work, but the better fix might be to rewrite the mentions parser and apply it directly to the sanitized HTML instead of implementing it as a MD dialect.


(Robin Ward) #12

It is indeed not a bug, although it confused me at first too.

Gruber says:

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style emphasis inside an HTML block.

I could argue that @mentions are not markdown, but if I made an exception for that what if we got a bug because the email contained <p>**bold**</p> which would not be parsed either.

I think the real fix is to correct the input from surrounding everything in <p> tags.


(Clay Heaton) #13

It’s not a Markdown bug, per that standard, but I think it’s a design bug with Discourse. The ability to use @mentions is a central and important feature in Discourse. With the decision to allow and include reply by email, the tacit support for the @mention feature extends to email clients.

Most people probably wouldn’t care if their <p>**bold text**</p> rendered properly when an email imported. However, there’s an expectation that an @mention actually will notify the user mentioned. Communication is interrupted when it doesn’t and enabling fluid communication is what Discourse is all about.

There are times to stick to the standard and times to deviate from it. Microsoft Outlook puts all manner of garbage in emails, unfortunately. I’m sure that other email clients do it, too.

My suggestion would be to catch all @mentions in incoming emails, unless they are surrounded by ``` tics. That, in my opinion, is one area where it’s time to toss out the standard because the standard was written for a different purpose and adhering to it at the expense of expected Discourse behavior has the potential to cause users – specifically paying Enterprise users, who are more likely to be using MS Outlook – to lose confidence in their investment in your platform.


(Robin Ward) #14

I am not suggesting we don’t fix it. I am suggesting we fix it a different way, where imported emails are not being parsed with <p> tags everywhere. When we fix that, emails with @mentions will just work.


(Clay Heaton) #15

I’m going to PM you the raw HTML/Markdown that appeared in a post that a user responded to by email. I has a number of issues, one of them being the same as mentioned in the title of this post. MS Outlook garbage… I thought you might like to take a look.


(Jeff Atwood) #16

@techapj is working on a feature where clicking the envelope at the upper right of email submitted posts will show, for staff, the complete raw email as it was sent.


(Jason Ives) #17

Any work being done on this? Noticed this morning that mentioning a forum member via reply in gmail does not work and came across this thread. Gmail (using the gmail client on my android phone) is wrapping the reply as well:

<p dir="ltr">text</p>

(Jeff Atwood) #18

We have plans to switch back to plain text mail payload processing due to many issues like this in using html payloads cc @techapj @riking


(Jeff Atwood) #19

This should be resolved as we switched back to plain text here.


(Jeff Atwood) #20