Scenario: I'm using an anonymous converse.js instance with an auto-join room.
When I open the converse page, it greets me with "Please choose your nickname".
Then I enter a nickname, that is already used in the room and press "Enter groupchat"
The screen flickers for a second, and I'm back at "Please choose your nickname".
There is nothing in the JS debug console.
Expected result: Converse.js showing me an approrpiate error message.
Do you have any idea why joining the MUC failed? e.g. server logs or anything?
Yes, there is already a user in that room with that nickname.
The error stanza should look like this example in XEP-0045 7.2.8 Nickname Conflict.
@bernard-ng Looks like there already is a test for this use-case: https://github.com/conversejs/converse.js/blob/5341a1ea498dd870a29235bc05a2915d4e77a6c8/spec/muc.js#L4170
The test however doesn't check that an error message is displayed to the user, to inform them that the nickname is already taken.
You can therefore update the test and the code accordingly.
@bernard-ng: Here's an example of a test that checks that an error message displays in the nickname, you can probably learn/copy from that in order to test this bug:
https://github.com/conversejs/converse.js/blob/5341a1ea498dd870a29235bc05a2915d4e77a6c8/spec/muc.js#L4040
@jcbrand I think I'm stuck now, I can't return the validation error to the user, should I send a "DisconnectionMessage" instead?
I noticed that all the errors are in this object, for the nickname conflict, it's error 409, should I add it too?
by analyzing the code that is responsible for displaying the password field
I realize that the validation error is passed to the form and is displayed in the following template
but it's not the same logic for the nickname field
I noticed that the validation error was not displayed in the template.
so i added, however i still can't send the error to the template. do you have an idea ?
@bernard-ng: Without seeing your code, it's difficult to give feedback. Please make a PR with what you have already.
Sounds to me like you're on the right track and that you have almost fixed the problem!