Fix plugin's compatibility with older discourse versions.
Follow-up to d469260bf9
This commit is contained in:
parent
f5cb5a2ac2
commit
14a7649840
|
@ -196,9 +196,11 @@ after_initialize do
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: Switch to an official plugin API once support for it has landed.
|
# TODO: Switch to an official plugin API once support for it has landed.
|
||||||
TopicView.on_preload do |topic_view|
|
if TopicView.respond_to?(:on_preload)
|
||||||
if SiteSetting.discourse_post_event_enabled
|
TopicView.on_preload do |topic_view|
|
||||||
topic_view.instance_variable_set(:@posts, topic_view.posts.includes(:event))
|
if SiteSetting.discourse_post_event_enabled
|
||||||
|
topic_view.instance_variable_set(:@posts, topic_view.posts.includes(:event))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue