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

23 Zeilen
628 B
Ruby

2023-01-18 19:53:36 +01:00
# frozen_string_literal: true
class CustomWizard::WizardClientController < ::ApplicationController
before_action :ensure_plugin_enabled
before_action :set_builder
2024-10-16 14:18:23 +02:00
requires_plugin "discourse-custom-wizard"
2023-01-18 19:53:36 +01:00
private
def ensure_plugin_enabled
2024-10-16 13:52:03 +02:00
redirect_to path("/") unless SiteSetting.custom_wizard_enabled
2023-01-18 19:53:36 +01:00
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