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 1 commit
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
14 changes: 5 additions & 9 deletions models/issue_mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment,
participants = append(participants, issue.Poster)
}

// Assignee must receive any communications
if issue.AssigneeID != doer.ID {
participants = append(participants, issue.Assignee)
Copy link
Member

Choose a reason for hiding this comment

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

Assignee maybe not load?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only when no assignee defined, so sanity check with GetUserByID() pushed.

Copy link
Member

@lafriks lafriks Jun 22, 2017

Choose a reason for hiding this comment

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

I have not checked too deeply but if there is error in issue loadAttributes, it would probably continue and leave issue.Assignee as nil. I would suggest adding additional check for && issue.Assignee != nil to be on safe side just in case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check against nil added with latest commit.

}

tos := make([]string, 0, len(watchers)) // List of email addresses.
names := make([]string, 0, len(watchers))
for i := range watchers {
Expand Down Expand Up @@ -71,15 +76,6 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment,
names = append(names, participants[i].Name)
}

// Assignee must receive any communications
to, err := GetUserByID(issue.AssigneeID)
if err != nil {
return fmt.Errorf("GetUserByID [%d]: %v", issue.AssigneeID, err)
}

tos = append(tos, to.Email)
names = append(names, to.Name)

SendIssueCommentMail(issue, doer, comment, tos)

// Mail mentioned people and exclude watchers.
Expand Down