A platform for community discussion. Free, open, simple.
FIX: convert tag string to array when filtering topic list by tags
Arpit Jalanc0bb04d89d50
diff --git a/lib/topic_query.rb b/lib/topic_query.rbindex 6e299e73ba6..39495cb2f94 100644--- a/lib/topic_query.rb+++ b/lib/topic_query.rb@@ -634,6 +634,7 @@ class TopicQueryresult = result.preload(:tags)if @options[:tags] && @options[:tags].size > 0+ @options[:tags] = @options[:tags].split unless @options[:tags].respond_to?('each')@options[:tags].each { |t| t.downcase! if t.is_a? String }if @options[:match_all_tags]diff --git a/spec/components/topic_query_spec.rb b/spec/components/topic_query_spec.rbindex 7eac899b2ba..7c70d4a049f 100644--- a/spec/components/topic_query_spec.rb+++ b/spec/components/topic_query_spec.rb@@ -174,7 +174,7 @@ describe TopicQuery dolet!(:no_tags_topic) { Fabricate(:topic) }it "returns topics with the tag when filtered to it" do- expect(TopicQuery.new(moderator, tags: [tag.name]).list_latest.topics)+ expect(TopicQuery.new(moderator, tags: tag.name).list_latest.topics).to contain_exactly(tagged_topic1, tagged_topic3)expect(TopicQuery.new(moderator, tags: [tag.id]).list_latest.topics)