aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-22 11:46:04 +0800
committerGitHub <noreply@github.com>2020-01-22 11:46:04 +0800
commit81daf26878d8a7e14c172fc39fc55c36281b1898 (patch)
tree9d4d43bf2e12cdc9c56196938d0618e9577cd1b6 /routers/api
parentcca13ae2acf1ef7a3b0516a8774dff0365b73697 (diff)
downloadgitea-81daf26878d8a7e14c172fc39fc55c36281b1898.tar.gz
gitea-81daf26878d8a7e14c172fc39fc55c36281b1898.zip
Fix wrong hint when status checking is running on pull request view (#9886)
* Fix wrong hint when status checking is running on pull request view * fix lint * fix test * fix test * fix wrong tmpl * fix import * rename function name
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/status.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/api/v1/repo/status.go b/routers/api/v1/repo/status.go
index c137b64f5c..b6b3d495ca 100644
--- a/routers/api/v1/repo/status.go
+++ b/routers/api/v1/repo/status.go
@@ -53,7 +53,7 @@ func NewCommitStatus(ctx *context.APIContext, form api.CreateStatusOption) {
return
}
status := &models.CommitStatus{
- State: models.CommitStatusState(form.State),
+ State: api.CommitStatusState(form.State),
TargetURL: form.TargetURL,
Description: form.Description,
Context: form.Context,
@@ -220,13 +220,13 @@ func getCommitStatuses(ctx *context.APIContext, sha string) {
}
type combinedCommitStatus struct {
- State models.CommitStatusState `json:"state"`
- SHA string `json:"sha"`
- TotalCount int `json:"total_count"`
- Statuses []*api.Status `json:"statuses"`
- Repo *api.Repository `json:"repository"`
- CommitURL string `json:"commit_url"`
- URL string `json:"url"`
+ State api.CommitStatusState `json:"state"`
+ SHA string `json:"sha"`
+ TotalCount int `json:"total_count"`
+ Statuses []*api.Status `json:"statuses"`
+ Repo *api.Repository `json:"repository"`
+ CommitURL string `json:"commit_url"`
+ URL string `json:"url"`
}
// GetCombinedCommitStatusByRef returns the combined status for any given commit hash
@@ -293,7 +293,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())
- if status.State.IsWorseThan(retStatus.State) {
+ if status.State.NoBetterThan(retStatus.State) {
retStatus.State = status.State
}
}