1
1
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:
Bo-Yi Wu
2021-03-15 02:52:12 +08:00
committed by GitHub
parent 164e35ead3
commit 167b0f46ef
103 changed files with 474 additions and 460 deletions

View File

@@ -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
}