mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-05-03 01:15:48 -04:00
FIX: Query for category hashtag should be case sensitive.
This commit is contained in:
parent
c7906d5a74
commit
6d64b6d39f
2 changed files with 8 additions and 1 deletions
|
@ -3,7 +3,6 @@ class CategoryHashtagsController < ApplicationController
|
||||||
|
|
||||||
def check
|
def check
|
||||||
category_slugs = params[:category_slugs]
|
category_slugs = params[:category_slugs]
|
||||||
category_slugs.each(&:downcase!)
|
|
||||||
|
|
||||||
ids = category_slugs.map { |category_slug| Category.query_from_hashtag_slug(category_slug).try(:id) }
|
ids = category_slugs.map { |category_slug| Category.query_from_hashtag_slug(category_slug).try(:id) }
|
||||||
|
|
||||||
|
|
|
@ -22,5 +22,13 @@ describe CategoryHashtag do
|
||||||
it "should return nil for incorrect parent and child category slug" do
|
it "should return nil for incorrect parent and child category slug" do
|
||||||
expect(Category.query_from_hashtag_slug("random-slug#{CategoryHashtag::SEPARATOR}random-slug")).to eq(nil)
|
expect(Category.query_from_hashtag_slug("random-slug#{CategoryHashtag::SEPARATOR}random-slug")).to eq(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should be case sensitive" do
|
||||||
|
parent_category.update_attributes!(slug: "ApPlE")
|
||||||
|
child_category.update_attributes!(slug: "OraNGE")
|
||||||
|
|
||||||
|
expect(Category.query_from_hashtag_slug("apple")).to eq(nil)
|
||||||
|
expect(Category.query_from_hashtag_slug("apple:orange")).to eq(nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue