File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,12 +12,16 @@ def verify(token: nil)
1212 School . transaction do
1313 school . verify!
1414
15- creator_id = school . creator_id
16- Role . owner . find_or_create_by! ( user_id : creator_id , school :)
17- Role . teacher . find_or_create_by! ( user_id : creator_id , school :)
18-
19- # TODO: Remove this line, once the feature flag is retired
20- success = FeatureFlags . immediate_school_onboarding? || SchoolOnboardingService . new ( school ) . onboard ( token : token )
15+ if FeatureFlags . immediate_school_onboarding?
16+ # For backwards compatibility with pre-Immediate Onboarding unverified schools, we need to create the roles
17+ # if they don't exist - this didn't happen at the time the school was created.
18+ creator_id = school . creator_id
19+ Role . owner . find_or_create_by! ( user_id : creator_id , school :)
20+ Role . teacher . find_or_create_by! ( user_id : creator_id , school :)
21+ success = true
22+ else
23+ success = SchoolOnboardingService . new ( school ) . onboard ( token : token )
24+ end
2125
2226 # TODO: Remove this line, once the feature flag is retired
2327 raise ActiveRecord ::Rollback unless success
You can’t perform that action at this time.
0 commit comments