A platform for community discussion. Free, open, simple.
FIX: Permalinks should redirect to category URL including the ID
David Taylor3215f2b6ee68
diff --git a/app/models/permalink.rb b/app/models/permalink.rbindex c6c28026ee9..925f640f7e0 100644--- a/app/models/permalink.rb+++ b/app/models/permalink.rb@@ -79,7 +79,7 @@ class Permalink < ActiveRecord::Basereturn external_url if external_urlreturn "#{Discourse::base_uri}#{post.url}" if postreturn topic.relative_url if topic- return category.url if category+ return "#{category.url}/#{category.id}" if categorynilenddiff --git a/spec/models/permalink_spec.rb b/spec/models/permalink_spec.rbindex 15c47b0032e..8cd9d30a46a 100644--- a/spec/models/permalink_spec.rb+++ b/spec/models/permalink_spec.rb@@ -62,7 +62,7 @@ describe Permalink doit "returns a category url when category_id is set" dopermalink.category_id = category.id- expect(target_url).to eq(category.url)+ expect(target_url).to eq("#{category.url}/#{category.id}")endit "returns nil when category_id is set but category is not found" do