mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-19 15:14:40 +09:00
fix(api): keep webhook settings that are omitted in an edit request (#40282)
`PATCH .../hooks/{id}` previously reset webhook events to push-only and
cleared the branch filter and authorization header whenever they were
not included in the payload. Disabling a hook with `{"active": false}`
silently destroyed its configuration.
`BranchFilter` and `AuthorizationHeader` are now pointers so omitted
fields remain untouched, while empty strings can still be passed to
clear them explicitly.
---------
Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
1 parent
d5ce1cad7f
commit
db23b5a192
5 files changed
+75
-22
No files matched your search
@@ -120,12 +120,12 @@ type CreateHookOption struct {
|
||||
type EditHookOption struct {
|
||||
// Configuration settings for the webhook
|
||||
Config map[string]string `json:"config"`
|
||||
// List of events that trigger this webhook
|
||||
// List of events that trigger this webhook, omitted or empty keeps the current events
|
||||
Events []string `json:"events"`
|
||||
// Branch filter pattern to determine which branches trigger the webhook
|
||||
BranchFilter string `json:"branch_filter" binding:"GlobPattern"`
|
||||
// Authorization header to include in webhook requests
|
||||
AuthorizationHeader string `json:"authorization_header"`
|
||||
// Branch filter pattern to determine which branches trigger the webhook, omitted keeps the current value
|
||||
BranchFilter *string `json:"branch_filter" binding:"GlobPattern"`
|
||||
// Authorization header to include in webhook requests, omitted keeps the current value unless the url changes
|
||||
AuthorizationHeader *string `json:"authorization_header"`
|
||||
// Whether the webhook is active and will be triggered
|
||||
Active *bool `json:"active"`
|
||||
// Optional human-readable name
|
||||
|
||||
Reference in new issue
Block a user