@@ -376,17 +376,19 @@ func (m *webhookNotifier) NotifyUpdateComment(ctx context.Context, doer *user_mo
376
376
}
377
377
378
378
var eventType webhook_module.HookEventType
379
+ var pullRequest * api.PullRequest
379
380
if c .Issue .IsPull {
380
381
eventType = webhook_module .HookEventPullRequestComment
382
+ pullRequest = convert .ToAPIPullRequest (ctx , c .Issue .PullRequest , nil )
381
383
} else {
382
384
eventType = webhook_module .HookEventIssueComment
383
385
}
384
-
385
386
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 ),
390
392
Changes : & api.ChangesPayload {
391
393
Body : & api.ChangesFromPayload {
392
394
From : oldContent ,
@@ -395,7 +397,8 @@ func (m *webhookNotifier) NotifyUpdateComment(ctx context.Context, doer *user_mo
395
397
Repository : convert .ToRepo (ctx , c .Issue .Repo , permission ),
396
398
Sender : convert .ToUser (ctx , doer , nil ),
397
399
IsPull : c .Issue .IsPull ,
398
- }); err != nil {
400
+ }
401
+ if err := PrepareWebhooks (ctx , EventSource {Repository : c .Issue .Repo }, eventType , issueCommentPayload ); err != nil {
399
402
log .Error ("PrepareWebhooks [comment_id: %d]: %v" , c .ID , err )
400
403
}
401
404
}
@@ -404,21 +407,24 @@ func (m *webhookNotifier) NotifyCreateIssueComment(ctx context.Context, doer *us
404
407
issue * issues_model.Issue , comment * issues_model.Comment , mentions []* user_model.User ,
405
408
) {
406
409
var eventType webhook_module.HookEventType
410
+ var pullRequest * api.PullRequest
407
411
if issue .IsPull {
408
412
eventType = webhook_module .HookEventPullRequestComment
413
+ pullRequest = convert .ToAPIPullRequest (ctx , issue .PullRequest , nil )
409
414
} else {
410
415
eventType = webhook_module .HookEventIssueComment
411
416
}
412
-
413
417
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 {
422
428
log .Error ("PrepareWebhooks [comment_id: %d]: %v" , comment .ID , err )
423
429
}
424
430
}
@@ -441,21 +447,25 @@ func (m *webhookNotifier) NotifyDeleteComment(ctx context.Context, doer *user_mo
441
447
}
442
448
443
449
var eventType webhook_module.HookEventType
450
+ var pullRequest * api.PullRequest
444
451
if comment .Issue .IsPull {
445
452
eventType = webhook_module .HookEventPullRequestComment
453
+ pullRequest = convert .ToAPIPullRequest (ctx , comment .Issue .PullRequest , nil )
446
454
} else {
447
455
eventType = webhook_module .HookEventIssueComment
448
456
}
449
-
450
457
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 {
459
469
log .Error ("PrepareWebhooks [comment_id: %d]: %v" , comment .ID , err )
460
470
}
461
471
}
0 commit comments