forked from forgejo/forgejo
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>
This commit is contained in:
parent
b496e3e1cc
commit
d766d0c4e0
13 changed files with 89 additions and 25 deletions
|
@ -1204,8 +1204,11 @@ func GetParticipantsByIssueID(issueID int64) ([]*User, error) {
|
|||
func getParticipantsByIssueID(e Engine, issueID int64) ([]*User, error) {
|
||||
userIDs := make([]int64, 0, 5)
|
||||
if err := e.Table("comment").Cols("poster_id").
|
||||
Where("issue_id = ?", issueID).
|
||||
And("type = ?", CommentTypeComment).
|
||||
Where("`comment`.issue_id = ?", issueID).
|
||||
And("`comment`.type = ?", CommentTypeComment).
|
||||
And("`user`.is_active = ?", true).
|
||||
And("`user`.prohibit_login = ?", false).
|
||||
Join("INNER", "user", "`user`.id = `comment`.poster_id").
|
||||
Distinct("poster_id").
|
||||
Find(&userIDs); err != nil {
|
||||
return nil, fmt.Errorf("get poster IDs: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue