discourse-ai/assets/javascripts/discourse/connectors/topic-above-suggested/related-topics.js
Sam 1d097b9d82
FEATURE: attempt to include related topics above suggested (#28)
Allows related topics to show up for logged on users

- Introduces a new "Related Topics" block above suggested when related topics exist
- Renames `ai_embeddings_semantic_suggested_topics_anons_enabled` -> `ai_embeddings_semantic_suggested_topics_enabled` (given it is only deployed on 1 site not bothering with a migration)
- Adds an integration test to ensure data arrives correctly on the client
2023-03-31 09:07:22 +11:00

15 lines
363 B
JavaScript

export default {
shouldRender(args) {
return (args.model.related_topics?.length || 0) > 0;
},
setupComponent(args, component) {
if (component.model.related_topics) {
component.set(
"relatedTopics",
component.model.related_topics.map((topic) =>
this.store.createRecord("topic", topic)
)
);
}
},
};