diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-09-24 13:02:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-24 13:02:49 +0800 |
commit | 5a438ee3c0303efcb9d1935ff521917fe8a109e8 (patch) | |
tree | 8f36452631fc8a6d077addbbf857da6d50024a0a /models/issue.go | |
parent | 730065a3dc72683460b95ba1486dba8ec355a373 (diff) | |
download | gitea-5a438ee3c0303efcb9d1935ff521917fe8a109e8.tar.gz gitea-5a438ee3c0303efcb9d1935ff521917fe8a109e8.zip |
Move all mail related codes from models to services/mailer (#7200)
* move all mail related codes from models to modules/mailer
* fix lint
* use DBContext instead Engine
* use WithContext not WithEngine
* Use DBContext instead of Engine
* don't use defer when sess.Close()
* move DBContext to context.go and add some methods
* move mailer from modules/ to services
* fix lint
* fix tests
* fix fmt
* add gitea copyright
* fix tests
* don't expose db functions
* make code clear
* add DefaultDBContext
* fix build
* fix bug
Diffstat (limited to 'models/issue.go')
-rw-r--r-- | models/issue.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/models/issue.go b/models/issue.go index bb2db94407..c4b15e9ddf 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1503,7 +1503,7 @@ func getParticipantsByIssueID(e Engine, issueID int64) ([]*User, error) { // UpdateIssueMentions extracts mentioned people from content and // updates issue-user relations for them. -func UpdateIssueMentions(e Engine, issueID int64, mentions []string) error { +func UpdateIssueMentions(ctx DBContext, issueID int64, mentions []string) error { if len(mentions) == 0 { return nil } @@ -1513,7 +1513,7 @@ func UpdateIssueMentions(e Engine, issueID int64, mentions []string) error { } users := make([]*User, 0, len(mentions)) - if err := e.In("lower_name", mentions).Asc("lower_name").Find(&users); err != nil { + if err := ctx.e.In("lower_name", mentions).Asc("lower_name").Find(&users); err != nil { return fmt.Errorf("find mentioned users: %v", err) } @@ -1525,7 +1525,7 @@ func UpdateIssueMentions(e Engine, issueID int64, mentions []string) error { } memberIDs := make([]int64, 0, user.NumMembers) - orgUsers, err := getOrgUsersByOrgID(e, user.ID) + orgUsers, err := getOrgUsersByOrgID(ctx.e, user.ID) if err != nil { return fmt.Errorf("GetOrgUsersByOrgID [%d]: %v", user.ID, err) } @@ -1537,7 +1537,7 @@ func UpdateIssueMentions(e Engine, issueID int64, mentions []string) error { ids = append(ids, memberIDs...) } - if err := UpdateIssueUsersByMentions(e, issueID, ids); err != nil { + if err := UpdateIssueUsersByMentions(ctx, issueID, ids); err != nil { return fmt.Errorf("UpdateIssueUsersByMentions: %v", err) } |