Single quote block dropped in email reply

Consider a post with lots of content. You want to reply by email to a specific part of it, so you reply, you trim the quoted content to just the paragraph that you want to reply to and you add your reply.

:bug: In that specific case, Discourse will get rid of the quoted content and will only show your own text… thus losing important context information because when you trim the quoted content that way, it’s because you want to make it clear that you are replying to a very specific part of the initial post.

I understand that the goal is to get rid of cruft when someone careless quotes the full email to add its reply. I would suggest that you should count the length of the quoted content, if it’s not more than 10 lines or 800 characters, then you should keep it. Or maybe you should count the length of the post that the current reply refers to and if the quote is less than 50% of the length of that original post, then it should be kept.

Detailed samples of working and non-working cases

When you have multiple blocks of quoted content, all the quotes are properly kept:

On Wed, 18 Mar 2020, Jonathan Carter via Debian Discourse wrote:
> Personally, when it comes to web-based forums, I tend to use them for a
> while and then only remember I have an account on them a few years
> later. 

I'm replying right now in my mail reader. You will always find limitations
in the email integration but IMO it works well enough to be usable. And
if we ever switch, I'm pretty sure that someone annoyed enough by the lack
of some feature will find a way to implement it. It's free software after

> IMHO only using the e-mail interface would kind of defeat the purpose
> (you might as well use a mailing list then) since all the nice features
> that's available are exposed in the web interface.

I would expect most people to not use the email interface in general but
its existence is a requirement IMO to not segregate a part of our
community which is reluctant to work with anything else.

But when you have single block, it gets dropped:

On Wed, 18 Mar 2020, Kyle Robbertze via Debian Discourse wrote:
> Often I wish to reply to a certain piece of a comment and maintain the
> context I am replying to. How do I do that when replying to emails
> generated by Discourse? So far I have found that just leaving the
> context in, like I would in email, results in it being stripped out.

I have not had this problem so far. It has been working fine for me.
Here's for example how my current reply looks like when sent via mutt:

This behavior surprised a few Debian developers that are trying out Discourse here:

And here:


Any thoughts here @gerhard?

I may be reading it wrong, but I suspect:

is be responsible here.

I don’t think that email_reply_trimmer knows about what it’s replying to, as it’s called from discourse/lib/email/receiver.rb.


That’s probably it. email_reply_trimmer is quite dumb and doesn’t know anything about previous messages.

Feel free to send a PR that makes this work for your use case. But I fear that it will be hard to fix without some larger changes… Anyway, I’m bookmarking this topic to have another look if/when we get a chance to refactor the reply trimming.


I am not sure about this perhaps this is the remove full quote site setting, which “Automatically remove full quotes on direct replies.”

Is this incoming email specific or just general forum usage? In the topic you linked I did not see any email replies so I am very much guessing you simply want to disable that site setting.



remove full quote is indeed set.

This appears to coming from email replies specifically - on that page there’s a number of replies, messages 1,2,5,6,9,10 and 13 are all replies by email.

I recommend disabling that site setting on the Debian instance

Thanks @sam, done so. I suspect the reply trimmer should probably be made a bit smarter, but for the moment this should be fine for our use :slight_smile:

1 Like