@ -94,6 +94,19 @@ func (ns *notificationService) NotifyIssueChangeStatus(doer *models.User, issue
} )
} )
}
}
func ( ns * notificationService ) NotifyIssueChangeTitle ( doer * models . User , issue * models . Issue , oldTitle string ) {
if err := issue . LoadPullRequest ( ) ; err != nil {
log . Error ( "issue.LoadPullRequest: %v" , err )
return
}
if issue . IsPull && models . HasWorkInProgressPrefix ( oldTitle ) && ! issue . PullRequest . IsWorkInProgress ( ) {
_ = ns . issueQueue . Push ( issueNotificationOpts {
IssueID : issue . ID ,
NotificationAuthorID : doer . ID ,
} )
}
}
func ( ns * notificationService ) NotifyMergePullRequest ( pr * models . PullRequest , doer * models . User ) {
func ( ns * notificationService ) NotifyMergePullRequest ( pr * models . PullRequest , doer * models . User ) {
_ = ns . issueQueue . Push ( issueNotificationOpts {
_ = ns . issueQueue . Push ( issueNotificationOpts {
IssueID : pr . Issue . ID ,
IssueID : pr . Issue . ID ,
@ -106,15 +119,32 @@ func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest, ment
log . Error ( "Unable to load issue: %d for pr: %d: Error: %v" , pr . IssueID , pr . ID , err )
log . Error ( "Unable to load issue: %d for pr: %d: Error: %v" , pr . IssueID , pr . ID , err )
return
return
}
}
_ = ns . issueQueue . Push ( issueNotificationOpts {
toNotify := make ( map [ int64 ] struct { } , 32 )
IssueID : pr . Issue . ID ,
repoWatchers , err := models . GetRepoWatchersIDs ( pr . Issue . RepoID )
NotificationAuthorID : pr . Issue . PosterID ,
if err != nil {
} )
log . Error ( "GetRepoWatchersIDs: %v" , err )
return
}
for _ , id := range repoWatchers {
toNotify [ id ] = struct { } { }
}
issueParticipants , err := models . GetParticipantsIDsByIssueID ( pr . IssueID )
if err != nil {
log . Error ( "GetParticipantsIDsByIssueID: %v" , err )
return
}
for _ , id := range issueParticipants {
toNotify [ id ] = struct { } { }
}
delete ( toNotify , pr . Issue . PosterID )
for _ , mention := range mentions {
for _ , mention := range mentions {
toNotify [ mention . ID ] = struct { } { }
}
for receiverID := range toNotify {
_ = ns . issueQueue . Push ( issueNotificationOpts {
_ = ns . issueQueue . Push ( issueNotificationOpts {
IssueID : pr . Issue . ID ,
IssueID : pr . Issue . ID ,
NotificationAuthorID : pr . Issue . PosterID ,
NotificationAuthorID : pr . Issue . PosterID ,
ReceiverID : mention . ID ,
ReceiverID : receiver ID,
} )
} )
}
}
}
}