FIX: Linking to a category via hashtag had a broken URL.

This commit is contained in:
Robin Ward 2020-02-12 14:15:07 -05:00
parent a791b67e66
commit 726d97b29d
2 changed files with 2 additions and 2 deletions

View File

@ -692,7 +692,7 @@ class Category < ActiveRecord::Base
end
def url_with_id
self.parent_category ? "#{url}/#{self.id}" : "#{Discourse.base_uri}/c/#{self.id}-#{self.slug}"
self.parent_category ? "#{url}/#{self.id}" : "#{Discourse.base_uri}/c/#{self.slug}/#{self.id}"
end
# If the name changes, try and update the category definition topic too if it's

View File

@ -686,7 +686,7 @@ describe Category do
fab!(:category) { Fabricate(:category_with_definition, name: 'cats') }
it "includes the id in the URL" do
expect(category.url_with_id).to eq("/c/#{category.id}-cats")
expect(category.url_with_id).to eq("/c/cats/#{category.id}")
end
context "child category" do