forked from forgejo/forgejo
Do not require login_name & source_id for /admin/user/{username}
When editing a user via the API, do not require setting `login_name` or `source_id`: for local accounts, these do not matter. However, when editing a non-local account, require *both*, as before. Fixes #1861. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
parent
787bc6ed94
commit
d07c8c821c
5 changed files with 56 additions and 33 deletions
|
@ -495,9 +495,7 @@ func TestUserPronouns(t *testing.T) {
|
|||
// Set the pronouns for user2
|
||||
pronouns := "she/her"
|
||||
req := NewRequestWithJSON(t, "PATCH", "/api/v1/admin/users/user2", &api.EditUserOption{
|
||||
LoginName: "user2",
|
||||
SourceID: 0,
|
||||
Pronouns: &pronouns,
|
||||
Pronouns: &pronouns,
|
||||
}).AddTokenAuth(adminToken)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
|
@ -596,9 +594,7 @@ func TestUserPronouns(t *testing.T) {
|
|||
// Set the pronouns to Unspecified (an empty string) via the API
|
||||
pronouns := ""
|
||||
req := NewRequestWithJSON(t, "PATCH", "/api/v1/admin/users/user2", &api.EditUserOption{
|
||||
LoginName: "user2",
|
||||
SourceID: 0,
|
||||
Pronouns: &pronouns,
|
||||
Pronouns: &pronouns,
|
||||
}).AddTokenAuth(adminToken)
|
||||
MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue