FIX: Handle encoded slugs for subcategories
This commit is contained in:
parent
85140aa09a
commit
f97b6e85da
|
@ -283,7 +283,13 @@ Category.reopenClass({
|
|||
return (
|
||||
item &&
|
||||
item.get("parentCategory") === parentCategory &&
|
||||
Category.slugFor(item) === parentSlug + "/" + slug
|
||||
(
|
||||
Discourse.SiteSettings.slug_generation_method !== "encoded" &&
|
||||
Category.slugFor(item) === parentSlug + "/" + slug
|
||||
||
|
||||
Discourse.SiteSettings.slug_generation_method === "encoded" &&
|
||||
Category.slugFor(item) === encodeURI(parentSlug) + "/" + encodeURI(slug)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -607,7 +607,8 @@ class Category < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.query_parent_category(parent_slug)
|
||||
self.where(slug: parent_slug, parent_category_id: nil).pluck(:id).first ||
|
||||
encoded_parent_slug = CGI.escape(parent_slug) if SiteSetting.slug_generation_method == 'encoded'
|
||||
self.where(slug: (encoded_parent_slug || parent_slug), parent_category_id: nil).pluck(:id).first ||
|
||||
self.where(id: parent_slug.to_i).pluck(:id).first
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue