diff options
Diffstat (limited to 'models/issue_assignees.go')
-rw-r--r-- | models/issue_assignees.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/issue_assignees.go b/models/issue_assignees.go index 4d71cc6e51..08a567c4eb 100644 --- a/models/issue_assignees.go +++ b/models/issue_assignees.go @@ -41,6 +41,18 @@ func (issue *Issue) loadAssignees(e Engine) (err error) { return } +// GetAssigneeIDsByIssue returns the IDs of users assigned to an issue +// but skips joining with `user` for performance reasons. +// User permissions must be verified elsewhere if required. +func GetAssigneeIDsByIssue(issueID int64) ([]int64, error) { + userIDs := make([]int64, 0, 5) + return userIDs, x.Table("issue_assignees"). + Cols("assignee_id"). + Where("issue_id = ?", issueID). + Distinct("assignee_id"). + Find(&userIDs) +} + // GetAssigneesByIssue returns everyone assigned to that issue func GetAssigneesByIssue(issue *Issue) (assignees []*User, err error) { return getAssigneesByIssue(x, issue) |