FIX: Don't send notification email when user isn't allowed to see topic

This commit is contained in:
Gerhard Schlager
2019-07-01 13:57:33 +02:00
parent 997250586c
commit d513c28e3b
4 changed files with 26 additions and 2 deletions

View File

@@ -41,6 +41,10 @@ module Jobs
unless post.present?
return skip(SkippedEmailLog.reason_types[:user_email_post_not_found])
end
if !Guardian.new(user).can_see?(post)
return skip(SkippedEmailLog.reason_types[:user_email_access_denied])
end
end
if args[:notification_id].present?

View File

@@ -35,7 +35,8 @@ class SkippedEmailLog < ActiveRecord::Base
sender_text_part_body_blank: 18,
sender_body_blank: 19,
sender_post_deleted: 20,
sender_message_to_invalid: 21
sender_message_to_invalid: 21,
user_email_access_denied: 22
# you need to add the reason in server.en.yml below the "skipped_email_log" key
# when you add a new enum value
)