mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
chore(models): rewrite code format. (#14754)
* chore: rewrite format. * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: Adjacent parameters with the same type should be grouped together * chore: update format.
This commit is contained in:
@@ -1307,7 +1307,6 @@ func DeleteInactiveUsers(ctx context.Context, olderThan time.Duration) (err erro
|
||||
Find(&users); err != nil {
|
||||
return fmt.Errorf("get all inactive users: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
// FIXME: should only update authorized_keys file once after all deletions.
|
||||
for _, u := range users {
|
||||
@@ -1572,7 +1571,6 @@ type SearchUserOptions struct {
|
||||
|
||||
func (opts *SearchUserOptions) toConds() builder.Cond {
|
||||
var cond builder.Cond = builder.Eq{"type": opts.Type}
|
||||
|
||||
if len(opts.Keyword) > 0 {
|
||||
lowerKeyword := strings.ToLower(opts.Keyword)
|
||||
keywordCond := builder.Or(
|
||||
@@ -1601,7 +1599,8 @@ func (opts *SearchUserOptions) toConds() builder.Cond {
|
||||
} else {
|
||||
exprCond = builder.Expr("org_user.org_id = \"user\".id")
|
||||
}
|
||||
var accessCond = builder.NewCond()
|
||||
|
||||
var accessCond builder.Cond
|
||||
if !opts.Actor.IsRestricted {
|
||||
accessCond = builder.Or(
|
||||
builder.In("id", builder.Select("org_id").From("org_user").LeftJoin("`user`", exprCond).Where(builder.And(builder.Eq{"uid": opts.Actor.ID}, builder.Eq{"visibility": structs.VisibleTypePrivate}))),
|
||||
@@ -1847,7 +1846,7 @@ func SyncExternalUsers(ctx context.Context, updateExisting bool) error {
|
||||
log.Trace("Doing: SyncExternalUsers[%s]", s.Name)
|
||||
|
||||
var existingUsers []int64
|
||||
var isAttributeSSHPublicKeySet = len(strings.TrimSpace(s.LDAP().AttributeSSHPublicKey)) > 0
|
||||
isAttributeSSHPublicKeySet := len(strings.TrimSpace(s.LDAP().AttributeSSHPublicKey)) > 0
|
||||
var sshKeysNeedUpdate bool
|
||||
|
||||
// Find all users with this login type
|
||||
@@ -2021,9 +2020,9 @@ func SyncExternalUsers(ctx context.Context, updateExisting bool) error {
|
||||
// IterateUser iterate users
|
||||
func IterateUser(f func(user *User) error) error {
|
||||
var start int
|
||||
var batchSize = setting.Database.IterateBufferSize
|
||||
batchSize := setting.Database.IterateBufferSize
|
||||
for {
|
||||
var users = make([]*User, 0, batchSize)
|
||||
users := make([]*User, 0, batchSize)
|
||||
if err := x.Limit(batchSize, start).Find(&users); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user