FIX: PostAlerter should ignore deleted posts

This commit is contained in:
Robin Ward 2015-10-28 13:03:34 -04:00
parent 734c272de8
commit 971af6a762

View file

@ -3,10 +3,8 @@ module Jobs
def execute(args) def execute(args)
# maybe it was removed by the time we are making the post # maybe it was removed by the time we are making the post
if post = Post.find(args[:post_id]) post = Post.where(id: args[:post_id]).first
# maybe the topic was deleted, so skip in that case as well PostAlerter.post_created(post) if post && post.topic
PostAlerter.post_created(post) if post.topic
end
end end
end end