DEV: ensure compatibilty with stable

This commit is contained in:
Régis Hanol 2020-08-17 16:21:16 +02:00
parent 142b3db6b8
commit 8de0fa9ecf
1 changed files with 17 additions and 15 deletions

View File

@ -69,6 +69,7 @@ after_initialize do
end
end
if TopicQuery.respond_to?(:results_filter_callbacks)
TopicQuery.results_filter_callbacks << ->(_type, result, user, options) {
result = result.includes(:topic_vote_count)
@ -89,6 +90,7 @@ after_initialize do
result
}
end
add_to_serializer(:category, :custom_fields) do
object.custom_fields.merge(enable_topic_voting: DiscourseVoting::CategorySetting.find_by(category_id: object.id).present?)