mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:25:24 +08:00
FEATURE: public custom sidebar sections visible to anonymous (#20931)
Previously, public custom sections were only visible to logged-in users. In this PR, we are making them visible to anonymous as well. The reason is that Community Section will be moved into custom section model to be easily editable by admins.
This commit is contained in:

committed by
GitHub

parent
cd6d47e012
commit
e586f6052f
@ -79,8 +79,9 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||
|
||||
def sidebar_sections
|
||||
SidebarSection
|
||||
.public_sections
|
||||
.or(SidebarSection.where(user_id: object.id))
|
||||
.includes(sidebar_section_links: :linkable)
|
||||
.where("public OR user_id = ?", object.id)
|
||||
.order("(public IS TRUE) DESC")
|
||||
.map { |section| SidebarSectionSerializer.new(section, root: false) }
|
||||
end
|
||||
|
Reference in New Issue
Block a user