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:
David Taylor 2020-03-20 22:06:20 +00:00
parent 4ecc0a25ae
commit 3215f2b6ee
No known key found for this signature in database
GPG Key ID: 46904C18B1D3F434
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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