@ -1085,7 +1085,7 @@ func GetIssueUserPairsByMode(uid, rid int64, isClosed bool, page, filterMode int
// UpdateIssueMentions extracts mentioned people from content and
// UpdateIssueMentions extracts mentioned people from content and
// updates issue-user relations for them.
// updates issue-user relations for them.
func UpdateIssueMentions ( issueID int64 , mentions [ ] string ) error {
func UpdateIssueMentions ( e Engine , issueID int64 , mentions [ ] string ) error {
if len ( mentions ) == 0 {
if len ( mentions ) == 0 {
return nil
return nil
}
}
@ -1095,7 +1095,7 @@ func UpdateIssueMentions(issueID int64, mentions []string) error {
}
}
users := make ( [ ] * User , 0 , len ( mentions ) )
users := make ( [ ] * User , 0 , len ( mentions ) )
if err := x . In ( "lower_name" , mentions ) . Asc ( "lower_name" ) . Find ( & users ) ; err != nil {
if err := e . In ( "lower_name" , mentions ) . Asc ( "lower_name" ) . Find ( & users ) ; err != nil {
return fmt . Errorf ( "find mentioned users: %v" , err )
return fmt . Errorf ( "find mentioned users: %v" , err )
}
}
@ -1119,7 +1119,7 @@ func UpdateIssueMentions(issueID int64, mentions []string) error {
ids = append ( ids , memberIDs ... )
ids = append ( ids , memberIDs ... )
}
}
if err := UpdateIssueUsersByMentions ( issueID , ids ) ; err != nil {
if err := UpdateIssueUsersByMentions ( e , issueID, ids ) ; err != nil {
return fmt . Errorf ( "UpdateIssueUsersByMentions: %v" , err )
return fmt . Errorf ( "UpdateIssueUsersByMentions: %v" , err )
}
}
@ -1361,22 +1361,22 @@ func UpdateIssueUserByRead(uid, issueID int64) error {
}
}
// UpdateIssueUsersByMentions updates issue-user pairs by mentioning.
// UpdateIssueUsersByMentions updates issue-user pairs by mentioning.
func UpdateIssueUsersByMentions ( issueID int64 , uids [ ] int64 ) error {
func UpdateIssueUsersByMentions ( e Engine , issueID int64 , uids [ ] int64 ) error {
for _ , uid := range uids {
for _ , uid := range uids {
iu := & IssueUser {
iu := & IssueUser {
UID : uid ,
UID : uid ,
IssueID : issueID ,
IssueID : issueID ,
}
}
has , err := x . Get ( iu )
has , err := e . Get ( iu )
if err != nil {
if err != nil {
return err
return err
}
}
iu . IsMentioned = true
iu . IsMentioned = true
if has {
if has {
_ , err = x . Id ( iu . ID ) . AllCols ( ) . Update ( iu )
_ , err = e . Id ( iu . ID ) . AllCols ( ) . Update ( iu )
} else {
} else {
_ , err = x . Insert ( iu )
_ , err = e . Insert ( iu )
}
}
if err != nil {
if err != nil {
return err
return err