A platform for community discussion. Free, open, simple.
FIX: don't send mailing list for post with empty content (#10577)
Krzysztof Kotlarek9954a677ab46
diff --git a/app/jobs/regular/notify_mailing_list_subscribers.rb b/app/jobs/regular/notify_mailing_list_subscribers.rbindex 66a86c89ffe..7cf01bf5d47 100644--- a/app/jobs/regular/notify_mailing_list_subscribers.rb+++ b/app/jobs/regular/notify_mailing_list_subscribers.rb@@ -26,7 +26,7 @@ module Jobspost_id = args[:post_id]post = post_id ? Post.with_deleted.find_by(id: post_id) : nil- return if !post || post.trashed? || post.user_deleted? || !post.topic+ return if !post || post.trashed? || post.user_deleted? || !post.topic || post.raw.blank?users =User.activated.not_silenced.not_suspended.realdiff --git a/spec/jobs/notify_mailing_list_subscribers_spec.rb b/spec/jobs/notify_mailing_list_subscribers_spec.rbindex 8d2d7133f29..8b09123a44d 100644--- a/spec/jobs/notify_mailing_list_subscribers_spec.rb+++ b/spec/jobs/notify_mailing_list_subscribers_spec.rb@@ -65,6 +65,11 @@ describe Jobs::NotifyMailingListSubscribers doinclude_examples "no emails"end+ context "with a empty post" do+ before { post.update_columns(raw: "") }+ include_examples "no emails"+ end+context "with a user_deleted post" dobefore { post.update(user_deleted: true) }include_examples "no emails"