mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 18:05:37 +08:00
FIX: We missed some references to /category/xyz
in the ruby code base.
This commit is contained in:
parent
14daf622d0
commit
114cc1c851
|
@ -369,7 +369,7 @@ SQL
|
|||
def url
|
||||
url = @@url_cache[self.id]
|
||||
unless url
|
||||
url = "/category"
|
||||
url = "/c"
|
||||
url << "/#{parent_category.slug}" if parent_category_id
|
||||
url << "/#{slug}"
|
||||
url.freeze
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<%= render_topic_title(@topic_view.topic) %>
|
||||
</h2>
|
||||
<% 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 %>
|
||||
<hr/>
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ describe TopicQuery do
|
|||
|
||||
list = TopicQuery.new(moderator, category: diff_category.slug).list_latest
|
||||
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
|
||||
TopicQuery.new(moderator, category: 'made up slug').list_latest.topics.size.should == 2
|
||||
|
|
|
@ -441,7 +441,7 @@ describe Category do
|
|||
describe "#url" do
|
||||
it "builds a url for normal categories" do
|
||||
category = Fabricate(:category, name: "cats")
|
||||
expect(category.url).to eq "/category/cats"
|
||||
expect(category.url).to eq "/c/cats"
|
||||
end
|
||||
|
||||
describe "for subcategories" do
|
||||
|
@ -449,7 +449,7 @@ describe Category do
|
|||
parent_category = Fabricate(:category, name: "parent")
|
||||
subcategory = Fabricate(:category, name: "child",
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user