Fix error on log-in from old users requiring ToS interstitial when said ToS has been removed (#35233)

This commit is contained in:
Claire 2025-07-01 19:43:59 +02:00 committed by GitHub
parent a203a05eb1
commit 68b05e994f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,13 @@ module WebAppControllerConcern
return unless current_user&.require_tos_interstitial?
@terms_of_service = TermsOfService.published.first
# Handle case where terms of service have been removed from the database
if @terms_of_service.nil?
current_user.update(require_tos_interstitial: false)
return
end
render 'terms_of_service_interstitial/show', layout: 'auth'
end