gitea/services/convert
Lunny Xiao 6d0b24064a
Keeping consistent between UI and API about combined commit status state and fix some bugs (#34562)
Extract from #34531 

## Move Commit status state to a standalone package

Move the state from `structs` to `commitstatus` package. It also
introduce `CommitStatusStates` so that the combine function could be
used from UI and API logic.

## Combined commit status Changed

This PR will follow Github's combined commit status. Before this PR,
every commit status could be a combined one.
According to
https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#get-the-combined-status-for-a-specific-reference
> Additionally, a combined state is returned. The state is one of:
> failure if any of the contexts report as error or failure
> pending if there are no statuses or a context is pending
> success if the latest status for all contexts is success

This PR will follow that rule and remove the `NoBetterThan` logic. This
also fixes the inconsistent between UI and API. In the API convert
package, it has implemented this which is different from the UI. It also
fixed the missing `URL` and `CommitURL` in the API.

## `CalcCommitStatus` return nil if there is no commit statuses

The behavior of `CalcCommitStatus` is changed. If the parameter commit
statuses is empty, it will return nil. The reference places should check
the returned value themselves.
2025-06-09 04:05:33 +00:00
..
activity.go
attachment.go
convert.go feat: return time of last usage for public keys and access tokens in the api (#34323) 2025-05-01 21:42:17 +03:00
git_commit_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
git_commit.go Decouple diff stats query from actual diffing (#33810) 2025-03-08 17:36:08 +08:00
issue_comment.go Make tracked time representation display as hours (#33315) 2025-01-19 09:30:44 +08:00
issue_test.go
issue.go Move issue pin to an standalone table for querying performance (#33452) 2025-02-17 11:28:37 -08:00
main_test.go
mirror.go
notification.go
package.go
pull_review_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
pull_review.go
pull_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
pull.go Cache GPG keys, emails and users when list commits (#34086) 2025-04-09 16:34:38 +00:00
release_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
release.go
repository.go Export repo's manual merge settings (#34502) 2025-05-19 13:08:00 -04:00
secret.go
status.go Keeping consistent between UI and API about combined commit status state and fix some bugs (#34562) 2025-06-09 04:05:33 +00:00
user_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
user.go
utils_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
utils.go Fix typo in gitea downloader test and add missing codebase in ToGitServiceType (#33146) 2025-01-08 18:34:53 +00:00
wiki.go