Skip to content

Removing redundant error about existing username

Related to issue #201 (closed).

  • Added test to reproduce the error.
  • Added fix that needs to be reviewed (probably too simplistic).

I ran the tests and they are passing (rspec), but I don't fully understand the use of the function 'namespace_uniq'. It is being called as: validate :namespace_uniq, if: ->(user) { user.username_changed? }

So, this is supossed to verify if the namespace is unique when the username has been changed in the user object. What I did is that if the user is not already saved, then don't verify that. I suppose that may exist the case where an existing user has a namespace different than it's username, and then a new user should not conflict with that, but no test seemed to reproduce this case (or this is correctly tested already).

I'm not confident this is a final solution but at least shows were the problems seems to rely. If the solution needs to be changed the test is here.

Merge request reports