Commits

Nicolás Echániz committed 00aac99

fixed rename for existing user

  • Participants
  • Parent commits f9a2f2c

Comments (0)

Files changed (1)

                 new_name = body['message']['payload']
                 invalid_name = channel.participants.filter(name=new_name).exists()
                 if not invalid_name:
-                    invalid_name = User.objects.filter(username=new_name).exists()
+                    existing_user = User.objects.filter(username=new_name)
+                    if existing_user:
+                        invalid_name = not user == existing_user[0]
                 if invalid_name:
                     ## the name is invalid, so we change the action to 'failed_rename
                     ## which will inform about the invalid change and reset the nickname