Skip to content

Commit 9aa3140

Browse files
committed
fix advanced search ISE on incorrect awareness table name
1 parent 4b49cbb commit 9aa3140

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/services/search/query_builder.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def apply_new_for_user(user_id, relation, negated:)
515515
<<~SQL.squish
516516
topics.id IN (
517517
SELECT t.id FROM topics t
518-
LEFT JOIN thread_awareness ta ON ta.topic_id = t.id AND ta.user_id = #{user_id.to_i}
518+
LEFT JOIN thread_awarenesses ta ON ta.topic_id = t.id AND ta.user_id = #{user_id.to_i}
519519
LEFT JOIN message_read_ranges mrr ON mrr.topic_id = t.id AND mrr.user_id = #{user_id.to_i}
520520
WHERE ta.aware_until_message_id IS NULL
521521
GROUP BY t.id
@@ -527,7 +527,7 @@ def apply_new_for_user(user_id, relation, negated:)
527527
<<~SQL.squish
528528
topics.id IN (
529529
SELECT t.id FROM topics t
530-
LEFT JOIN thread_awareness ta ON ta.topic_id = t.id AND ta.user_id = #{user_id.to_i}
530+
LEFT JOIN thread_awarenesses ta ON ta.topic_id = t.id AND ta.user_id = #{user_id.to_i}
531531
LEFT JOIN message_read_ranges mrr ON mrr.topic_id = t.id AND mrr.user_id = #{user_id.to_i}
532532
WHERE ta.aware_until_message_id IS NULL
533533
GROUP BY t.id
@@ -547,7 +547,7 @@ def apply_new_for_users(user_ids, relation, negated:)
547547
sanitized_ids = user_ids.map(&:to_i).join(",")
548548
# For team: topic is new if NO team member has any awareness or reads
549549
seen_sql = <<~SQL.squish
550-
SELECT DISTINCT topic_id FROM thread_awareness WHERE user_id IN (#{sanitized_ids})
550+
SELECT DISTINCT topic_id FROM thread_awarenesses WHERE user_id IN (#{sanitized_ids})
551551
UNION
552552
SELECT DISTINCT topic_id FROM message_read_ranges WHERE user_id IN (#{sanitized_ids})
553553
SQL

0 commit comments

Comments
 (0)