Skip to content

Commit c03908e

Browse files
committed
1069: Ensure we're rolling back based on the result of onboarding to mimic current behaviour
1 parent 233703f commit c03908e

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

app/services/school_verification_service.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,23 @@ def initialize(school)
88
end
99

1010
def verify(token: nil)
11+
success = false
1112
School.transaction do
1213
school.verify!
1314

14-
# TODO: Remove this line once the feature flag is retired
15-
SchoolOnboardingService.new(school).onboard(token: token) unless FeatureFlags.immediate_school_onboarding?
15+
# TODO: Remove this line, once the feature flag is retired
16+
success = FeatureFlags.immediate_school_onboarding? || SchoolOnboardingService.new(school).onboard(token: token)
17+
18+
# TODO: Remove this line, once the feature flag is retired
19+
raise ActiveRecord::Rollback unless success
1620
end
1721
rescue StandardError => e
1822
Sentry.capture_exception(e)
1923
Rails.logger.error { "Failed to verify school #{@school.id}: #{e.message}" }
2024
false
2125
else
22-
true
26+
# TODO: Return 'true', once the feature flag is retired
27+
success
2328
end
2429

2530
delegate :reject, to: :school

0 commit comments

Comments
 (0)