FIX: convert tag string to array when filtering topic list by tags

This commit is contained in:
Arpit Jalan 2018-10-08 08:55:41 +05:30
parent 8825cb1cc5
commit c0bb04d89d
2 changed files with 2 additions and 1 deletions

View File

@ -634,6 +634,7 @@ class TopicQuery
result = 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]

View File

@ -174,7 +174,7 @@ describe TopicQuery do
let!(: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)