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

Send notifications to partecipants in issue comments #1217

Merged
merged 2 commits into from
Mar 16, 2017

Conversation

strk
Copy link
Member

@strk strk commented Mar 11, 2017

Closes #1216

NOTE: I didn't test this with GUI notifications so might need a review
from @andreynering to deal with that -- this is just a straight port
from the Gogs commit

@lunny lunny added this to the 1.2.0 milestone Mar 11, 2017
@lunny lunny added the type/enhancement An improvement of existing functionality label Mar 11, 2017
@@ -48,6 +54,16 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
tos = append(tos, to.Email)
names = append(names, to.Name)
}
for i := range participants {
Copy link
Member

Choose a reason for hiding this comment

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

ignore self on watchers too?

Copy link
Member Author

Choose a reason for hiding this comment

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

this is already done in the file, a few lines above (see the full file)

@strk
Copy link
Member Author

strk commented Mar 11, 2017 via email

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 11, 2017
@lunny
Copy link
Member

lunny commented Mar 11, 2017

I mean watchers not participants

@strk
Copy link
Member Author

strk commented Mar 11, 2017 via email

@lunny
Copy link
Member

lunny commented Mar 11, 2017

Where is the commit?

@strk
Copy link
Member Author

strk commented Mar 11, 2017

It was already in the file, so not changed by the commit.
The code can be seen in the file as modified by the commit:
https://github.com/strk/gitea/blob/809ecfddbb8fd69b67144fcf77abb512ec12e5e8/models/issue_mail.go#L41-L44

@puffybsd
Copy link
Contributor

Did some testing on 'issue notifications'. For the most part, it worked, although I wasn't able to reproduce an issue on master, some emails were delayed and issue counts for the issue creator were out of sync (but eventually synchronized).

Using two accounts & two email accounts (one gmail, one yahoo, sparkpost relay), creator of issue is a participant, repo owner is a participant. confirmed that emails are sent to the other participant when a change is made (creator opens an issue- email sent to repo owner, not to creator; repo owner comments, email sent to creator, not to repo owner). Let me know if there's something else you'd like tested.

@strk
Copy link
Member Author

strk commented Mar 11, 2017

@puffybsd I'd love you to try the same on try.gitea.io to spot the difference, but I'm not sure email notification there work at the moment (due to #1223)

@lunny
Copy link
Member

lunny commented Mar 12, 2017

LGTM, I just made some simple tests, it works.

@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 Mar 12, 2017
@lunny
Copy link
Member

lunny commented Mar 12, 2017

But maybe you didn't consider one situation. Issue creators seem will not receive emails? Except this.

@strk
Copy link
Member Author

strk commented Mar 12, 2017

Had you tried that @lunny ? @puffybsd had you (making sure creator was not "Watching" the repo)

@lunny
Copy link
Member

lunny commented Mar 12, 2017

line 86 should has a bug. the poster maybe the comment poster not the issue poster. So poster should be a param to MailParticipants.

func (issue *Issue) MailParticipants() (err error) {

@strk
Copy link
Member Author

strk commented Mar 12, 2017

@lunny actually I don't understand the issue. Are you saying that the issue poster should not receive an email notification when someone comments on the issue ?

@@ -1133,6 +1133,23 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
return issues, nil
}

// GetParticipantsByIssueID returns all users who are participated in comments of an issue.
func GetParticipantsByIssueID(issueID int64) ([]*User, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we add unit tests for this new function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will look into it as time permits (possibly next week)

@strk
Copy link
Member Author

strk commented Mar 12, 2017

@lunny @unkwon actually confirmed the bug and reports it as fixed by gogs/gogs@5f058c3

Great reviews, thanks everyone !

@andreynering
Copy link
Contributor

Trusted LGTM

@lunny
Copy link
Member

lunny commented Mar 13, 2017

@strk I don't think that will fix the problem entirely, I will test this tomorrow again.

@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 Mar 13, 2017
@strk
Copy link
Member Author

strk commented Mar 13, 2017

192ca213f08b4d613c45bce22b78d7497f342ff5 stubs an initial test, and fails revealing still a bug !
(the one you're talking about @lunny ?)

I don't know what @unknwon idea was for that function (GetParticipantsByIssueID), but to me it does make sense for the original poster to be among the partecipants...

@strk strk force-pushed the mailnotify-issue-partecipants branch from e25eb54 to d3b2555 Compare March 14, 2017 21:17
@strk
Copy link
Member Author

strk commented Mar 15, 2017

So basically what's the failing test telling us is that the current GetParticipantsByIssueID function (in this PR) is returning all the users who commented and those who applied labels, but not the issue author. I don't know what @unknwon thinks about this but I would not include labels changers while I would include the issue author. What do other think about it ? In other words, what consistitutes "partecipation" in an issue ?

@strk strk force-pushed the mailnotify-issue-partecipants branch from 98ce0b7 to 7770335 Compare March 15, 2017 06:45
Fix test to expect what GetParticipants return
@@ -1134,6 +1134,24 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
return issues, nil
}

// GetParticipantsByIssueID returns all users who are participated in comments of an issue.
func GetParticipantsByIssueID(issueID int64) ([]*User, error) {
userIDs := make([]int64, 0, 5)
Copy link

Choose a reason for hiding this comment

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

What does happen if participants are more than 5?

Copy link
Member

Choose a reason for hiding this comment

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

nothing.

@lunny
Copy link
Member

lunny commented Mar 16, 2017

let L-G-T-M work

@lunny lunny merged commit 447c9b4 into go-gitea:master Mar 16, 2017
@strk strk deleted the mailnotify-issue-partecipants branch March 16, 2017 07:25
@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.

Participants of an issue or pull request should receive email notifications
7 participants