mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
some refactors for issue and comments (#2419)
This commit is contained in:
parent
edc817a1dc
commit
5de94a67cf
4 changed files with 30 additions and 14 deletions
|
@ -1206,8 +1206,12 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
|
|||
|
||||
// GetParticipantsByIssueID returns all users who are participated in comments of an issue.
|
||||
func GetParticipantsByIssueID(issueID int64) ([]*User, error) {
|
||||
return getParticipantsByIssueID(x, issueID)
|
||||
}
|
||||
|
||||
func getParticipantsByIssueID(e Engine, issueID int64) ([]*User, error) {
|
||||
userIDs := make([]int64, 0, 5)
|
||||
if err := x.Table("comment").Cols("poster_id").
|
||||
if err := e.Table("comment").Cols("poster_id").
|
||||
Where("issue_id = ?", issueID).
|
||||
And("type = ?", CommentTypeComment).
|
||||
Distinct("poster_id").
|
||||
|
@ -1219,7 +1223,7 @@ func GetParticipantsByIssueID(issueID int64) ([]*User, error) {
|
|||
}
|
||||
|
||||
users := make([]*User, 0, len(userIDs))
|
||||
return users, x.In("id", userIDs).Find(&users)
|
||||
return users, e.In("id", userIDs).Find(&users)
|
||||
}
|
||||
|
||||
// UpdateIssueMentions extracts mentioned people from content and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue