mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 18:13:58 +08:00
1859025228
Links like `/my/preferences` were invalid in custom section. The reason is that `/my` links are just redirects from backend, and they are not recognized as valid Ember paths. https://github.com/discourse/discourse/blob/main/config/routes.rb#L433 Therefore, regex match allowlist was added - similar to backend check: https://github.com/discourse/discourse/blob/main/app/controllers/users_controller.rb#L471 /safe-mode is same case
14 lines
307 B
Ruby
14 lines
307 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SidebarSectionSerializer < ApplicationSerializer
|
|
attributes :id, :title, :links, :slug, :public
|
|
|
|
def links
|
|
object.sidebar_section_links.map { |link| SidebarUrlSerializer.new(link.linkable, root: false) }
|
|
end
|
|
|
|
def slug
|
|
object.title.parameterize
|
|
end
|
|
end
|