mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 02:54:29 +08:00
FEATURE: anonymous sidebar categories and tags (#18038)
Default sidebar tags for not authenticated users can be defined in admin panel. Otherwise, top 5 categories and tags are taken. Optionally, if categories are set up in permanent order, then the first 5 categories are taken.
This commit is contained in:

committed by
GitHub

parent
1d1a7db182
commit
2d58996a3b
@ -124,4 +124,15 @@ RSpec.describe SiteSerializer do
|
||||
serialized = described_class.new(Site.new(admin_guardian), scope: admin_guardian, root: false).as_json
|
||||
expect(serialized[:show_welcome_topic_banner]).to eq(true)
|
||||
end
|
||||
|
||||
it 'includes anonymous_default_sidebar_tags' do
|
||||
Fabricate(:tag, name: "dev")
|
||||
Fabricate(:tag, name: "random")
|
||||
serialized = described_class.new(Site.new(guardian), scope: guardian, root: false).as_json
|
||||
expect(serialized[:anonymous_default_sidebar_tags]).to eq(nil)
|
||||
|
||||
SiteSetting.default_sidebar_tags = "dev|random"
|
||||
serialized = described_class.new(Site.new(guardian), scope: guardian, root: false).as_json
|
||||
expect(serialized[:anonymous_default_sidebar_tags]).to eq(["dev", "random"])
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user