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

In notification_emailer.rb:

    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:

return if SiteSetting.must_approve_users? && !user.staged? && !user.approved?
3 Likes

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

Quite possibly, what do you think @sam?

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

1 Like

Will write a test for this later today

2 Likes

Fixed per:

https://github.com/discourse/discourse/commit/50203794e6d338d48746b087d70c83f775233e3d

Thanks for the report!

6 Likes