# Emails sent to category watchers even after topic is converted to PM

**URL:** https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122
**Category:** Feature
**Created:** [February 21, 2018, 10:28am UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122 "2018-02-21T10:28:25Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Parker1090](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/parker1090/32/119862_2.png) [@Parker1090](https://meta.discourse.org/u/Parker1090)
#### Post date: [February 21, 2018, 10:28am UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122/1 "2018-02-21T10:28:25Z")

</div>

Hi all,

We’ve just had a situation on a forum where we’ve had a user post to a category being watched by other users. However, given the nature of their query, it was converted to a PM within 3 minutes by a moderator.

Although it was converted to a PM, it seems to have still triggered an email to those watching the category it was originally posted to, which doesn’t seem right to me. I would have expected the email _not_ to have been sent as it was converted to a private/personal message.

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [February 21, 2018, 4:24pm UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122/2 "2018-02-21T16:24:50Z")

</div>

oh my - if that’s happening then it’s a serious bug. are you able to replicate it? e.g.

- create test accounts A and B
- log in with account A and watch a category
- log in with account B and create a topic in that category
- receive email notification in account A
- move topic into personal message
- add reply as account B
- receive email notification in account A

---

<div class="post-metadata">

### Author: ![Parker1090](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/parker1090/32/119862_2.png) [@Parker1090](https://meta.discourse.org/u/Parker1090)
#### Post date: [February 21, 2018, 5:31pm UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122/3 "2018-02-21T17:31:44Z")

</div>

Just to clarify -

- User A watches category
- User B starts a new thread in the same category
- Moderator converts B’s post into a PM between just them and B, in a short space of time (e.g. \< 5 mins)
- User A still receives an email notifying them of the new post _x_ minutes after the post was created

I’ve managed to replicate it using 2 test accounts. The email is still sent to User A (but they can’t view the full message if they click into it).

I’m no Discourse expert, but from what I can see the topic triggers the scheduled job in Sidekiq which is then sent _x_ minutes after the topic was made.

---

<div class="post-metadata">

### Author: ![awlogan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awlogan/32/62208_2.png) [@awlogan](https://meta.discourse.org/u/awlogan)
#### Post date: [February 21, 2018, 5:36pm UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122/4 "2018-02-21T17:36:17Z")

</div>

To be clear, this is just the first post that was emailed, not the following private messages correct?

If that is the case I don’t see how you could prevent that to be honest, the email would have gone by the time someone converted it.

---

<div class="post-metadata">

### Author: ![Parker1090](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/parker1090/32/119862_2.png) [@Parker1090](https://meta.discourse.org/u/Parker1090)
#### Post date: [February 21, 2018, 6:57pm UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122/5 "2018-02-21T18:57:06Z")

</div>

> [@awlogan](#):
>
> To be clear, this is just the first post that was emailed, not the following private messages correct?

That’s correct - thankfully! 🙂

> [@awlogan](#):
>
> If that is the case I don’t see how you could prevent that to be honest, the email would have gone by the time someone converted it.

At the point of being converted to a PM, the email is still sat in Sidekiq. I’m not going to say I’m a Discourse expert, or even say I understand how it works (because I don’t - I just love its format and a member of several Discourse powered sites), so I’m not sure if it could be prevented.

Perhaps a timeline of events could help explain the situation:

- 5:20pm - User A posts publicly
- 5:21pm - Mod converts post to a PM
- 5:30pm - User B receives the “New post” email, with a subject of `[Site Site][PM] New Topic`

Just after the post was converted, there was a `Jobs::UserEmail` event in Sidekiq for the new topic.

---

<div class="post-metadata">

### Author: ![awlogan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awlogan/32/62208_2.png) [@awlogan](https://meta.discourse.org/u/awlogan)
#### Post date: [February 21, 2018, 7:05pm UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122/6 "2018-02-21T19:05:57Z")

</div>

Only speaking for myself (hosted by Discourse), it seems like my emails land pretty much immediately after a post. I have mailing list mode turned on, send me mail even if I’m on the site, that sort of thing. You might be able to call it back if it hadn’t been sent, but that seems like a race. In this case it was close, but if it had happened after the mod had logged off it likely would have sat there much longer.

---

<div class="post-metadata">

### Author: ![HAWK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hawk/32/86627_2.png) [@HAWK](https://meta.discourse.org/u/HAWK)
#### Post date: [February 21, 2018, 8:13pm UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122/7 "2018-02-21T20:13:20Z")

</div>

There is a window – I think it’s 30 seconds. @jomaxro can confirm.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [February 21, 2018, 8:17pm UTC](https://meta.discourse.org/t/emails-sent-to-category-watchers-even-after-topic-is-converted-to-pm/81122/8 "2018-02-21T20:17:59Z")

</div>

The defaults (configurable via site settings) are 20 seconds after posting for personal message notifications, and 10 minutes for all other notifications. The relevant site settings are `personal email time window seconds` and `email time window mins`.
