FEATURE: Show gists everywhere except suggested/related (#995)
This commit is contained in:
parent
04c4ff8cf0
commit
97ec2c5ff4
|
@ -7,15 +7,9 @@ export default class Gists extends Service {
|
||||||
@tracked preference = localStorage.getItem("topicListLayout");
|
@tracked preference = localStorage.getItem("topicListLayout");
|
||||||
|
|
||||||
get shouldShow() {
|
get shouldShow() {
|
||||||
const currentRoute = this.router.currentRoute.name;
|
return this.router.currentRoute.attributes?.list?.topics?.some(
|
||||||
const isDiscovery = currentRoute.includes("discovery");
|
(topic) => topic.ai_topic_gist
|
||||||
const isNotCategories = !currentRoute.includes("categories");
|
);
|
||||||
const gistsAvailable =
|
|
||||||
this.router.currentRoute.attributes?.list?.topics?.some(
|
|
||||||
(topic) => topic.ai_topic_gist
|
|
||||||
);
|
|
||||||
|
|
||||||
return isDiscovery && isNotCategories && gistsAvailable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setPreference(value) {
|
setPreference(value) {
|
||||||
|
|
|
@ -17,9 +17,12 @@ module DiscourseAi
|
||||||
scope.can_see_summary?(object.topic)
|
scope.can_see_summary?(object.topic)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Don't add gists to the following topic lists.
|
||||||
|
gist_skipped_lists = %i[suggested semantic_related]
|
||||||
|
|
||||||
plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
|
plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
|
||||||
if Discourse.filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
|
if SiteSetting.ai_summarization_enabled && SiteSetting.ai_summary_gists_enabled &&
|
||||||
SiteSetting.ai_summary_gists_enabled
|
!gist_skipped_lists.include?(options[:filter])
|
||||||
topics.includes(:ai_gist_summary)
|
topics.includes(:ai_gist_summary)
|
||||||
else
|
else
|
||||||
topics
|
topics
|
||||||
|
@ -31,7 +34,7 @@ module DiscourseAi
|
||||||
:ai_topic_gist,
|
:ai_topic_gist,
|
||||||
include_condition: -> { scope.can_see_gists? },
|
include_condition: -> { scope.can_see_gists? },
|
||||||
) do
|
) do
|
||||||
return if !Discourse.filters.include?(options[:filter])
|
return if gist_skipped_lists.include?(options[:filter])
|
||||||
object.ai_gist_summary&.summarized_text
|
object.ai_gist_summary&.summarized_text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue