mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
FEATURE: Onebox local categories (#11311)
* FEATURE: onebox for local categories This commit adjusts the category onebox to look more like the category boxes do on the category page. Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
This commit is contained in:
@ -188,5 +188,28 @@ describe OneboxController do
|
||||
get "/onebox.json", params: { url: url }
|
||||
expect(response.body).to include('blockquote')
|
||||
end
|
||||
|
||||
context 'local categories' do
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
|
||||
it 'oneboxes a public category' do
|
||||
get "/onebox.json", params: { url: category.url }
|
||||
expect(response.body).to include('aside')
|
||||
end
|
||||
|
||||
it 'includes subcategories' do
|
||||
subcategory = Fabricate(:category, name: "child", parent_category_id: category.id)
|
||||
|
||||
get "/onebox.json", params: { url: subcategory.url }
|
||||
expect(response.body).not_to include('subcategories')
|
||||
end
|
||||
|
||||
it 'does not onebox restricted categories' do
|
||||
staff_category = Fabricate(:private_category, group: Group[:staff])
|
||||
|
||||
get "/onebox.json", params: { url: staff_category.url }
|
||||
expect(response.body).not_to include('aside')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user