Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit cc48293

Browse files
committed
do where on join
1 parent 7c7b7a3 commit cc48293

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/controllers/discourse_ai/ai_bot/conversations_controller.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ def index
1515
Topic
1616
.private_messages_for_user(current_user)
1717
.where(user: current_user) # Only show PMs where the current user is the author
18-
.joins("INNER JOIN topic_custom_fields tcf ON tcf.topic_id = topics.id")
19-
.where("tcf.name = ? AND tcf.value = 't'", DiscourseAi::AiBot::TOPIC_AI_BOT_PM_FIELD)
18+
.joins(
19+
"INNER JOIN topic_custom_fields tcf ON tcf.topic_id = topics.id
20+
AND tcf.name = '#{DiscourseAi::AiBot::TOPIC_AI_BOT_PM_FIELD}'
21+
AND tcf.value = 't'",
22+
)
2023
.distinct
2124

2225
total = base_query.count

0 commit comments

Comments
 (0)