Add AI expires
value to local storage.
#391
Merged
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.
What does this do?
This work extends the
ai
Local Storage key to be stringified JSON object with values of:enabled
expires
On toggle (if signed in) of Use Generative AI, the
expires
value will be set as the current time + 60 minutes. On each hard refresh of site this expires value is checked against the current time. If current time is greater than that of the storedexpires
value, the local storage will be reset andenabled
will befalse
. Thisfalse
value will make it so that the Sign In dialog is not spammed.Additionally, a small accessibility issue was addressed on the Sign In dialog due to a missing title.
How should we review?
ai
key has a value of{"enabled":"false"}
ai
key has a value of{"enabled":"true","expires":1733422722163}
where expires is the number set for one hour from the moment of toggleNow test toggling again...
Now to sign out to mimic the NetID logout/expiration that occurs every so often
{"enabled":"true","expires":1733422722163}
But now, let's fake it as if we had left for the day and come back the next morning.
ai
key value to be what you had copied earlier{"enabled":"true","expires":1033422722163}
ai
value should fully reset to be{"enabled":"false"}
and the dialog should not showAnd yeah, that's it. 🎉