diff options
author | David Schneiderbauer <daviian@users.noreply.github.com> | 2017-09-16 02:18:25 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-09-16 08:18:25 +0800 |
commit | d766d0c4e064bf7f66098123f39d15c2dc67e415 (patch) | |
tree | 274eebecadd724502dd5c82e95f2f6f4cc4d6d34 /models/issue_mail.go | |
parent | b496e3e1cc70829e5a6f78f3dff28277993f8406 (diff) | |
download | gitea-d766d0c4e064bf7f66098123f39d15c2dc67e415.tar.gz gitea-d766d0c4e064bf7f66098123f39d15c2dc67e415.zip |
Prevent sending emails and notifications to inactive users (#2384)
* Filter inactive users before sending emails or creating browser notifications
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* fix formatting issues
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* included requested changes
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* optimized database queries
* rebasing new master and add tablenames for clarification in xorm queries
* remove escaped quotationmarks using backticks
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
Diffstat (limited to 'models/issue_mail.go')
-rw-r--r-- | models/issue_mail.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/models/issue_mail.go b/models/issue_mail.go index 9e604a50f1..74ef660554 100644 --- a/models/issue_mail.go +++ b/models/issue_mail.go @@ -36,9 +36,13 @@ func mailIssueCommentToParticipants(e Engine, issue *Issue, doer *User, comment return fmt.Errorf("getParticipantsByIssueID [issue_id: %d]: %v", issue.ID, err) } - // In case the issue poster is not watching the repository, + // In case the issue poster is not watching the repository and is active, // even if we have duplicated in watchers, can be safely filtered out. - if issue.PosterID != doer.ID { + poster, err := GetUserByID(issue.PosterID) + if err != nil { + return fmt.Errorf("GetUserByID [%d]: %v", issue.PosterID, err) + } + if issue.PosterID != doer.ID && poster.IsActive && !poster.ProhibitLogin { participants = append(participants, issue.Poster) } |