FIX: ensures tags/categories are present (#28230)

Prior to this fix the query in stalled_topic_finder would assume that tags/categories would be nil or an array of ids. However it can be an empty array, in this case the query will not return results.
This commit is contained in:
Joffrey JAFFEUX
2024-08-05 22:26:12 +02:00
committed by GitHub
parent 48ac62dfef
commit a333d71d4c
2 changed files with 18 additions and 2 deletions

View File

@ -7,7 +7,7 @@ class DiscourseAutomation::StalledTopicFinder
FROM topics t
SQL
sql += <<~SQL if tags
sql += <<~SQL if tags.present?
JOIN topic_tags ON topic_tags.topic_id = t.id
JOIN tags
ON tags.name IN (:tags)
@ -31,7 +31,7 @@ class DiscourseAutomation::StalledTopicFinder
)
SQL
sql += <<~SQL if categories
sql += <<~SQL if categories.present?
AND t.category_id IN (:categories)
SQL