@@ -59,7 +59,7 @@ func (m *webhookNotifier) IssueClearLabels(ctx context.Context, doer *user_model
59
59
err = PrepareWebhooks (ctx , EventSource {Repository : issue .Repo }, webhook_module .HookEventPullRequestLabel , & api.PullRequestPayload {
60
60
Action : api .HookIssueLabelCleared ,
61
61
Index : issue .Index ,
62
- PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , nil ),
62
+ PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , doer ),
63
63
Repository : convert .ToRepo (ctx , issue .Repo , permission ),
64
64
Sender : convert .ToUser (ctx , doer , nil ),
65
65
})
@@ -150,7 +150,7 @@ func (m *webhookNotifier) IssueChangeAssignee(ctx context.Context, doer *user_mo
150
150
}
151
151
apiPullRequest := & api.PullRequestPayload {
152
152
Index : issue .Index ,
153
- PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , nil ),
153
+ PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , doer ),
154
154
Repository : convert .ToRepo (ctx , issue .Repo , permission ),
155
155
Sender : convert .ToUser (ctx , doer , nil ),
156
156
}
@@ -201,7 +201,7 @@ func (m *webhookNotifier) IssueChangeTitle(ctx context.Context, doer *user_model
201
201
From : oldTitle ,
202
202
},
203
203
},
204
- PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , nil ),
204
+ PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , doer ),
205
205
Repository : convert .ToRepo (ctx , issue .Repo , permission ),
206
206
Sender : convert .ToUser (ctx , doer , nil ),
207
207
})
@@ -236,7 +236,7 @@ func (m *webhookNotifier) IssueChangeStatus(ctx context.Context, doer *user_mode
236
236
// Merge pull request calls issue.changeStatus so we need to handle separately.
237
237
apiPullRequest := & api.PullRequestPayload {
238
238
Index : issue .Index ,
239
- PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , nil ),
239
+ PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , doer ),
240
240
Repository : convert .ToRepo (ctx , issue .Repo , permission ),
241
241
Sender : convert .ToUser (ctx , doer , nil ),
242
242
CommitID : commitID ,
@@ -307,7 +307,7 @@ func (m *webhookNotifier) NewPullRequest(ctx context.Context, pull *issues_model
307
307
if err := PrepareWebhooks (ctx , EventSource {Repository : pull .Issue .Repo }, webhook_module .HookEventPullRequest , & api.PullRequestPayload {
308
308
Action : api .HookIssueOpened ,
309
309
Index : pull .Issue .Index ,
310
- PullRequest : convert .ToAPIPullRequest (ctx , pull , nil ),
310
+ PullRequest : convert .ToAPIPullRequest (ctx , pull , pull . Issue . Poster ),
311
311
Repository : convert .ToRepo (ctx , pull .Issue .Repo , permission ),
312
312
Sender : convert .ToUser (ctx , pull .Issue .Poster , nil ),
313
313
}); err != nil {
@@ -336,7 +336,7 @@ func (m *webhookNotifier) IssueChangeContent(ctx context.Context, doer *user_mod
336
336
From : oldContent ,
337
337
},
338
338
},
339
- PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , nil ),
339
+ PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , doer ),
340
340
Repository : convert .ToRepo (ctx , issue .Repo , permission ),
341
341
Sender : convert .ToUser (ctx , doer , nil ),
342
342
})
@@ -375,17 +375,20 @@ func (m *webhookNotifier) UpdateComment(ctx context.Context, doer *user_model.Us
375
375
}
376
376
377
377
var eventType webhook_module.HookEventType
378
+ var pullRequest * api.PullRequest
378
379
if c .Issue .IsPull {
379
380
eventType = webhook_module .HookEventPullRequestComment
381
+ pullRequest = convert .ToAPIPullRequest (ctx , c .Issue .PullRequest , doer )
380
382
} else {
381
383
eventType = webhook_module .HookEventIssueComment
382
384
}
383
385
384
386
permission , _ := access_model .GetUserRepoPermission (ctx , c .Issue .Repo , doer )
385
387
if err := PrepareWebhooks (ctx , EventSource {Repository : c .Issue .Repo }, eventType , & api.IssueCommentPayload {
386
- Action : api .HookIssueCommentEdited ,
387
- Issue : convert .ToAPIIssue (ctx , doer , c .Issue ),
388
- Comment : convert .ToAPIComment (ctx , c .Issue .Repo , c ),
388
+ Action : api .HookIssueCommentEdited ,
389
+ Issue : convert .ToAPIIssue (ctx , doer , c .Issue ),
390
+ PullRequest : pullRequest ,
391
+ Comment : convert .ToAPIComment (ctx , c .Issue .Repo , c ),
389
392
Changes : & api.ChangesPayload {
390
393
Body : & api.ChangesFromPayload {
391
394
From : oldContent ,
@@ -403,20 +406,23 @@ func (m *webhookNotifier) CreateIssueComment(ctx context.Context, doer *user_mod
403
406
issue * issues_model.Issue , comment * issues_model.Comment , mentions []* user_model.User ,
404
407
) {
405
408
var eventType webhook_module.HookEventType
409
+ var pullRequest * api.PullRequest
406
410
if issue .IsPull {
407
411
eventType = webhook_module .HookEventPullRequestComment
412
+ pullRequest = convert .ToAPIPullRequest (ctx , issue .PullRequest , doer )
408
413
} else {
409
414
eventType = webhook_module .HookEventIssueComment
410
415
}
411
416
412
417
permission , _ := access_model .GetUserRepoPermission (ctx , repo , doer )
413
418
if err := PrepareWebhooks (ctx , EventSource {Repository : issue .Repo }, eventType , & api.IssueCommentPayload {
414
- Action : api .HookIssueCommentCreated ,
415
- Issue : convert .ToAPIIssue (ctx , doer , issue ),
416
- Comment : convert .ToAPIComment (ctx , repo , comment ),
417
- Repository : convert .ToRepo (ctx , repo , permission ),
418
- Sender : convert .ToUser (ctx , doer , nil ),
419
- IsPull : issue .IsPull ,
419
+ Action : api .HookIssueCommentCreated ,
420
+ Issue : convert .ToAPIIssue (ctx , doer , issue ),
421
+ PullRequest : pullRequest ,
422
+ Comment : convert .ToAPIComment (ctx , repo , comment ),
423
+ Repository : convert .ToRepo (ctx , repo , permission ),
424
+ Sender : convert .ToUser (ctx , doer , nil ),
425
+ IsPull : issue .IsPull ,
420
426
}); err != nil {
421
427
log .Error ("PrepareWebhooks [comment_id: %d]: %v" , comment .ID , err )
422
428
}
@@ -440,20 +446,23 @@ func (m *webhookNotifier) DeleteComment(ctx context.Context, doer *user_model.Us
440
446
}
441
447
442
448
var eventType webhook_module.HookEventType
449
+ var pullRequest * api.PullRequest
443
450
if comment .Issue .IsPull {
444
451
eventType = webhook_module .HookEventPullRequestComment
452
+ pullRequest = convert .ToAPIPullRequest (ctx , comment .Issue .PullRequest , doer )
445
453
} else {
446
454
eventType = webhook_module .HookEventIssueComment
447
455
}
448
456
449
457
permission , _ := access_model .GetUserRepoPermission (ctx , comment .Issue .Repo , doer )
450
458
if err := PrepareWebhooks (ctx , EventSource {Repository : comment .Issue .Repo }, eventType , & api.IssueCommentPayload {
451
- Action : api .HookIssueCommentDeleted ,
452
- Issue : convert .ToAPIIssue (ctx , doer , comment .Issue ),
453
- Comment : convert .ToAPIComment (ctx , comment .Issue .Repo , comment ),
454
- Repository : convert .ToRepo (ctx , comment .Issue .Repo , permission ),
455
- Sender : convert .ToUser (ctx , doer , nil ),
456
- IsPull : comment .Issue .IsPull ,
459
+ Action : api .HookIssueCommentDeleted ,
460
+ Issue : convert .ToAPIIssue (ctx , doer , comment .Issue ),
461
+ PullRequest : pullRequest ,
462
+ Comment : convert .ToAPIComment (ctx , comment .Issue .Repo , comment ),
463
+ Repository : convert .ToRepo (ctx , comment .Issue .Repo , permission ),
464
+ Sender : convert .ToUser (ctx , doer , nil ),
465
+ IsPull : comment .Issue .IsPull ,
457
466
}); err != nil {
458
467
log .Error ("PrepareWebhooks [comment_id: %d]: %v" , comment .ID , err )
459
468
}
@@ -525,7 +534,7 @@ func (m *webhookNotifier) IssueChangeLabels(ctx context.Context, doer *user_mode
525
534
err = PrepareWebhooks (ctx , EventSource {Repository : issue .Repo }, webhook_module .HookEventPullRequestLabel , & api.PullRequestPayload {
526
535
Action : api .HookIssueLabelUpdated ,
527
536
Index : issue .Index ,
528
- PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , nil ),
537
+ PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , doer ),
529
538
Repository : convert .ToRepo (ctx , issue .Repo , access_model.Permission {AccessMode : perm .AccessModeOwner }),
530
539
Sender : convert .ToUser (ctx , doer , nil ),
531
540
})
@@ -567,7 +576,7 @@ func (m *webhookNotifier) IssueChangeMilestone(ctx context.Context, doer *user_m
567
576
err = PrepareWebhooks (ctx , EventSource {Repository : issue .Repo }, webhook_module .HookEventPullRequestMilestone , & api.PullRequestPayload {
568
577
Action : hookAction ,
569
578
Index : issue .Index ,
570
- PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , nil ),
579
+ PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , doer ),
571
580
Repository : convert .ToRepo (ctx , issue .Repo , permission ),
572
581
Sender : convert .ToUser (ctx , doer , nil ),
573
582
})
@@ -640,7 +649,7 @@ func (*webhookNotifier) MergePullRequest(ctx context.Context, doer *user_model.U
640
649
// Merge pull request calls issue.changeStatus so we need to handle separately.
641
650
apiPullRequest := & api.PullRequestPayload {
642
651
Index : pr .Issue .Index ,
643
- PullRequest : convert .ToAPIPullRequest (ctx , pr , nil ),
652
+ PullRequest : convert .ToAPIPullRequest (ctx , pr , doer ),
644
653
Repository : convert .ToRepo (ctx , pr .Issue .Repo , permission ),
645
654
Sender : convert .ToUser (ctx , doer , nil ),
646
655
Action : api .HookIssueClosed ,
@@ -668,7 +677,7 @@ func (m *webhookNotifier) PullRequestChangeTargetBranch(ctx context.Context, doe
668
677
From : oldBranch ,
669
678
},
670
679
},
671
- PullRequest : convert .ToAPIPullRequest (ctx , pr , nil ),
680
+ PullRequest : convert .ToAPIPullRequest (ctx , pr , doer ),
672
681
Repository : convert .ToRepo (ctx , issue .Repo , mode ),
673
682
Sender : convert .ToUser (ctx , doer , nil ),
674
683
}); err != nil {
@@ -703,11 +712,12 @@ func (m *webhookNotifier) PullRequestReview(ctx context.Context, pr *issues_mode
703
712
return
704
713
}
705
714
if err := PrepareWebhooks (ctx , EventSource {Repository : review .Issue .Repo }, reviewHookType , & api.PullRequestPayload {
706
- Action : api .HookIssueReviewed ,
707
- Index : review .Issue .Index ,
708
- PullRequest : convert .ToAPIPullRequest (ctx , pr , nil ),
709
- Repository : convert .ToRepo (ctx , review .Issue .Repo , permission ),
710
- Sender : convert .ToUser (ctx , review .Reviewer , nil ),
715
+ Action : api .HookIssueReviewed ,
716
+ Index : review .Issue .Index ,
717
+ PullRequest : convert .ToAPIPullRequest (ctx , pr , review .Reviewer ),
718
+ RequestedReviewer : convert .ToUser (ctx , review .Reviewer , nil ),
719
+ Repository : convert .ToRepo (ctx , review .Issue .Repo , permission ),
720
+ Sender : convert .ToUser (ctx , review .Reviewer , nil ),
711
721
Review : & api.ReviewPayload {
712
722
Type : string (reviewHookType ),
713
723
Content : review .Content ,
@@ -729,7 +739,7 @@ func (m *webhookNotifier) PullRequestReviewRequest(ctx context.Context, doer *us
729
739
}
730
740
apiPullRequest := & api.PullRequestPayload {
731
741
Index : issue .Index ,
732
- PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , nil ),
742
+ PullRequest : convert .ToAPIPullRequest (ctx , issue .PullRequest , doer ),
733
743
RequestedReviewer : convert .ToUser (ctx , reviewer , nil ),
734
744
Repository : convert .ToRepo (ctx , issue .Repo , permission ),
735
745
Sender : convert .ToUser (ctx , doer , nil ),
@@ -774,7 +784,7 @@ func (m *webhookNotifier) PullRequestSynchronized(ctx context.Context, doer *use
774
784
if err := PrepareWebhooks (ctx , EventSource {Repository : pr .Issue .Repo }, webhook_module .HookEventPullRequestSync , & api.PullRequestPayload {
775
785
Action : api .HookIssueSynchronized ,
776
786
Index : pr .Issue .Index ,
777
- PullRequest : convert .ToAPIPullRequest (ctx , pr , nil ),
787
+ PullRequest : convert .ToAPIPullRequest (ctx , pr , doer ),
778
788
Repository : convert .ToRepo (ctx , pr .Issue .Repo , access_model.Permission {AccessMode : perm .AccessModeOwner }),
779
789
Sender : convert .ToUser (ctx , doer , nil ),
780
790
}); err != nil {
0 commit comments