0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 10:40:28 +01:00

after_signup on approval fixes

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-19 16:42:44 +10:00
Ursprung bffdc1f363
Commit 47722d13a3
2 geänderte Dateien mit 11 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -46,8 +46,8 @@ class CustomWizard::Wizard
@needs_groups = false
@theme_id = attrs['theme_id']
if attrs['theme']
theme = Theme.find_by(name: attrs['theme'])
if attrs['theme'].present?
theme = ::Theme.find_by(name: attrs['theme'])
@theme_id = theme.id if theme
end
@ -210,7 +210,7 @@ class CustomWizard::Wizard
records
.sort_by { |record| record.value['permitted'].present? ? 0 : 1 }
.each do |record|
wizard = CustomWizard::Wizard.new(JSON.parse(record.value), user)
wizard = self.new(JSON.parse(record.value), user)
if wizard.permitted?
result = wizard
@ -344,7 +344,7 @@ class CustomWizard::Wizard
def self.create(wizard_id, user = nil)
if wizard = self.find(wizard_id)
CustomWizard::Wizard.new(wizard.to_h, user)
self.new(wizard.to_h, user)
else
false
end
@ -355,7 +355,7 @@ class CustomWizard::Wizard
end
def self.set_wizard_redirect(wizard_id, user)
wizard = CustomWizard::Wizard.create(wizard_id, user)
wizard = self.create(wizard_id, user)
if wizard.permitted?
user.custom_fields['redirect_to_wizard'] = wizard_id

Datei anzeigen

@ -118,8 +118,8 @@ after_initialize do
end
on(:user_approved) do |user|
if wizard_id = CustomWizard::Wizard.after_signup(user)
CustomWizard::Wizard.set_wizard_redirect(wizard_id, user)
if wizard = CustomWizard::Wizard.after_signup(user)
CustomWizard::Wizard.set_wizard_redirect(wizard.id, user)
end
end