@@ -375,17 +375,20 @@ func (m *webhookNotifier) UpdateComment(ctx context.Context, doer *user_model.Us
375375 }
376376
377377 var eventType webhook_module.HookEventType
378+ var pullRequest * api.PullRequest
378379 if c .Issue .IsPull {
379380 eventType = webhook_module .HookEventPullRequestComment
381+ pullRequest = convert .ToAPIPullRequest (ctx , c .Issue .PullRequest , nil )
380382 } else {
381383 eventType = webhook_module .HookEventIssueComment
382384 }
383385
384386 permission , _ := access_model .GetUserRepoPermission (ctx , c .Issue .Repo , doer )
385387 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 ),
389392 Changes : & api.ChangesPayload {
390393 Body : & api.ChangesFromPayload {
391394 From : oldContent ,
@@ -403,20 +406,23 @@ func (m *webhookNotifier) CreateIssueComment(ctx context.Context, doer *user_mod
403406 issue * issues_model.Issue , comment * issues_model.Comment , mentions []* user_model.User ,
404407) {
405408 var eventType webhook_module.HookEventType
409+ var pullRequest * api.PullRequest
406410 if issue .IsPull {
407411 eventType = webhook_module .HookEventPullRequestComment
412+ pullRequest = convert .ToAPIPullRequest (ctx , issue .PullRequest , nil )
408413 } else {
409414 eventType = webhook_module .HookEventIssueComment
410415 }
411416
412417 permission , _ := access_model .GetUserRepoPermission (ctx , repo , doer )
413418 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 ,
420426 }); err != nil {
421427 log .Error ("PrepareWebhooks [comment_id: %d]: %v" , comment .ID , err )
422428 }
@@ -440,20 +446,23 @@ func (m *webhookNotifier) DeleteComment(ctx context.Context, doer *user_model.Us
440446 }
441447
442448 var eventType webhook_module.HookEventType
449+ var pullRequest * api.PullRequest
443450 if comment .Issue .IsPull {
444451 eventType = webhook_module .HookEventPullRequestComment
452+ pullRequest = convert .ToAPIPullRequest (ctx , comment .Issue .PullRequest , nil )
445453 } else {
446454 eventType = webhook_module .HookEventIssueComment
447455 }
448456
449457 permission , _ := access_model .GetUserRepoPermission (ctx , comment .Issue .Repo , doer )
450458 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 ,
457466 }); err != nil {
458467 log .Error ("PrepareWebhooks [comment_id: %d]: %v" , comment .ID , err )
459468 }
0 commit comments