FIX: Don't preload unless the plugin is enabled

This commit is contained in:
Robin Ward 2017-09-25 14:51:49 -04:00
parent 856c5a5435
commit 7720ceed24
1 changed files with 17 additions and 15 deletions

View File

@ -41,6 +41,7 @@ after_initialize do
end
TopicList.on_preload do |topics, topic_list|
if SiteSetting.assign_enabled?
is_staff = topic_list.current_user && topic_list.current_user.staff?
allowed_access = SiteSetting.assigns_public || is_staff
@ -63,6 +64,7 @@ after_initialize do
end
end
end
end
require_dependency 'topic_query'
TopicQuery.add_custom_filter(:assigned) do |results, topic_query|