Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit 11c860c

Browse files
HoffmannPappleboy
authored andcommitted
fix: Add secret to all webhook's payload where it has been missing (#126)
affects webhooks for: * Delete * Fork * IssueComment * Release Resolves: go-gitea/gitea#4732, go-gitea/gitea#5173 Signed-off-by: Berengar W. Lehr <[email protected]>
1 parent 2d00f9f commit 11c860c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

gitea/hook.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ type CreatePayload struct {
199199
Sender *User `json:"sender"`
200200
}
201201

202-
// SetSecret FIXME
202+
// SetSecret modifies the secret of the CreatePayload
203203
func (p *CreatePayload) SetSecret(secret string) {
204204
p.Secret = secret
205205
}
@@ -246,15 +246,17 @@ const (
246246

247247
// DeletePayload represents delete payload
248248
type DeletePayload struct {
249+
Secret string `json:"secret"`
249250
Ref string `json:"ref"`
250251
RefType string `json:"ref_type"`
251252
PusherType PusherType `json:"pusher_type"`
252253
Repo *Repository `json:"repository"`
253254
Sender *User `json:"sender"`
254255
}
255256

256-
// SetSecret implements Payload
257+
// SetSecret modifies the secret of the DeletePayload
257258
func (p *DeletePayload) SetSecret(secret string) {
259+
p.Secret = secret
258260
}
259261

260262
// JSONPayload implements Payload
@@ -271,13 +273,15 @@ func (p *DeletePayload) JSONPayload() ([]byte, error) {
271273

272274
// ForkPayload represents fork payload
273275
type ForkPayload struct {
276+
Secret string `json:"secret"`
274277
Forkee *Repository `json:"forkee"`
275278
Repo *Repository `json:"repository"`
276279
Sender *User `json:"sender"`
277280
}
278281

279-
// SetSecret implements Payload
282+
// SetSecret modifies the secret of the ForkPayload
280283
func (p *ForkPayload) SetSecret(secret string) {
284+
p.Secret = secret
281285
}
282286

283287
// JSONPayload implements Payload
@@ -297,6 +301,7 @@ const (
297301

298302
// IssueCommentPayload represents a payload information of issue comment event.
299303
type IssueCommentPayload struct {
304+
Secret string `json:"secret"`
300305
Action HookIssueCommentAction `json:"action"`
301306
Issue *Issue `json:"issue"`
302307
Comment *Comment `json:"comment"`
@@ -305,8 +310,9 @@ type IssueCommentPayload struct {
305310
Sender *User `json:"sender"`
306311
}
307312

308-
// SetSecret implements Payload
313+
// SetSecret modifies the secret of the IssueCommentPayload
309314
func (p *IssueCommentPayload) SetSecret(secret string) {
315+
p.Secret = secret
310316
}
311317

312318
// JSONPayload implements Payload
@@ -333,14 +339,16 @@ const (
333339

334340
// ReleasePayload represents a payload information of release event.
335341
type ReleasePayload struct {
342+
Secret string `json:"secret"`
336343
Action HookReleaseAction `json:"action"`
337344
Release *Release `json:"release"`
338345
Repository *Repository `json:"repository"`
339346
Sender *User `json:"sender"`
340347
}
341348

342-
// SetSecret implements Payload
349+
// SetSecret modifies the secret of the ReleasePayload
343350
func (p *ReleasePayload) SetSecret(secret string) {
351+
p.Secret = secret
344352
}
345353

346354
// JSONPayload implements Payload
@@ -368,7 +376,7 @@ type PushPayload struct {
368376
Sender *User `json:"sender"`
369377
}
370378

371-
// SetSecret FIXME
379+
// SetSecret modifies the secret of the PushPayload
372380
func (p *PushPayload) SetSecret(secret string) {
373381
p.Secret = secret
374382
}
@@ -520,7 +528,7 @@ type RepositoryPayload struct {
520528
Sender *User `json:"sender"`
521529
}
522530

523-
// SetSecret set the payload's secret
531+
// SetSecret modifies the secret of the RepositoryPayload
524532
func (p *RepositoryPayload) SetSecret(secret string) {
525533
p.Secret = secret
526534
}

0 commit comments

Comments
 (0)