zooniverse / Panoptes-Front-End

Front end for zooniverse/Panoptes
https://www.zooniverse.org
Apache License 2.0
64 stars 76 forks source link

Improve Talk Error Messages - email verification and banned #7021

Closed lcjohnso closed 1 day ago

lcjohnso commented 8 months ago

Current behavior

If a user is banned or has an unverified email address (after email verification is deployed -- see https://github.com/zooniverse/talk-api/pull/311), the user is shown an error message when they try to post on Talk: not allowed to create this Comment

Expected / new behavior

Provide an informative error message that describes the reason why the user was unable to post a comment.

Note Regarding Existing Behavior for DMs:

Steps to replicate

Try to post using an account that is unverified or banned.

lcjohnso commented 7 months ago

Note: the following relevant fields are serialized out into the https://www.zooniverse.org/api/me response:

lcjohnso commented 7 months ago

Error from Talk (i.e., not allowed to create this Comment) could be caught in similar way to this case for the Lab's collaborator page: https://github.com/zooniverse/Panoptes-Front-End/blob/master/app/pages/lab/collaborators/CollaboratorCreator.jsx#L78-L83

shaunanoordin commented 3 weeks ago

Dev Notes

Here's a breakdown of everything I'm accounting for.

Possible causes for error states:

Possible avenues for error states:

NOTE: if a user is banned, they may not even get the opportunity to reach the possible avenues above, or see the "you are banned" message.

Known error messages/error responses:

Shaun TODO: note that when unverified, there are two possible 🟣 🟠 error responses. The 🟣 401s return a very generic "nuh-uh" so a helper function should check for user.confirmed_at.

For all avenues listed above, the affected component is <CommentBox> (link), at the onSubmitComment's .catch() (link)