Skip to content

Commit f347568

Browse files
committed
prevented breaking change
1 parent 4f644f1 commit f347568

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

models/topic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func FindTopics(opts *FindTopicOptions) (topics []*Topic, err error) {
171171
if opts.RepoID > 0 {
172172
sess.Join("INNER", "repo_topic", "repo_topic.topic_id = topic.id")
173173
}
174-
if opts.PageSize > 0 {
174+
if opts.Page != 0 {
175175
sess = opts.setSessionPagination(sess)
176176
}
177177
return topics, sess.Desc("topic.repo_count").Find(&topics)

models/user.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,20 +1532,17 @@ func SearchUsers(opts *SearchUserOptions) (users []*User, _ int64, _ error) {
15321532
return nil, 0, fmt.Errorf("Count: %v", err)
15331533
}
15341534

1535-
if opts.PageSize == 0 || opts.PageSize > setting.UI.ExplorePagingNum {
1536-
opts.PageSize = setting.UI.ExplorePagingNum
1537-
}
1538-
if opts.Page <= 0 {
1539-
opts.Page = 1
1540-
}
15411535
if len(opts.OrderBy) == 0 {
15421536
opts.OrderBy = SearchOrderByAlphabetically
15431537
}
15441538

1545-
sess := opts.setSessionPagination(x.Where(cond))
1539+
sess := x.Where(cond).OrderBy(opts.OrderBy.String())
1540+
if opts.Page != 0 {
1541+
sess = opts.setSessionPagination(sess)
1542+
}
15461543

15471544
users = make([]*User, 0, opts.PageSize)
1548-
return users, count, sess.OrderBy(opts.OrderBy.String()).Find(&users)
1545+
return users, count, sess.Find(&users)
15491546
}
15501547

15511548
// GetStarredRepos returns the repos starred by a particular user

0 commit comments

Comments
 (0)