Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable assignee e-mail notification #2003

Merged
merged 5 commits into from
Jun 23, 2017
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions models/issue_mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment,
participants = append(participants, issue.Poster)
}

// Assignee must receive any communications
if issue.AssigneeID != doer.ID {
to, err := GetUserByID(issue.AssigneeID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the assignee has been deleted? GetUserByID(issue.AssigneeID) will return an error, but we would want to use a ghost user in this case.

Maybe we should add an Issue.loadAssignee(..) method similar to Issue.loadPoster(..). This would also save us from loading the assignee if the assignee has already been loaded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commited the loadAssignee() method.

if err != nil {
return fmt.Errorf("GetUserByID [%d]: %v", issue.AssigneeID, err)
}
participants = append(participants, to)
}

tos := make([]string, 0, len(watchers)) // List of email addresses.
names := make([]string, 0, len(watchers))
for i := range watchers {
Expand Down