# HTML digest emails exclude quotes from topic body if accompanied by text

**URL:** https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369
**Category:** Bug
**Tags:** activity-summary
**Created:** [13.Май.2018 14:39:57 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369 "2018-05-13T14:39:57Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [13.Май.2018 14:39:57 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/1 "2018-05-13T14:39:57Z")

</div>

I am building a new community and many current users consume information by looking at email digests. A lot of topics that I create contain quoted text (mostly forwarded emails from various existing mailing lists) sometimes accompanied by regular text but not always. I recently observed that the digest emails that go out to users do not contain quoted text at all if there is any accompanying text around the block quote. See screenshots below.

I investigated the Preview Digest and notice that the quote is actually included in the text version of digest, but not in the HTML version.

Original topic:

 ![bike-topic](https://global.discourse-cdn.com/meta/original/3X/9/1/91373b4b1921fd88c30a62ab4064f266a3622978.png)

HTML digest:

 ![bike-html](https://global.discourse-cdn.com/meta/original/3X/b/1/b105883401e88f5152207baa3ec679aed8d04950.png)

Text digest:

 ![bike-text](https://global.discourse-cdn.com/meta/original/3X/4/2/42fdd9871b138a9a24c99273fa6cf7fa7431b3d6.png)

While a topic with just a quote shows up just fine in the HTML digest:

 ![fwd-html](https://global.discourse-cdn.com/meta/original/3X/1/1/11bd0723af9a04bff5d391751562507de442a88b.png)

* * *

Something similar is happening to attachments in the posts.

Original topic:

 ![slides-topic](https://global.discourse-cdn.com/meta/original/3X/f/1/f1aa3c95e3044815531db3d9e3011495a71d1960.png)

HTML digest:

 ![slides-html](https://global.discourse-cdn.com/meta/original/3X/c/5/c558322bed8f8e67d49ba97184b666aa6e779baa.png)

Text digest:

 ![slides-text](https://global.discourse-cdn.com/meta/original/3X/8/7/87b817526589e76c24c2f01cda7b61923f5a221a.png)

Seems like a bug.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [13.Май.2018 15:04:42 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/2 "2018-05-13T15:04:42Z")

</div>

That’s because we’re only using the [first paragraph](https://github.com/discourse/discourse/blob/fcd20a70d7764afb46db451091b61cdfc549540c/app/helpers/user_notifications_helper.rb#L53-L56) for the HTML version and using [an excerpt](https://github.com/discourse/discourse/blob/be6404d6519d03cfb9194bc03e5c6b9593513c1d/app/views/user_notifications/digest.text.erb#L19) for the TEXT version.

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [13.Май.2018 15:11:21 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/3 "2018-05-13T15:11:21Z")

</div>

Thanks for a quick response.

Two questions:

1. Why such discrepancy between the two formats?
2. How does it explain that a quote only post gets into HTML digest but not when there is any text before or after the quote?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [13.Май.2018 15:14:04 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/4 "2018-05-13T15:14:04Z")

</div>

> [@k4rtik](#):
>
> 1. Why such discrepancy between the two formats?

Because there’s no 1-to-1 mapping between the raw (ie. text) and the cooked (ie. html) versions of a post and such we have to resort to an approximation. Hence the “using the first paragraph” rule for the HTML version.

> [@k4rtik](#):
>
> 1. How does it explain that a quote only post gets into HTML digest but not when there is any text before or after the quote?

We’ll only use the quote if it’s the first paragraph of the post.

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [13.Май.2018 15:18:12 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/5 "2018-05-13T15:18:12Z")

</div>

> [@zogstrip](#):
>
> We’ll only use the quote if it’s the first paragraph of the post.

but that’s not what’s happening in the first example I posted, no? It skips the quote and uses the text after the quote, which is incorrect because for the end user it misses the context of what that text is referring to.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [13.Май.2018 15:21:06 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/6 "2018-05-13T15:21:06Z")

</div>

Right, after looking [precisely at the code](https://github.com/discourse/discourse/blob/fcd20a70d7764afb46db451091b61cdfc549540c/app/helpers/user_notifications_helper.rb#L40), we’re using the first **paragraphs** or **oneboxes** or **lists** for the HTML version.

Quotes are **always** ignored.

---

<div class="post-metadata">

### Author: ![k4rtik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/k4rtik/32/119508_2.png) [@k4rtik](https://meta.discourse.org/u/k4rtik)
#### Post date: [13.Май.2018 15:36:13 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/7 "2018-05-13T15:36:13Z")

</div>

I see that it might make sense to ignore quotes that come from a previous post/topic. But not necessarily all quotes like in my use cases above.

Is it possible to distinguish between the two `body > aside > blockquote` (internal quote with context) vs `body > blockquote` (regular quote)?

If not, is it possible to override what gets included in the email digest excerpts/posts using some setting such as those in `/admin/customize/site_texts`? I looked around before creating this topic and couldn’t find anything to achieve this on my own.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [13.Май.2018 16:24:10 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/8 "2018-05-13T16:24:10Z")

</div>

> [@k4rtik](#):
>
> I see that it might make sense to ignore quotes that come from a previous post/topic. But not necessarily all quotes like in my use cases above.

I agree.

> [@k4rtik](#):
>
> Is it possible to distinguish between the two `body > aside > blockquote` (internal quote with context) vs `body > blockquote` (regular quote)?

Yeah, that’s possible and done 😉

[https://github.com/discourse/discourse/commit/9d9332d8c96906df992d5b78a8aa545bb7ea769d](https://github.com/discourse/discourse/commit/9d9332d8c96906df992d5b78a8aa545bb7ea769d)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [14.Май.2018 16:00:07 UTC](https://meta.discourse.org/t/html-digest-emails-exclude-quotes-from-topic-body-if-accompanied-by-text/87369/9 "2018-05-14T16:00:07Z")

</div>

This topic was automatically closed after 23 hours. New replies are no longer allowed.
