This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-8
lines changed
assets/javascripts/discourse/components Expand file tree Collapse file tree 3 files changed +28
-8
lines changed Original file line number Diff line number Diff line change 11import Component from " @glimmer/component" ;
22import { service } from " @ember/service" ;
33import { htmlSafe } from " @ember/template" ;
4- import { emojiUnescape , sanitize } from " discourse/lib/text" ;
54
65export default class AiTopicGist extends Component {
76 @service gists;
@@ -10,20 +9,30 @@ export default class AiTopicGist extends Component {
109 return this .gists .preference === " table-ai" && this .gists .shouldShow ;
1110 }
1211
13- get gistOrExcerpt () {
14- const topic = this .args .topic ;
15- const gist = topic .get (" ai_topic_gist" );
16- const excerpt = emojiUnescape (sanitize (topic .get (" excerpt" )));
12+ get hasGist () {
13+ return !! this .gist ;
14+ }
15+
16+ get gist () {
17+ return this .args .topic .get (" ai_topic_gist" );
18+ }
1719
18- return gist || excerpt;
20+ get escapedExceprt () {
21+ return this .args .topic .get (" escapedExcerpt" );
1922 }
2023
2124 <template >
2225 {{#if this . shouldShow }}
23- {{#if this . gistOrExcerpt }}
26+ {{#if this . hasGist }}
2427 <div class =" excerpt" >
25- <div >{{htmlSafe this . gistOrExcerpt }} </div >
28+ <div >{{this .gist }} </div >
2629 </div >
30+ {{else }}
31+ {{#if this . esacpedExceprt }}
32+ <div class =" excerpt" >
33+ <div >{{htmlSafe this . escapedExceprt}} </div >
34+ </div >
35+ {{/if }}
2736 {{/if }}
2837 {{/if }}
2938 </template >
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ def can_see_summary?(target)
2424 def can_see_gists?
2525 return false if !SiteSetting . ai_summarization_enabled
2626 return false if SiteSetting . ai_summarize_max_hot_topics_gists_per_batch . zero?
27+ if SiteSetting . ai_hot_topic_gists_allowed_groups . to_s == Group ::AUTO_GROUPS [ :everyone ] . to_s
28+ return true
29+ end
2730 return false if anonymous?
2831 return false if SiteSetting . ai_hot_topic_gists_allowed_groups_map . empty?
2932
Original file line number Diff line number Diff line change 8989 end
9090 end
9191
92+ context "when setting is set to everyone" do
93+ before { SiteSetting . ai_hot_topic_gists_allowed_groups = Group ::AUTO_GROUPS [ :everyone ] }
94+
95+ it "returns true" do
96+ expect ( guardian . can_see_gists? ) . to eq ( true )
97+ end
98+ end
99+
92100 context "when there is a user but it's not a member of the allowed groups" do
93101 before { SiteSetting . ai_hot_topic_gists_allowed_groups = "" }
94102
You can’t perform that action at this time.
0 commit comments