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:
Gergely Nagy 2024-04-17 01:25:20 +02:00
parent 787bc6ed94
commit d07c8c821c
No known key found for this signature in database
5 changed files with 56 additions and 33 deletions

View file

@ -30,10 +30,8 @@ type CreateUserOption struct {
// EditUserOption edit user options
type EditUserOption struct {
// required: true
SourceID int64 `json:"source_id"`
// required: true
LoginName string `json:"login_name" binding:"Required"`
SourceID *int64 `json:"source_id"`
LoginName *string `json:"login_name"`
// swagger:strfmt email
Email *string `json:"email" binding:"MaxSize(254)"`
FullName *string `json:"full_name" binding:"MaxSize(100)"`