A platform for community discussion. Free, open, simple.
FIX: ensures tags/categories are present (#28230)
Joffrey JAFFEUXa333d71d4ced
diff --git a/plugins/automation/lib/discourse_automation/stalled_topic_finder.rb b/plugins/automation/lib/discourse_automation/stalled_topic_finder.rbindex b7fc45382d8..7c2533ffcd7 100644--- a/plugins/automation/lib/discourse_automation/stalled_topic_finder.rb+++ b/plugins/automation/lib/discourse_automation/stalled_topic_finder.rb@@ -7,7 +7,7 @@ class DiscourseAutomation::StalledTopicFinderFROM topics tSQL- sql += <<~SQL if tags+ sql += <<~SQL if tags.present?JOIN topic_tags ON topic_tags.topic_id = t.idJOIN tagsON 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)SQLdiff --git a/plugins/automation/spec/lib/discourse_automation/stalled_topic_finder_spec.rb b/plugins/automation/spec/lib/discourse_automation/stalled_topic_finder_spec.rbindex 1d76a6fe341..810282aff11 100644--- a/plugins/automation/spec/lib/discourse_automation/stalled_topic_finder_spec.rb+++ b/plugins/automation/spec/lib/discourse_automation/stalled_topic_finder_spec.rb@@ -56,6 +56,14 @@ describe DiscourseAutomation::StalledTopicFinder dodescribed_class.call(2.hours.from_now, tags: [tag_1.name]).map(&:id),).to contain_exactly(topic_1.id)end++ it "still finds topics if tags is empty" do+ create_post(topic: topic_4, user: user)++ expect(described_class.call(2.hours.from_now, tags: []).map(&:id)).to contain_exactly(+ topic_4.id,+ )+ endenddescribe "filter by categories" do@@ -80,6 +88,14 @@ describe DiscourseAutomation::StalledTopicFinder dodescribed_class.call(2.hours.from_now, categories: [category_1.id]).map(&:id),).to contain_exactly(topic_1.id)end++ it "still finds topics if categories is empty" do+ create_post(topic: topic_1, user: user)++ expect(described_class.call(2.hours.from_now, categories: []).map(&:id)).to contain_exactly(+ topic_1.id,+ )+ endenddescribe "filter recent topic owner replies" do