mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-21 22:08:37 -04: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:
parent
131278ff22
commit
d453533beb
28 changed files with 234 additions and 208 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/routers/api/v1/utils"
|
||||
)
|
||||
|
@ -276,6 +277,10 @@ func GetIssueSubscribers(ctx *context.APIContext) {
|
|||
ctx.Error(http.StatusInternalServerError, "GetUsersByIDs", err)
|
||||
return
|
||||
}
|
||||
apiUsers := make([]*api.User, 0, len(users))
|
||||
for i := range users {
|
||||
apiUsers[i] = convert.ToUser(users[i], ctx.IsSigned, false)
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, users.APIFormat())
|
||||
ctx.JSON(http.StatusOK, apiUsers)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue