0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-27 11:20:28 +01:00
discourse-custom-wizard/app/controllers/custom_wizard/wizard_client.rb
2024-10-16 14:18:23 +02:00

22 Zeilen
628 B
Ruby

# frozen_string_literal: true
class CustomWizard::WizardClientController < ::ApplicationController
before_action :ensure_plugin_enabled
before_action :set_builder
requires_plugin "discourse-custom-wizard"
private
def ensure_plugin_enabled
redirect_to path("/") unless SiteSetting.custom_wizard_enabled
end
def guest_id
return nil if current_user.present?
cookies[:custom_wizard_guest_id] ||= CustomWizard::Wizard.generate_guest_id
cookies[:custom_wizard_guest_id]
end
def set_builder
@builder = CustomWizard::Builder.new(params[:wizard_id].underscore, current_user, guest_id)
end
end