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

Conversation

scr34m
Copy link
Contributor

@scr34m scr34m commented Jun 18, 2017

Assignee right now doesn't get any notifications when new comment or when got a new issue.

@lunny lunny added this to the 1.2.0 milestone Jun 18, 2017
@lunny lunny added the type/enhancement An improvement of existing functionality label Jun 18, 2017
@lunny
Copy link
Member

lunny commented Jun 18, 2017

It seems it's difficult to add a test for it.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 18, 2017
@scr34m
Copy link
Contributor Author

scr34m commented Jun 19, 2017

I would like to close this PR and create new one, because the doer.ID check is missing so assignee receive self comments too.

Or I could simply push the fix in this PR?

@lunny
Copy link
Member

lunny commented Jun 19, 2017

Just to push.

@scr34m
Copy link
Contributor Author

scr34m commented Jun 19, 2017

One more mistake, because assignee is not mandatory it maybe empty, issue.Assignee != nil check enough or issue.AssigneID != 0 or better to use GetUserByID()?

@@ -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.

@@ -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.

@lunny
Copy link
Member

lunny commented Jun 23, 2017

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 23, 2017
@lafriks
Copy link
Member

lafriks commented Jun 23, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 23, 2017
@lafriks
Copy link
Member

lafriks commented Jun 23, 2017

@ethantkoenig needs your approval

@lunny lunny merged commit f2afed3 into go-gitea:master Jun 23, 2017
@scr34m scr34m deleted the notify-assignee branch June 24, 2017 18:30
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants