Check Terms of Service Version Through Users Table Instead of Cookie #44497
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The terms of service dialog that appears to Users logging in for the first time from Clever or Powerschool currently looks at a cookie, which is how it was before we revamped the dialog to exclude the out-of-date terms of service. This means that if the user logs in from a different device or clears their cookies, they’ll see the dialog again, which is not desired behavior.
Since we already track terms_of_service_version (i.e. the most recent ToS version the user has accepted) in the User model, now the behavior is to just check whether the terms_of_service_version matches the most recent ToS version. If they don't match, show them the new ToS for them to accept, otherwise don't show it to them.
Links
Jira ticket: here
PR for revamped dialog avoiding out-of-date ToS: here
Testing story
Localhost testing through Clever test accounts to ensure that upon their first logins users see the ToS dialog but don't see it on subsequent ones (even if they clear their cookies or log in elsewhere). I specifically tested this by logging in in an incognito window and then closing it, then opening a new incognito window and repeating the process to check for the correct behavior.
Demo using the incognito windows: here
PR Checklist: