Handle unauthorized in toxicity screening
Displays the same Alert you see when you try to submit a chat when unauthorized (ie, signed out, etc.) for users trying to save model customizations while unauthorized. Prior to adding toxicity screening on save of model customizations, users were able to save their model customizations while signed out. Since adding the screening, the "Update" button just spins if you tried to update a model customization while signed out.
I moved some things around to share code between our handling of errors when submitting chat message and errors seen from the toxicity screening that happens when you try to save customizations.
I streamlined the analytics reporting for the unauthorized event for submitting an AI customization or submitting a chat -- I figured that the type of unauthorized interaction isn't super important, more that there are unauthorized interactions happening.
Links
Testing story
Tested manually that:
- as an unauthorized student user, if I:
- Update a model customization -> see nice message telling me I need to sign in with link to Zendesk docs, event logged to Amplitude
- Update a model customization with localhost blocked (ie, unhandled excepction) -> error logged to cloudwatch, generic error message displayed
- Try to get a chat response -> see nice message telling me I need to sign in with link to Zendesk docs, event logged to Amplitude
- as an authorized teacher user, if I:
- Update model customization -> success
- Try to get a chat response -> success