aboutsummaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-09-14 19:48:27 +0200
committerGitHub <noreply@github.com>2021-09-14 18:48:27 +0100
commit87505a9464a2c2c9d16547e06b0c922518dea73c (patch)
treeb04d85857b76d506cadc6abe79f62180a78ff1d9 /models/user.go
parent0a542dd59f8061797976f33690bf10357aa0b0ad (diff)
downloadgitea-87505a9464a2c2c9d16547e06b0c922518dea73c.tar.gz
gitea-87505a9464a2c2c9d16547e06b0c922518dea73c.zip
Add `AbsoluteListOptions` (#17028)
This PR adds a `ListOptions` type which is not paged but uses absolute values. It is implemented as discussed in Discord. Extracted from #16510 to clean that PR.
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/models/user.go b/models/user.go
index 92452e0767..0e27dae730 100644
--- a/models/user.go
+++ b/models/user.go
@@ -332,7 +332,7 @@ func (u *User) GetFollowers(listOptions ListOptions) ([]*User, error) {
Join("LEFT", "follow", "`user`.id=follow.user_id")
if listOptions.Page != 0 {
- sess = listOptions.setSessionPagination(sess)
+ sess = setSessionPagination(sess, &listOptions)
users := make([]*User, 0, listOptions.PageSize)
return users, sess.Find(&users)
@@ -354,7 +354,7 @@ func (u *User) GetFollowing(listOptions ListOptions) ([]*User, error) {
Join("LEFT", "follow", "`user`.id=follow.follow_id")
if listOptions.Page != 0 {
- sess = listOptions.setSessionPagination(sess)
+ sess = setSessionPagination(sess, &listOptions)
users := make([]*User, 0, listOptions.PageSize)
return users, sess.Find(&users)
@@ -1670,7 +1670,7 @@ func SearchUsers(opts *SearchUserOptions) (users []*User, _ int64, _ error) {
sess := x.Where(cond).OrderBy(opts.OrderBy.String())
if opts.Page != 0 {
- sess = opts.setSessionPagination(sess)
+ sess = setSessionPagination(sess, opts)
}
users = make([]*User, 0, opts.PageSize)
@@ -1686,7 +1686,7 @@ func GetStarredRepos(userID int64, private bool, listOptions ListOptions) ([]*Re
}
if listOptions.Page != 0 {
- sess = listOptions.setSessionPagination(sess)
+ sess = setSessionPagination(sess, &listOptions)
repos := make([]*Repository, 0, listOptions.PageSize)
return repos, sess.Find(&repos)
@@ -1706,7 +1706,7 @@ func GetWatchedRepos(userID int64, private bool, listOptions ListOptions) ([]*Re
}
if listOptions.Page != 0 {
- sess = listOptions.setSessionPagination(sess)
+ sess = setSessionPagination(sess, &listOptions)
repos := make([]*Repository, 0, listOptions.PageSize)
total, err := sess.FindAndCount(&repos)