uranusjr commented on a change in pull request #18757:
URL: https://github.com/apache/airflow/pull/18757#discussion_r723113723



##########
File path: airflow/api_connexion/endpoints/user_endpoint.py
##########
@@ -124,9 +124,21 @@ def patch_user(username, update_mask=None):
     if user is None:
         detail = f"The User with username `{username}` was not found"
         raise NotFound(title="User not found", detail=detail)
-
-    # Get fields to update. 'username' is always excluded (and it's an error to
-    # include it in update_maek).
+    # Check unique username
+    new_username = data.get('username')
+    if new_username:

Review comment:
       Maybe?
   
   ```suggestion
       if new_username is not None and new_username != user.username:
   ```
   
   This saves the `find_user` call (which incurs a round-trip to the backend) 
if the username is supplied but not changing. Same for the email logic.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to