DEV: Resolve add_to_serializer deprecations (#46)

https://github.com/discourse/discourse/commit/26b7f8a63bfdb6505b605077a4beb962a9be7b97
This commit is contained in:
David Taylor
2023-04-24 16:07:17 +01:00
committed by GitHub
parent 057fbe1ce6
commit a0542d1859
2 changed files with 6 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
3.1.0.beta3: 057fbe1ce6
+5 -6
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 =