forgejo/models
yp05327 7a687caca4
Fix wrong commit status in web ui (#26121)
Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/8c5643b5-5c16-4674-9fe6-9e7fa2dda0b9)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/caf8891b-14df-418d-a7eb-977b54b9e9be)

There's a bug in the recent logic, `CalcCommitStatus` will always return
the first item of `statuses` or error status, because `state` is defined
with default value which should be `CommitStatusSuccess`

Then
``` golang
if status.State.NoBetterThan(state) {
```
this `if` will always return false unless `status.State =
CommitStatusError` which makes no sense.
So `lastStatus` will always be `nil` or error status.
Then we will always return the first item of `statuses` here or only
return error status, and this is why in the first picture the commit
status is `Success` but not `Failure`.

af1ffbcd63/models/git/commit_status.go (L204-L211)

Co-authored-by: Giteabot <teabot@gitea.io>
2023-07-25 12:46:02 +00:00
..
actions Fix wrong workflow status when rerun a job in an already finished workflow (#26119) 2023-07-25 09:13:36 +00:00
activities Add context parameter to some database functions (#26055) 2023-07-22 22:14:27 +08:00
admin Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
asymkey Update tool dependencies, lock govulncheck and actionlint (#25655) 2023-07-09 11:58:06 +00:00
auth Upgrade go dependencies (#25819) 2023-07-14 11:00:31 +08:00
avatars
db Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
dbfs Fix content holes in Actions task logs file (#25560) 2023-06-28 19:07:29 +02:00
fixtures Fix incorrect oldest sort in project list (#25806) 2023-07-11 20:47:50 +02:00
git Fix wrong commit status in web ui (#26121) 2023-07-25 12:46:02 +00:00
issues Add context parameter to some database functions (#26055) 2023-07-22 22:14:27 +08:00
migrations Implement auto-cancellation of concurrent jobs if the event is push (#25716) 2023-07-25 11:15:55 +08:00
organization Remove unused code (#25734) 2023-07-06 21:52:41 +00:00
packages Test if container blob is accessible before mounting (#22759) 2023-07-09 11:24:43 +00:00
perm some less naked returns (#25682) 2023-07-04 15:52:33 +00:00
project Fix incorrect oldest sort in project list (#25806) 2023-07-11 20:47:50 +02:00
pull
repo For API attachments, use API URL (#25639) 2023-07-10 09:31:19 +00:00
secret Support configuration variables on Gitea Actions (#24724) 2023-06-20 22:54:15 +00:00
shared/types
system Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
unit Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
unittest Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
user Fix inconsistent user profile layout across tabs (#25625) 2023-07-06 18:59:24 +00:00
webhook Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
error.go Sync branches into databases (#22743) 2023-06-29 10:03:20 +00:00
fixture_generation.go
fixture_test.go
main_test.go
migrate.go Add context parameter to some database functions (#26055) 2023-07-22 22:14:27 +08:00
migrate_test.go Add context parameter to some database functions (#26055) 2023-07-22 22:14:27 +08:00
org.go
org_team.go
org_team_test.go
org_test.go
repo.go Update tool dependencies, lock govulncheck and actionlint (#25655) 2023-07-09 11:58:06 +00:00
repo_collaboration.go
repo_collaboration_test.go
repo_test.go
repo_transfer.go
repo_transfer_test.go