Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle failure in guest registration #211

Closed
ashfame opened this issue Mar 24, 2023 · 9 comments · Fixed by #222
Closed

Handle failure in guest registration #211

ashfame opened this issue Mar 24, 2023 · 9 comments · Fixed by #222
Assignees
Labels
blocker bug Something isn't working

Comments

@ashfame
Copy link
Member

ashfame commented Mar 24, 2023

When a server doesn't have guest account registration enabled, it fails with this error.

Screenshot 2023-03-24 at 6 32 33 PM

It should show unknownRoomView with a login button

@ashfame ashfame changed the title Handle failure in guest registraion Handle failure in guest registration Mar 24, 2023
@psrpinto psrpinto added the bug Something isn't working label Apr 27, 2023
@psrpinto
Copy link
Member

psrpinto commented Jun 1, 2023

There's another error message than can be shown that is apparently also related to this:

null is not an object (evaluating 'this._session.isGuest')

Screenshot 2023-06-01 at 3 34 37 PM

@psrpinto
Copy link
Member

psrpinto commented Jun 1, 2023

I found another error message than seems to be related to this:

Something went wrong
Cannot read properties of null (reading 'isGuest')

Steps to reproduce:

  1. Logout of all chatrix sessions
  2. Go to the block editor and add a chatrix block
  3. Change room in block inspector to #meta:community.wordpress.org
  4. Error shows

@psrpinto
Copy link
Member

psrpinto commented Jun 1, 2023

I think this issue manifests itself differently according to whether the user has a session open or not, and also depends on if they have "previously-opened" sessions. That explains why there are different error messages.

I think we might need to rework how single-room mode is handled, specifically in what concerns the case where a previous session exists. In this code chosenSession is not defined, so that's surely part of the issue.

Here's all the use cases I could think of (can you think of any others?), and what I think the behaviour should be for each:

  • User has a session open
    -> Navigate to room view for configured roomIdOrAlias
  • User does not have a session open
    • User has exactly one previously-opened session
      -> Open said session
      -> Navigate to room view for configured roomIdOrAlias
    • User has many previously-opened sessions
      -> Navigate to session picker
      -> User selects a session
      -> Navigate to room view for configured roomIdOrAlias
    • User has no previously-opened sessions
      • Room is not world-readable, or homeserver has guest registration disabled
        -> Navigate to Login
      • Room is world-readable
        -> Do guest login
        -> Navigate to room view for configured roomIdOrAlias

I think we should rework the code to implement this ^, I would be happy to do so.

@akirk
Copy link
Member

akirk commented Jun 1, 2023

Great. Please proceed on working on this, it's a blocker as we experienced in today's meeting.

@ashfame
Copy link
Member Author

ashfame commented Jun 1, 2023

@psrpinto Can you elaborate on what you mean with "session open" here, as I don't understand this branching:

- User does not have a session open
    - User has exactly one previously-opened session

I would add another condition while doing guest login. When its a 403 (meaning guest registrations on server is disabled), we behave as if the room is not world-readable and navigate to login.

@psrpinto
Copy link
Member

psrpinto commented Jun 1, 2023

Good catch, I edited my comment to add the condition for when homeserver has guest registration disabled.

Can you elaborate on what you mean with "session open"

By "session open" I mean that the user went past the session picker and is "inside" a session, prior to loading chatrix in single-user mode. (The case where they have a single session is a special case of this, where the session picker isn't displayed, but from a code perspective it's the same, they are "inside" the session even if they don't see the session picker).

@psrpinto
Copy link
Member

psrpinto commented Jun 1, 2023

In addition, when I say "previously-opened", I mean they see the session picker with previously used sessions, but they aren't "inside" any session.

@ashfame
Copy link
Member Author

ashfame commented Jun 1, 2023

Gotcha, thanks for explaining! The complete branching makes sense now & I think that covers everything 👍

@ashfame
Copy link
Member Author

ashfame commented Jun 2, 2023

Related: #209

@psrpinto psrpinto self-assigned this Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants