codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
397 stars 68 forks source link

Receive notifications, then get signed out: resulting behavior is confusing #1405

Open cellio opened 2 months ago

cellio commented 2 months ago

meta:291589

If you have unread notifications and then get signed out behind the scenes (this sometimes happens), the page does not refresh, so you'll still see the notification widget. If you click on it in this state, you get a blank notifications pane. Are we able to detect this and prompt you to log back in? I realize that most of the activity here is client-side and the client doesn't know you've been logged out, but maybe if the notifications come back empty, we could do an extra server call to find out if you're still logged in? Alternatively, if being logged out somehow pushed a client refresh (so you'd see the "sign in" button instead of your avatar), that would accomplish the same thing. I'm not sure what's practical here.

trichoplax commented 2 months ago

It appears that every time you open the notifications panel, a request is made to get the latest notifications. If you are signed in, this comes back as a 200 (success), whereas if you are signed out, this comes back as a 401 (unauthorised), so even without an extra server call the notifications panel has the information it needs to display a sign in link when appropriate.