@@ -376,17 +376,19 @@ func (m *webhookNotifier) NotifyUpdateComment(ctx context.Context, doer *user_mo
376376 }
377377
378378 var eventType webhook_module.HookEventType
379+ var pullRequest * api.PullRequest
379380 if c .Issue .IsPull {
380381 eventType = webhook_module .HookEventPullRequestComment
382+ pullRequest = convert .ToAPIPullRequest (ctx , c .Issue .PullRequest , nil )
381383 } else {
382384 eventType = webhook_module .HookEventIssueComment
383385 }
384-
385386 permission , _ := access_model .GetUserRepoPermission (ctx , c .Issue .Repo , doer )
386- if err := PrepareWebhooks (ctx , EventSource {Repository : c .Issue .Repo }, eventType , & api.IssueCommentPayload {
387- Action : api .HookIssueCommentEdited ,
388- Issue : convert .ToAPIIssue (ctx , c .Issue ),
389- Comment : convert .ToAPIComment (ctx , c .Issue .Repo , c ),
387+ issueCommentPayload := & api.IssueCommentPayload {
388+ Action : api .HookIssueCommentEdited ,
389+ Issue : convert .ToAPIIssue (ctx , c .Issue ),
390+ PullRequest : pullRequest ,
391+ Comment : convert .ToAPIComment (ctx , c .Issue .Repo , c ),
390392 Changes : & api.ChangesPayload {
391393 Body : & api.ChangesFromPayload {
392394 From : oldContent ,
@@ -395,7 +397,8 @@ func (m *webhookNotifier) NotifyUpdateComment(ctx context.Context, doer *user_mo
395397 Repository : convert .ToRepo (ctx , c .Issue .Repo , permission ),
396398 Sender : convert .ToUser (ctx , doer , nil ),
397399 IsPull : c .Issue .IsPull ,
398- }); err != nil {
400+ }
401+ if err := PrepareWebhooks (ctx , EventSource {Repository : c .Issue .Repo }, eventType , issueCommentPayload ); err != nil {
399402 log .Error ("PrepareWebhooks [comment_id: %d]: %v" , c .ID , err )
400403 }
401404}
@@ -404,21 +407,24 @@ func (m *webhookNotifier) NotifyCreateIssueComment(ctx context.Context, doer *us
404407 issue * issues_model.Issue , comment * issues_model.Comment , mentions []* user_model.User ,
405408) {
406409 var eventType webhook_module.HookEventType
410+ var pullRequest * api.PullRequest
407411 if issue .IsPull {
408412 eventType = webhook_module .HookEventPullRequestComment
413+ pullRequest = convert .ToAPIPullRequest (ctx , issue .PullRequest , nil )
409414 } else {
410415 eventType = webhook_module .HookEventIssueComment
411416 }
412-
413417 permission , _ := access_model .GetUserRepoPermission (ctx , repo , doer )
414- if err := PrepareWebhooks (ctx , EventSource {Repository : issue .Repo }, eventType , & api.IssueCommentPayload {
415- Action : api .HookIssueCommentCreated ,
416- Issue : convert .ToAPIIssue (ctx , issue ),
417- Comment : convert .ToAPIComment (ctx , repo , comment ),
418- Repository : convert .ToRepo (ctx , repo , permission ),
419- Sender : convert .ToUser (ctx , doer , nil ),
420- IsPull : issue .IsPull ,
421- }); err != nil {
418+ issueCommentPayload := & api.IssueCommentPayload {
419+ Action : api .HookIssueCommentCreated ,
420+ Issue : convert .ToAPIIssue (ctx , 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 ,
426+ }
427+ if err := PrepareWebhooks (ctx , EventSource {Repository : issue .Repo }, eventType , issueCommentPayload ); err != nil {
422428 log .Error ("PrepareWebhooks [comment_id: %d]: %v" , comment .ID , err )
423429 }
424430}
@@ -441,21 +447,25 @@ func (m *webhookNotifier) NotifyDeleteComment(ctx context.Context, doer *user_mo
441447 }
442448
443449 var eventType webhook_module.HookEventType
450+ var pullRequest * api.PullRequest
444451 if comment .Issue .IsPull {
445452 eventType = webhook_module .HookEventPullRequestComment
453+ pullRequest = convert .ToAPIPullRequest (ctx , comment .Issue .PullRequest , nil )
446454 } else {
447455 eventType = webhook_module .HookEventIssueComment
448456 }
449-
450457 permission , _ := access_model .GetUserRepoPermission (ctx , comment .Issue .Repo , doer )
451- if err := PrepareWebhooks (ctx , EventSource {Repository : comment .Issue .Repo }, eventType , & api.IssueCommentPayload {
452- Action : api .HookIssueCommentDeleted ,
453- Issue : convert .ToAPIIssue (ctx , comment .Issue ),
454- Comment : convert .ToAPIComment (ctx , comment .Issue .Repo , comment ),
455- Repository : convert .ToRepo (ctx , comment .Issue .Repo , permission ),
456- Sender : convert .ToUser (ctx , doer , nil ),
457- IsPull : comment .Issue .IsPull ,
458- }); err != nil {
458+ issueCommentPayload := & api.IssueCommentPayload {
459+ Action : api .HookIssueCommentDeleted ,
460+ Issue : convert .ToAPIIssue (ctx , 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 ,
466+ }
467+
468+ if err := PrepareWebhooks (ctx , EventSource {Repository : comment .Issue .Repo }, eventType , issueCommentPayload ); err != nil {
459469 log .Error ("PrepareWebhooks [comment_id: %d]: %v" , comment .ID , err )
460470 }
461471}
0 commit comments