Skip to content

Commit 212ee23

Browse files
authored
FIX: Use new report color keys defined in discourse/discourse#27240 (#660)
1 parent 8b81ff4 commit 212ee23

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/sentiment/entry_point.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def inject_into(plugin)
5656
data_points.map do |point|
5757
{
5858
req: "sentiment_#{point}",
59-
color: point == "positive" ? report.colors[1] : report.colors[3],
59+
color: point == "positive" ? report.colors[:lime] : report.colors[:purple],
6060
label: I18n.t("discourse_ai.sentiment.reports.overall_sentiment.#{point}"),
6161
data:
6262
grouped_sentiments.map do |gs|
@@ -105,18 +105,19 @@ def inject_into(plugin)
105105
threshold: threshold,
106106
)
107107

108+
return report if grouped_emotions.empty?
109+
108110
emotions = %w[sadness disgust fear anger joy surprise]
109111
level_groups = [[0, 1], [2, 3, 4]]
110112

111-
return report if grouped_emotions.empty?
112-
113113
report.data =
114114
level_groups.each_with_index.map do |lg, idx|
115+
color = idx == 0 ? :turquoise : :lime
115116
tl_emotion_avgs = grouped_emotions.select { |ge| lg.include?(ge.trust_level) }
116117

117118
{
118119
req: "emotion_tl_#{lg.join}",
119-
color: report.colors[idx],
120+
color: report.colors[color],
120121
label: I18n.t("discourse_ai.sentiment.reports.post_emotion.tl_#{lg.join}"),
121122
data:
122123
emotions.map do |e|

0 commit comments

Comments
 (0)