FIX: Ensures we have a post before destroying it

This commit is contained in:
Joffrey JAFFEUX 2018-07-07 20:34:19 +02:00
parent f711077d48
commit 47b004a1ef
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,10 @@ module Jobs
topic = op.topic
post = topic.posts.find_by(post_number: post_number)
DiscourseSimpleCalendar::EventDestroyer.destroy(op, post_number.to_s)
PostDestroyer.new(Discourse.system_user, post).destroy
if post
PostDestroyer.new(Discourse.system_user, post).destroy
end
end
end
end