diff options
author | 6543 <6543@obermui.de> | 2020-02-24 23:50:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 16:50:32 -0600 |
commit | b65e954f7342417baa15d7fa7a1a5744aababd7d (patch) | |
tree | d4515e7af41f86927580edc46edef2740b8f518b /models/issue_watch.go | |
parent | 0eeee9c72165442bb9855e662ecb7a810a9266c8 (diff) | |
download | gitea-b65e954f7342417baa15d7fa7a1a5744aababd7d.tar.gz gitea-b65e954f7342417baa15d7fa7a1a5744aababd7d.zip |
FIX Pagination of ListAccessTokens and GetIssueWatchers (#10449)
* fix a pagination bug
* fix pagination of ListAccessTokens
Diffstat (limited to 'models/issue_watch.go')
-rw-r--r-- | models/issue_watch.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/models/issue_watch.go b/models/issue_watch.go index 343ad16cde..c4732d784e 100644 --- a/models/issue_watch.go +++ b/models/issue_watch.go @@ -81,7 +81,7 @@ func GetIssueWatchers(issueID int64, listOptions ListOptions) (IssueWatchList, e return getIssueWatchers(x, issueID, listOptions) } -func getIssueWatchers(e Engine, issueID int64, listOptions ListOptions) (watches IssueWatchList, err error) { +func getIssueWatchers(e Engine, issueID int64, listOptions ListOptions) (IssueWatchList, error) { sess := e. Where("`issue_watch`.issue_id = ?", issueID). And("`issue_watch`.is_watching = ?", true). @@ -89,11 +89,13 @@ func getIssueWatchers(e Engine, issueID int64, listOptions ListOptions) (watches And("`user`.prohibit_login = ?", false). Join("INNER", "`user`", "`user`.id = `issue_watch`.user_id") - if listOptions.Page == 0 { + if listOptions.Page != 0 { sess = listOptions.setSessionPagination(sess) + watches := make([]*IssueWatch, 0, listOptions.PageSize) + return watches, sess.Find(&watches) } - err = sess.Find(&watches) - return + watches := make([]*IssueWatch, 0, 8) + return watches, sess.Find(&watches) } func removeIssueWatchersByRepoID(e Engine, userID int64, repoID int64) error { |