aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/status.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-10-17 06:23:08 +0200
committerGitHub <noreply@github.com>2020-10-17 00:23:08 -0400
commitd453533beb197d25b25530dc5f0e3c3c0742d8d1 (patch)
tree6d66e1163333344d91af63e9ab50a82367470b8f /routers/api/v1/repo/status.go
parent131278ff222f1a8580f20e6bbdff405341403042 (diff)
downloadgitea-d453533beb197d25b25530dc5f0e3c3c0742d8d1.tar.gz
gitea-d453533beb197d25b25530dc5f0e3c3c0742d8d1.zip
[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>
Diffstat (limited to 'routers/api/v1/repo/status.go')
-rw-r--r--routers/api/v1/repo/status.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/routers/api/v1/repo/status.go b/routers/api/v1/repo/status.go
index 69661dca91..e7318edaa5 100644
--- a/routers/api/v1/repo/status.go
+++ b/routers/api/v1/repo/status.go
@@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/repofiles"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/routers/api/v1/utils"
@@ -64,7 +65,7 @@ func NewCommitStatus(ctx *context.APIContext, form api.CreateStatusOption) {
return
}
- ctx.JSON(http.StatusCreated, status.APIFormat())
+ ctx.JSON(http.StatusCreated, convert.ToCommitStatus(status))
}
// GetCommitStatuses returns all statuses for any given commit hash
@@ -222,7 +223,7 @@ func getCommitStatuses(ctx *context.APIContext, sha string) {
apiStatuses := make([]*api.Status, 0, len(statuses))
for _, status := range statuses {
- apiStatuses = append(apiStatuses, status.APIFormat())
+ apiStatuses = append(apiStatuses, convert.ToCommitStatus(status))
}
ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
@@ -305,7 +306,7 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
retStatus.Statuses = make([]*api.Status, 0, len(statuses))
for _, status := range statuses {
- retStatus.Statuses = append(retStatus.Statuses, status.APIFormat())
+ retStatus.Statuses = append(retStatus.Statuses, convert.ToCommitStatus(status))
if status.State.NoBetterThan(retStatus.State) {
retStatus.State = status.State
}