summaryrefslogtreecommitdiffstats
path: root/models/issue_watch.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issue_watch.go')
-rw-r--r--models/issue_watch.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/models/issue_watch.go b/models/issue_watch.go
index 6144d6cafe..343ad16cde 100644
--- a/models/issue_watch.go
+++ b/models/issue_watch.go
@@ -77,18 +77,22 @@ func GetIssueWatchersIDs(issueID int64) ([]int64, error) {
}
// GetIssueWatchers returns watchers/unwatchers of a given issue
-func GetIssueWatchers(issueID int64) (IssueWatchList, error) {
- return getIssueWatchers(x, issueID)
+func GetIssueWatchers(issueID int64, listOptions ListOptions) (IssueWatchList, error) {
+ return getIssueWatchers(x, issueID, listOptions)
}
-func getIssueWatchers(e Engine, issueID int64) (watches IssueWatchList, err error) {
- err = e.
+func getIssueWatchers(e Engine, issueID int64, listOptions ListOptions) (watches IssueWatchList, err error) {
+ sess := e.
Where("`issue_watch`.issue_id = ?", issueID).
And("`issue_watch`.is_watching = ?", true).
And("`user`.is_active = ?", true).
And("`user`.prohibit_login = ?", false).
- Join("INNER", "`user`", "`user`.id = `issue_watch`.user_id").
- Find(&watches)
+ Join("INNER", "`user`", "`user`.id = `issue_watch`.user_id")
+
+ if listOptions.Page == 0 {
+ sess = listOptions.setSessionPagination(sess)
+ }
+ err = sess.Find(&watches)
return
}