mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 15:02:01 +08:00
DEV: update the comments re the encoded slug changes
* followup to 2e73985d
This commit is contained in:
parent
2e73985d1b
commit
40b0b549ff
@ -284,8 +284,9 @@ class Category < ActiveRecord::Base
|
|||||||
self.name.strip!
|
self.name.strip!
|
||||||
|
|
||||||
if slug.present?
|
if slug.present?
|
||||||
# santized custom slug
|
# if we don't unescape it first we strip the % from the encoded version
|
||||||
slug = SiteSetting.slug_generation_method == 'encoded' ? CGI.unescape(self.slug) : self.slug
|
slug = SiteSetting.slug_generation_method == 'encoded' ? CGI.unescape(self.slug) : self.slug
|
||||||
|
# sanitize the custom slug
|
||||||
self.slug = Slug.sanitize(slug)
|
self.slug = Slug.sanitize(slug)
|
||||||
errors.add(:slug, 'is already in use') if duplicate_slug?
|
errors.add(:slug, 'is already in use') if duplicate_slug?
|
||||||
else
|
else
|
||||||
|
@ -317,7 +317,7 @@ describe Category do
|
|||||||
expect(@category.slug_for_url).to eq("%E6%B5%8B%E8%AF%95")
|
expect(@category.slug_for_url).to eq("%E6%B5%8B%E8%AF%95")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "keeps the slug" do
|
it "keeps the encoded slug after saving" do
|
||||||
@category.save
|
@category.save
|
||||||
expect(@category.slug).to eq("%E6%B5%8B%E8%AF%95")
|
expect(@category.slug).to eq("%E6%B5%8B%E8%AF%95")
|
||||||
expect(@category.slug_for_url).to eq("%E6%B5%8B%E8%AF%95")
|
expect(@category.slug_for_url).to eq("%E6%B5%8B%E8%AF%95")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user