graphqlbackend: allow non-admin users to update other metadata when site config prohibits username changes
Created by: flying-robot
Non-admin users are currently prevented from updating their display name and avatar URL if the site configuration prohibits username changes. There are a number of additional factors in play:
- The UI will always include
username
in the mutation payload. - That triggers the
viewerCanChangeUsername
check, sinceargs.Username
is not null. -
viewerCanChangeUsername
falls through to the final site admin check, and the request fails.
Here is the intended design, as I understand it:
The test was written first to demonstrate a failing case, and then viewerIsChangingUsername
was introduced to short circuit if appropriate.
fixes https://github.com/sourcegraph/sourcegraph/issues/15663