* Rename SiteConfig * More renaming * Update spec * Update mandatory settings mapping * More renaming * e2e test fixes * You have a rename, and you have a rename * Spec fix * More changes * Temporarily disable specs * After-merge update * Undo rename for migration * undo rename of DUS * Fix DUS * Fix merge problem * Remove redundant DUS * Fix specs * Remove unused code * Change wrong class name * More cleanup * Re-add missing values to constant * Fix constant * Fix spec * Remove obsolete fields * Add accidentally removed field * Update spec * Move methods from Settings::General to ForemInstance * Remove unneeded model * Change mentions of 'site config'
29 lines
698 B
Ruby
29 lines
698 B
Ruby
module Users
|
|
class CreateMascotAccount
|
|
MASCOT_PARAMS = {
|
|
email: "mascot@forem.com",
|
|
username: "mascot",
|
|
name: "Mascot",
|
|
profile_image: Settings::General.mascot_image_url,
|
|
confirmed_at: Time.current,
|
|
registered_at: Time.current,
|
|
password: SecureRandom.hex
|
|
}.freeze
|
|
|
|
def self.call
|
|
new.call
|
|
end
|
|
|
|
def call
|
|
raise "Mascot already set" if Settings::General.mascot_user_id
|
|
|
|
mascot = User.create!(mascot_params)
|
|
Settings::General.mascot_user_id = mascot.id
|
|
end
|
|
|
|
def mascot_params
|
|
# Set the password_confirmation
|
|
MASCOT_PARAMS.merge(password_confirmation: MASCOT_PARAMS[:password])
|
|
end
|
|
end
|
|
end
|