mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
Followup9359227645As pointed out in https://meta.discourse.org/t/-/404037, the group name "anonymous" is too generic and can conflict with existing _users_ as well as existing groups. This commit renames it to "anonymous_users" to avoid such conflicts, and also to match "logged_in_users" a bit better. In addition, this PR fixes some issues with the upcoming change introduced in9359227645... the anonymous/logged_in_users groups were not showing in the admin UI when the UC was enabled, and the logic for keeping everyone saved in the DB for now was not working for site settings.
38 lines
1.2 KiB
Ruby
Vendored
38 lines
1.2 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
class Admin::SearchController < Admin::AdminController
|
|
RESULT_TYPES = %w[page setting theme component report upcomingChange].freeze
|
|
|
|
def index
|
|
respond_to do |format|
|
|
format.json do
|
|
Admin::Search::List.call(service_params) do |result|
|
|
on_success do |settings:, themes_and_components:, reports:, upcoming_changes:|
|
|
themes_and_components_json =
|
|
ActiveModel::ArraySerializer.new(
|
|
themes_and_components,
|
|
each_serializer: BasicThemeSerializer,
|
|
scope: guardian,
|
|
).as_json
|
|
|
|
render_json_dump(
|
|
settings:,
|
|
themes_and_components: themes_and_components_json,
|
|
reports:,
|
|
upcoming_changes:,
|
|
)
|
|
end
|
|
on_failed_contract do |contract|
|
|
render(
|
|
json: failed_json.merge(errors: contract.errors.full_messages),
|
|
status: :bad_request,
|
|
)
|
|
end
|
|
on_failed_policy(:current_user_is_admin) { raise Discourse::InvalidAccess }
|
|
end
|
|
end
|
|
|
|
format.html { render body: nil }
|
|
end
|
|
end
|
|
end
|