# When site require approvals for users, email replies do not get sent to staged users

**URL:** https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832
**Category:** Bug
**Created:** [August 26, 2017, 2:07pm UTC](https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832 "2017-08-26T14:07:43Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [August 26, 2017, 2:07pm UTC](https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832/1 "2017-08-26T14:07:43Z")

</div>

In `notification_emailer.rb`:

```ruby
    def perform_enqueue(type, delay)
      user = notification.user
      return unless user.active? || user.staged?
      return if SiteSetting.must_approve_users? && !user.approved?

      return unless EMAILABLE_POST_TYPES.include?(post_type)

      Jobs.enqueue_in(delay, :user_email, self.class.notification_params(notification, type))
    end

```

The line:

`return if SiteSetting.must_approve_users? && !user.approved?`

is suspect because _staged_ users are **obviously NOT approved** … it would be rather strange for a user to be _staged_ but then approved.

Therefore the whole thing falls apart if the forum is set to require approval.

I’m pretty sure the code should be:

```ruby
return if SiteSetting.must_approve_users? && !user.staged? && !user.approved?

```

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [August 26, 2017, 5:31pm UTC](https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832/2 "2017-08-26T17:31:51Z")

</div>

Are they not getting notified of replies to topics they started as a staged user?

> [@Configuring incoming email to create new topics or group messages](https://meta.discourse.org/t/configuring-incoming-email-to-create-new-topics-or-group-messages/62977/1):
>
> That’s why we came up with the idea of staged users. They are special user accounts in Discourse.
> 
> They can’t be mentioned or searched for, they will never receive a digest and they can only be notified of and reply to the topics they started or were invited in.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 26, 2017, 7:36pm UTC](https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832/3 "2017-08-26T19:36:21Z")

</div>

Quite possibly, what do you think @sam?

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [August 27, 2017, 3:18am UTC](https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832/4 "2017-08-27T03:18:22Z")

</div>

Correct. Even if they originated the topics via rmail, they won’t get reply emails. The `return` statement blocks it.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 28, 2017, 12:57pm UTC](https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832/5 "2017-08-28T12:57:02Z")

</div>

Will write a test for this later today

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 28, 2017, 9:32pm UTC](https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832/7 "2017-08-28T21:32:38Z")

</div>

Fixed per:

[https://github.com/discourse/discourse/commit/50203794e6d338d48746b087d70c83f775233e3d](https://github.com/discourse/discourse/commit/50203794e6d338d48746b087d70c83f775233e3d)

Thanks for the report!

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 28, 2017, 9:32pm UTC](https://meta.discourse.org/t/when-site-require-approvals-for-users-email-replies-do-not-get-sent-to-staged-users/68832/8 "2017-08-28T21:32:40Z")

</div>


