0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-02-03 08:35:30 +01:00
gitea/routers/api/v1
Infinoid 86ee5b4b1b
PATCH branch-protection updates check list even when checks are disabled (#26351)
Fixes: #26333.

Previously, this endpoint only updates the `StatusCheckContexts` field
when `EnableStatusCheck==true`, which makes it impossible to clear the
array otherwise.

This patch uses slice `nil`-ness to decide whether to update the list of
checks. The field is ignored when either the client explicitly passes in
a null, or just omits the field from the json ([which causes
`json.Unmarshal` to leave the struct field
unchanged](https://go.dev/play/p/Z2XHOILuB1Q)). I think this is a better
measure of intent than whether the `EnableStatusCheck` flag was set,
because it matches the semantics of other field types.

Also adds a test case. I noticed that [`testAPIEditBranchProtection`
only checks the branch
name](c1c83dbaec/tests/integration/api_branch_test.go (L68))
and no other fields, so I added some extra `GET` calls and specific
checks to make sure the fields are changing properly.

I added those checks the existing integration test; is that the right
place for it?
2023-08-24 05:36:04 +00:00
..
activitypub Update tool dependencies, lock govulncheck and actionlint (#25655) 2023-07-09 11:58:06 +00:00
admin fix Missing 404 swagger response docs for /admin/users/{username} (#26086) 2023-07-24 10:48:44 +02:00
misc
notify
org feat(API): update and delete secret for managing organization secrets (#26660) 2023-08-24 02:07:00 +00:00
packages
repo PATCH branch-protection updates check list even when checks are disabled (#26351) 2023-08-24 05:36:04 +00:00
settings
swagger feat(API): update and delete secret for managing organization secrets (#26660) 2023-08-24 02:07:00 +00:00
user Remove db.DefaultContext in routers/ and cmd/ (#26076) 2023-07-23 23:47:27 -04:00
utils
api.go feat(API): update and delete secret for managing organization secrets (#26660) 2023-08-24 02:07:00 +00:00
auth_windows.go
auth.go