Fix last admin check when syncing users (#34649)
Some checks are pending
release-nightly / nightly-docker-rootful (push) Waiting to run
release-nightly / nightly-docker-rootless (push) Waiting to run
release-nightly / nightly-binary (push) Waiting to run
cron-translations / crowdin-pull (push) Has been skipped

Fix #34358
This commit is contained in:
wxiaoguang
2025-06-10 04:57:45 +08:00
committed by GitHub
parent 92e7e98c56
commit 0082cb51fa
8 changed files with 49 additions and 20 deletions

View File

@ -613,7 +613,7 @@ func handleUserCreated(ctx *context.Context, u *user_model.User, gothUser *goth.
if user_model.CountUsers(ctx, nil) == 1 {
opts := &user_service.UpdateOptions{
IsActive: optional.Some(true),
IsAdmin: optional.Some(true),
IsAdmin: user_service.UpdateOptionFieldFromValue(true),
SetLastLogin: true,
}
if err := user_service.UpdateUser(ctx, u, opts); err != nil {