summaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-06-30 15:57:59 +0800
committerzeripath <art27@cantab.net>2019-06-30 08:57:59 +0100
commitff85dd3e12c05be98d9132de2e629523d096f712 (patch)
treec0b5d69eef2fd859204437bd8b206e06a7b8a47d /routers/api/v1
parent1e46eedce721e22e3e1e94eec6e0afccd36147c1 (diff)
downloadgitea-ff85dd3e12c05be98d9132de2e629523d096f712.tar.gz
gitea-ff85dd3e12c05be98d9132de2e629523d096f712.zip
Add commit statuses reports on pull request view (#6845)
* Add commit statuses reports on pull view * Add some translations * improve the UI * fix fmt * fix tests * add a new test git repo to fix tests * fix bug when headRepo or headBranch missing * fix tests * fix tests * fix consistency * fix tests * fix tests * change the test repo * fix tests * fix tests * fix migration * keep db size consistency * fix translation * change commit hash status table unique index * remove unused table * use char instead varchar * make hashCommitStatusContext private * split merge section with status check on pull view ui * fix tests; fix arc-green theme on pull ui
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/repo/status.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/routers/api/v1/repo/status.go b/routers/api/v1/repo/status.go
index 487e62c91d..1aa4f4e1a1 100644
--- a/routers/api/v1/repo/status.go
+++ b/routers/api/v1/repo/status.go
@@ -9,6 +9,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/repofiles"
api "code.gitea.io/gitea/modules/structs"
)
@@ -57,17 +58,12 @@ func NewCommitStatus(ctx *context.APIContext, form api.CreateStatusOption) {
Description: form.Description,
Context: form.Context,
}
- if err := models.NewCommitStatus(ctx.Repo.Repository, ctx.User, sha, status); err != nil {
- ctx.Error(500, "NewCommitStatus", err)
+ if err := repofiles.CreateCommitStatus(ctx.Repo.Repository, ctx.User, sha, status); err != nil {
+ ctx.Error(500, "CreateCommitStatus", err)
return
}
- newStatus, err := models.GetCommitStatus(ctx.Repo.Repository, sha, status)
- if err != nil {
- ctx.Error(500, "GetCommitStatus", err)
- return
- }
- ctx.JSON(201, newStatus.APIFormat())
+ ctx.JSON(201, status.APIFormat())
}
// GetCommitStatuses returns all statuses for any given commit hash
@@ -140,6 +136,7 @@ func getCommitStatuses(ctx *context.APIContext, sha string) {
statuses, err := models.GetCommitStatuses(repo, sha, page)
if err != nil {
ctx.Error(500, "GetCommitStatuses", fmt.Errorf("GetCommitStatuses[%s, %s, %d]: %v", repo.FullName(), sha, page, err))
+ return
}
apiStatuses := make([]*api.Status, 0, len(statuses))