mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
FEATURE: allow admins to enable announced experimental features (#29244)
Toggle the button to enable the experimental site setting from "What's new" announcement. The toggle button is displayed when: - site setting exists and is boolean; - potentially required plugin is enabled.
This commit is contained in:

committed by
GitHub

parent
644e6c7f46
commit
433fadbd52
@ -48,6 +48,18 @@ class Admin::DashboardController < Admin::StaffController
|
||||
render json: data
|
||||
end
|
||||
|
||||
def toggle_feature
|
||||
Experiments::Toggle.call(service_params) do
|
||||
on_success { render(json: success_json) }
|
||||
on_failure { render(json: failed_json, status: 422) }
|
||||
on_failed_policy(:current_user_is_admin) { raise Discourse::InvalidAccess }
|
||||
on_failed_policy(:setting_is_available) { raise Discourse::InvalidAccess }
|
||||
on_failed_contract do |contract|
|
||||
render(json: failed_json.merge(errors: contract.errors.full_messages), status: 400)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def mark_new_features_as_seen
|
||||
|
Reference in New Issue
Block a user