1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

[Refactor] Move APIFormat functions into convert package (#12856)

* USER APIFormat -> ToUser

* Migrate more and mark APIFormat deprecated

* models.Comment APIFormat() -> convert.ToComment

* models.Release APIFormat() -> convert.ToRelease

* models.Attachments APIFormat() -> convert.ToReleaseAttachments

* models.CommitStatus APIFormat() -> convert.ToCommitStatus

* finish migration to convert.ToUser

* Move Test

* Imprufe Test

* fix test

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
6543
2020-10-17 06:23:08 +02:00
committed by GitHub
parent 131278ff22
commit d453533beb
28 changed files with 234 additions and 208 deletions

View File

@@ -8,7 +8,6 @@ import (
"fmt"
"code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs"
)
//UserList is a list of user.
@@ -94,12 +93,3 @@ func (users UserList) loadTwoFactorStatus(e Engine) (map[int64]*TwoFactor, error
}
return tokenMaps, nil
}
//APIFormat return list of users in api format
func (users UserList) APIFormat() []*api.User {
result := make([]*api.User, 0, len(users))
for _, u := range users {
result = append(result, u.APIFormat())
}
return result
}