0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/app/controllers/admin/onboarding_events_controller.rb
Keegan George 4004016329
FEATURE: Log staff actions for admin onboarding panel steps (#42032)
**Previously**, nothing was recorded when an admin completed or
dismissed the onboarding panel. Because `enable_site_owner_onboarding`
is a hidden setting, `SiteSetting#log` skipped it too, so there was no
audit trail for how admins moved through the guide.

**In this update**, each step completion, full onboarding completion,
and panel dismissal writes a dedicated `UserHistory` staff action.

| Before | After |
| --- | --- |
|
![before](https://github.com/discourse/discourse/releases/download/_gh-attach-assets/before-7dzr6v.png)
|
![after](https://github.com/discourse/discourse/releases/download/_gh-attach-assets/after-jkomt5.png)
|
2026-07-24 14:43:01 -07:00

24 lines
686 B
Ruby
Vendored

# frozen_string_literal: true
class Admin::OnboardingEventsController < Admin::AdminController
STEPS = %w[select_theme invite_collaborators start_posting].freeze
def create
logger = StaffActionLogger.new(current_user)
case params.require(:event)
when "step_completed"
step = params.require(:step)
raise Discourse::InvalidParameters.new(:step) if !STEPS.include?(step)
logger.log_admin_onboarding_step_completed(step)
when "completed"
logger.log_admin_onboarding_completed
when "dismissed"
logger.log_admin_onboarding_dismissed
else
raise Discourse::InvalidParameters.new(:event)
end
head :no_content
end
end