@@ -419,3 +419,45 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode
419
419
log .Error ("PrepareWebhooks [is_pull: %v]: %v" , issue .IsPull , err )
420
420
}
421
421
}
422
+
423
+ func (m * webhookNotifier ) NotifyIssueChangeMilestone (doer * models.User , issue * models.Issue , oldMilestoneID int64 ) {
424
+ var hookAction api.HookIssueAction
425
+ var err error
426
+ if issue .MilestoneID > 0 {
427
+ hookAction = api .HookIssueMilestoned
428
+ } else {
429
+ hookAction = api .HookIssueDemilestoned
430
+ }
431
+
432
+ if err = issue .LoadAttributes (); err != nil {
433
+ log .Error ("issue.LoadAttributes failed: %v" , err )
434
+ return
435
+ }
436
+
437
+ mode , _ := models .AccessLevel (doer , issue .Repo )
438
+ if issue .IsPull {
439
+ err = issue .PullRequest .LoadIssue ()
440
+ if err != nil {
441
+ log .Error ("LoadIssue: %v" , err )
442
+ return
443
+ }
444
+ err = webhook_module .PrepareWebhooks (issue .Repo , models .HookEventPullRequest , & api.PullRequestPayload {
445
+ Action : hookAction ,
446
+ Index : issue .Index ,
447
+ PullRequest : issue .PullRequest .APIFormat (),
448
+ Repository : issue .Repo .APIFormat (mode ),
449
+ Sender : doer .APIFormat (),
450
+ })
451
+ } else {
452
+ err = webhook_module .PrepareWebhooks (issue .Repo , models .HookEventIssues , & api.IssuePayload {
453
+ Action : hookAction ,
454
+ Index : issue .Index ,
455
+ Issue : issue .APIFormat (),
456
+ Repository : issue .Repo .APIFormat (mode ),
457
+ Sender : doer .APIFormat (),
458
+ })
459
+ }
460
+ if err != nil {
461
+ log .Error ("PrepareWebhooks [is_pull: %v]: %v" , issue .IsPull , err )
462
+ }
463
+ }
0 commit comments