mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 03:03:37 +08:00
FIX: new-topic route with sub-category and tags were broken (#12503)
https://meta.discourse.org/t/complex-url-for-creating-new-topics-results-in-server-side-error/184067/4?u=techapj
This commit is contained in:
parent
ee17ca9dc6
commit
c449bf77b3
|
@ -69,9 +69,8 @@ class TopicList < DraftableList
|
|||
else
|
||||
"topic_list_#{@category.url.sub(/^\//, '')}/l/#{@filter}"
|
||||
end
|
||||
elsif @tags
|
||||
tag = @tags.first
|
||||
"topic_list_tag/#{tag.name}/l/#{@filter}"
|
||||
elsif @tags && @tags.first.present?
|
||||
"topic_list_tag/#{@tags.first.name}/l/#{@filter}"
|
||||
else
|
||||
"topic_list_#{@filter}"
|
||||
end
|
||||
|
|
|
@ -109,5 +109,10 @@ describe TopicList do
|
|||
topic_list = TopicList.new('latest', nil, nil, tags: [tag])
|
||||
expect(topic_list.preload_key).to eq("topic_list_tag/#{tag.name}/l/latest")
|
||||
end
|
||||
|
||||
it "generates correct key when both category and tags are missing" do
|
||||
topic_list = TopicList.new('latest', nil, nil, tags: Tag.none)
|
||||
expect(topic_list.preload_key).to eq("topic_list_latest")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user