mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
FIX: Linking to a category via hashtag had a broken URL.
This commit is contained in:
parent
a791b67e66
commit
726d97b29d
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user