changes needed in models
This commit is contained in:
parent
05bb9d06da
commit
f09dc25b0c
@ -1088,14 +1088,8 @@ func sortIssuesSession(sess *xorm.Session, sortType string, priorityRepoID int64
|
||||
}
|
||||
|
||||
func (opts *IssuesOptions) setupSession(sess *xorm.Session) {
|
||||
if opts.Page >= 0 && opts.PageSize > 0 {
|
||||
var start int
|
||||
if opts.Page == 0 {
|
||||
start = 0
|
||||
} else {
|
||||
start = (opts.Page - 1) * opts.PageSize
|
||||
}
|
||||
sess.Limit(opts.PageSize, start)
|
||||
if opts.Page != 0 {
|
||||
opts.ListOptions.setSessionPagination(sess)
|
||||
}
|
||||
|
||||
if len(opts.IssueIDs) > 0 {
|
||||
|
@ -103,7 +103,11 @@ func (opts *FindNotificationOptions) ToCond() builder.Cond {
|
||||
|
||||
// ToSession will convert the given options to a xorm Session by using the conditions from ToCond and joining with issue table if required
|
||||
func (opts *FindNotificationOptions) ToSession(e Engine) *xorm.Session {
|
||||
return opts.setSessionPagination(e.Where(opts.ToCond()))
|
||||
sess := e.Where(opts.ToCond())
|
||||
if opts.Page != 0 {
|
||||
sess = opts.setSessionPagination(sess)
|
||||
}
|
||||
return sess
|
||||
}
|
||||
|
||||
func getNotifications(e Engine, options FindNotificationOptions) (nl NotificationList, err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user