FIX: We missed some references to /category/xyz in the ruby code base.

This commit is contained in:
Robin Ward 2015-01-07 11:45:57 -05:00
parent 14daf622d0
commit 114cc1c851
4 changed files with 5 additions and 5 deletions

View File

@ -369,7 +369,7 @@ SQL
def url def url
url = @@url_cache[self.id] url = @@url_cache[self.id]
unless url unless url
url = "/category" url = "/c"
url << "/#{parent_category.slug}" if parent_category_id url << "/#{parent_category.slug}" if parent_category_id
url << "/#{slug}" url << "/#{slug}"
url.freeze url.freeze

View File

@ -2,7 +2,7 @@
<%= render_topic_title(@topic_view.topic) %> <%= render_topic_title(@topic_view.topic) %>
</h2> </h2>
<% if c = @topic_view.topic.category %> <% if c = @topic_view.topic.category %>
<a href="/c/<%= c.slug.blank? ? c.id : c.slug %>"><%= c.name %></a> <%= link_to c.name, c.url %>
<% end %> <% end %>
<hr/> <hr/>

View File

@ -84,7 +84,7 @@ describe TopicQuery do
list = TopicQuery.new(moderator, category: diff_category.slug).list_latest list = TopicQuery.new(moderator, category: diff_category.slug).list_latest
list.topics.size.should == 1 list.topics.size.should == 1
list.preload_key.should == "topic_list_category/different-category/l/latest" list.preload_key.should == "topic_list_c/different-category/l/latest"
# Defaults to no category filter when slug does not exist # Defaults to no category filter when slug does not exist
TopicQuery.new(moderator, category: 'made up slug').list_latest.topics.size.should == 2 TopicQuery.new(moderator, category: 'made up slug').list_latest.topics.size.should == 2

View File

@ -441,7 +441,7 @@ describe Category do
describe "#url" do describe "#url" do
it "builds a url for normal categories" do it "builds a url for normal categories" do
category = Fabricate(:category, name: "cats") category = Fabricate(:category, name: "cats")
expect(category.url).to eq "/category/cats" expect(category.url).to eq "/c/cats"
end end
describe "for subcategories" do describe "for subcategories" do
@ -449,7 +449,7 @@ describe Category do
parent_category = Fabricate(:category, name: "parent") parent_category = Fabricate(:category, name: "parent")
subcategory = Fabricate(:category, name: "child", subcategory = Fabricate(:category, name: "child",
parent_category_id: parent_category.id) parent_category_id: parent_category.id)
expect(subcategory.url).to eq "/category/parent/child" expect(subcategory.url).to eq "/c/parent/child"
end end
end end
end end