FIX: Permalinks should redirect to category URL including the ID
This is a temporary fix. Urls for third-level categories should function without the id. Once that is fixed, this change can be reverted
This commit is contained in:
parent
4ecc0a25ae
commit
3215f2b6ee
|
@ -79,7 +79,7 @@ class Permalink < ActiveRecord::Base
|
|||
return external_url if external_url
|
||||
return "#{Discourse::base_uri}#{post.url}" if post
|
||||
return topic.relative_url if topic
|
||||
return category.url if category
|
||||
return "#{category.url}/#{category.id}" if category
|
||||
nil
|
||||
end
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ describe Permalink do
|
|||
|
||||
it "returns a category url when category_id is set" do
|
||||
permalink.category_id = category.id
|
||||
expect(target_url).to eq(category.url)
|
||||
expect(target_url).to eq("#{category.url}/#{category.id}")
|
||||
end
|
||||
|
||||
it "returns nil when category_id is set but category is not found" do
|
||||
|
|
Loading…
Reference in New Issue