diff --git a/app/controllers/backend/verifications_controller.rb b/app/controllers/backend/verifications_controller.rb index c908594..108d898 100644 --- a/app/controllers/backend/verifications_controller.rb +++ b/app/controllers/backend/verifications_controller.rb @@ -84,6 +84,21 @@ module Backend @verification.create_activity(key: "verification.approve", owner: current_user, recipient: @verification.identity, parameters: { ysws_eligible: ysws_eligible }) + # Auto-promote on verification approval for scenarios that opt in. + begin + ident = @verification.identity + if ident.present? && ident.slack_id.present? && ident.promote_click_count == 0 + scenario = ident.onboarding_scenario_instance + if scenario&.promote_on_verification + Tutorial::AgreeJob.perform_later(ident) + Rails.logger.info "Enqueued auto-promotion for identity #{ident.id} (verification #{@verification.id})" + end + end + rescue => e + Rails.logger.error "Auto-promote on verification approval failed: #{e.message}" + Sentry.capture_exception(e) if defined?(Sentry) + end + redirect_to pending_backend_verifications_path end diff --git a/app/frontend/images/riceathon/RiceathonGlow.png b/app/frontend/images/riceathon/RiceathonGlow.png new file mode 100644 index 0000000..dc8ae55 Binary files /dev/null and b/app/frontend/images/riceathon/RiceathonGlow.png differ diff --git a/app/models/onboarding_scenarios/base.rb b/app/models/onboarding_scenarios/base.rb index 96d1e6c..8129297 100644 --- a/app/models/onboarding_scenarios/base.rb +++ b/app/models/onboarding_scenarios/base.rb @@ -50,6 +50,9 @@ module OnboardingScenarios # Returns array of channel names/IDs to add when promoting guest to full member def promotion_channels = [] + # Whether to auto-promote when identity verification in HCA is approved + def promote_on_verification = false + # Returns :internal_tutorial or :external_program def slack_onboarding_flow = :external_program diff --git a/app/models/onboarding_scenarios/riceathon.rb b/app/models/onboarding_scenarios/riceathon.rb new file mode 100644 index 0000000..4de3143 --- /dev/null +++ b/app/models/onboarding_scenarios/riceathon.rb @@ -0,0 +1,27 @@ +module OnboardingScenarios + class Riceathon < Base + def self.slug = "riceathon" + + def title = "ready to start ricing?" + + def form_fields + [ :first_name, :last_name, :primary_email, :birthday, :country ] + end + + def slack_user_type = :multi_channel_guest + + def slack_channels = chans(:riceathon, :announcements, :welcome_to_hack_club, :identity_help) + + def promotion_channels = chans(:riceathon, :announcements, :welcome_to_hack_club, :identity_help) + + def next_action = :slack + + def use_dm_channel? = false + + def promote_on_verification = true + + def logo_path = "images/riceathon/RiceathonGlow.png" + + def card_attributes = { wide_logo: true } + end +end diff --git a/config/slack_channels.yml b/config/slack_channels.yml index 9ac79db..84c3ed8 100644 --- a/config/slack_channels.yml +++ b/config/slack_channels.yml @@ -49,3 +49,4 @@ shared: hack_club_the_game: C088DT8P7B8 hctg_bulletin: C0A7HQZFFNX hctg_help: C0A9XULS1SL + riceathon: C07MLF9A8H5