mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
We don't need to raise an error when no post is present. Just noop.
This commit is contained in:
parent
7a0501c0c0
commit
4f6e5fed2a
@ -10,8 +10,7 @@ module Jobs
|
||||
post_id = args[:post_id]
|
||||
post = post_id ? Post.with_deleted.find_by(id: post_id) : nil
|
||||
|
||||
raise Discourse::InvalidParameters.new(:post_id) unless post
|
||||
return if post.trashed? || post.user_deleted? || !post.topic
|
||||
return if !post || post.trashed? || post.user_deleted? || !post.topic
|
||||
|
||||
users =
|
||||
User.activated.not_blocked.not_suspended.real
|
||||
|
@ -32,9 +32,8 @@ describe Jobs::NotifyMailingListSubscribers do
|
||||
before { SiteSetting.disable_mailing_list_mode = false }
|
||||
|
||||
context "with an invalid post_id" do
|
||||
it "throws an error" do
|
||||
expect { Jobs::NotifyMailingListSubscribers.new.execute(post_id: -1) }.to raise_error(Discourse::InvalidParameters)
|
||||
end
|
||||
before { post.update(deleted_at: Time.now) }
|
||||
include_examples "no emails"
|
||||
end
|
||||
|
||||
context "with a deleted post" do
|
||||
|
Loading…
Reference in New Issue
Block a user