FIX: Ignore post when topic doesn't exist anymore
This commit is contained in:
parent
d51f8a6708
commit
afe7eea61c
|
@ -77,8 +77,8 @@ after_initialize do
|
||||||
end
|
end
|
||||||
|
|
||||||
on(:post_destroyed) do |post, _, _|
|
on(:post_destroyed) do |post, _, _|
|
||||||
op = post.topic.first_post
|
op = post.topic&.first_post
|
||||||
DiscourseCalendar::EventDestroyer.destroy(op, post.post_number.to_s) if op.calendar_details.present?
|
DiscourseCalendar::EventDestroyer.destroy(op, post.post_number.to_s) if op&.calendar_details.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
validate(:post, :validate_calendar) do |force = nil|
|
validate(:post, :validate_calendar) do |force = nil|
|
||||||
|
|
Loading…
Reference in New Issue