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

Commit 0c30616

Browse files
committed
fix spec so we are consistent
1 parent 68b4a06 commit 0c30616

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/utils/research/filter.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,16 @@ def search
249249
end
250250

251251
if @topic_ids.present?
252-
filtered =
253-
original_filtered.where(
254-
"posts.topic_id IN (?) AND posts.id IN (?)",
255-
@topic_ids,
256-
filtered.select("posts.id"),
257-
)
252+
if original_filtered == filtered
253+
filtered = original_filtered.where("posts.topic_id IN (?)", @topic_ids)
254+
else
255+
filtered =
256+
original_filtered.where(
257+
"posts.topic_id IN (?) OR posts.id IN (?)",
258+
@topic_ids,
259+
filtered.select("posts.id"),
260+
)
261+
end
258262
end
259263

260264
filtered = filtered.limit(@limit) if @limit.to_i > 0

0 commit comments

Comments
 (0)