diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/action.go | 11 | ||||
-rw-r--r-- | models/issue.go | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/models/action.go b/models/action.go index 1613df5e..6a25f542 100644 --- a/models/action.go +++ b/models/action.go @@ -671,9 +671,14 @@ func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error // GetFeeds returns action list of given user in given context. // actorID is the user who's requesting, ctxUserID is the user/org that is requested. // actorID can be -1 when isProfile is true or to skip the permission check. -func GetFeeds(ctxUser *User, actorID, offset int64, isProfile bool) ([]*Action, error) { - actions := make([]*Action, 0, 20) - sess := x.Limit(20, int(offset)).Desc("id").Where("user_id = ?", ctxUser.ID) +func GetFeeds(ctxUser *User, actorID int64, page int, isProfile bool) ([]*Action, error) { + if page <= 0 { + page = 1 + } + + actions := make([]*Action, 0, setting.UI.User.NewsFeedPagingNum) + sess := x.Limit(setting.UI.User.NewsFeedPagingNum, (page-1)*setting.UI.User.NewsFeedPagingNum). + Desc("id").Where("user_id = ?", ctxUser.ID) if isProfile { sess.And("is_private = ?", false).And("act_user_id = ?", ctxUser.ID) } else if actorID != -1 && ctxUser.IsOrganization() { diff --git a/models/issue.go b/models/issue.go index 1eb26119..32e20b65 100644 --- a/models/issue.go +++ b/models/issue.go @@ -895,7 +895,7 @@ func buildIssuesQuery(opts *IssuesOptions) *xorm.Session { if len(opts.RepoIDs) == 0 { return nil } - sess.In("issue.repo_id", base.Int64sToStrings(opts.RepoIDs)).And("issue.is_closed=?", opts.IsClosed) + sess.In("issue.repo_id", opts.RepoIDs).And("issue.is_closed=?", opts.IsClosed) } else { sess.Where("issue.is_closed=?", opts.IsClosed) } @@ -930,7 +930,7 @@ func buildIssuesQuery(opts *IssuesOptions) *xorm.Session { } if len(opts.Labels) > 0 && opts.Labels != "0" { - labelIDs := base.StringsToInt64s(strings.Split(opts.Labels, ",")) + labelIDs := strings.Split(opts.Labels, ",") if len(labelIDs) > 0 { sess.Join("INNER", "issue_label", "issue.id = issue_label.issue_id").In("issue_label.label_id", labelIDs) } |