DEV: Resolve add_to_serializer deprecations (#46)

26b7f8a63b
This commit is contained in:
David Taylor 2023-04-24 16:07:17 +01:00 committed by GitHub
parent 057fbe1ce6
commit a0542d1859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -0,0 +1 @@
3.1.0.beta3: 057fbe1ce6

View File

@ -34,18 +34,17 @@ module DiscourseAi
end
%i[topic_view TopicViewPosts].each do |serializer|
plugin.add_to_serializer(serializer, :related_topics) do
plugin.add_to_serializer(
serializer,
:related_topics,
include_condition: -> { SiteSetting.ai_embeddings_semantic_related_topics_enabled },
) do
if object.next_page.nil? && !object.topic.private_message?
object.related_topics.map do |t|
SuggestedTopicSerializer.new(t, scope: scope, root: false)
end
end
end
# custom include method so we also check on semantic search
plugin.add_to_serializer(serializer, :include_related_topics?) do
plugin.enabled? && SiteSetting.ai_embeddings_semantic_related_topics_enabled
end
end
callback =