mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:34:50 +08:00
DEV: configurable custom sidebar sections (#20057)
Allows users to configure their own custom sidebar sections with links withing Discourse instance. Links can be passed as relative path, for example "/tags" or full URL. Only path is saved in DB, so when Discourse domain is changed, links will be still valid. Feature is hidden behind SiteSetting.enable_custom_sidebar_sections. This hidden setting determines the group which members have access to this new feature.
This commit is contained in:

committed by
GitHub

parent
5d28cb709a
commit
84a87a703c
@ -69,7 +69,9 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||
:display_sidebar_tags,
|
||||
:sidebar_tags,
|
||||
:sidebar_category_ids,
|
||||
:sidebar_list_destination
|
||||
:sidebar_list_destination,
|
||||
:sidebar_sections,
|
||||
:custom_sidebar_sections_enabled
|
||||
|
||||
delegate :user_stat, to: :object, private: true
|
||||
delegate :any_posts, :draft_count, :pending_posts_count, :read_faq?, to: :user_stat
|
||||
@ -309,4 +311,11 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||
false
|
||||
end
|
||||
end
|
||||
def custom_sidebar_sections_enabled
|
||||
if SiteSetting.enable_custom_sidebar_sections.present?
|
||||
object.in_any_groups?(SiteSetting.enable_custom_sidebar_sections_map)
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user