Discourse Sidebar Menu Reorder

@nathank - ok i played around with this on my test instance and i was able to rename the section the-forum and then back to community.

when in the rails console, if you do:

SidebarSection.where(public: true).pluck(:id, :title, :section_type)

what does it output?

i am guessing it should give something like:

=> [..., [1, "the-forum", "community"]]

or

=> [..., [1, "The Forum", "community"]]

which would verify it is section_type = community with a different title. then we can do:

# find the default community section via rails enum
section = SidebarSection.find_by(section_type: :community)

# fallback: if not found by type, then look for the specific custom title
section ||= SidebarSection.find_by(title: 'the-forum', public: true)

if section
  section.update!(title: 'Community')
  puts "Success: The section has been renamed back to 'Community'."
else
  puts "Error: Section not found."
end

screenshot of my rails console showing the community section titled the-forum and renaming it back to Community, then verifying it was changed:

2 Likes