diff options
Diffstat (limited to 'models/issue_label.go')
-rw-r--r-- | models/issue_label.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/models/issue_label.go b/models/issue_label.go index 66f93f4f48..abf0521cea 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -1,4 +1,5 @@ // Copyright 2016 The Gogs Authors. All rights reserved. +// Copyright 2020 The Gitea Authors. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. @@ -298,7 +299,7 @@ func GetLabelsInRepoByIDs(repoID int64, labelIDs []int64) ([]*Label, error) { Find(&labels) } -func getLabelsByRepoID(e Engine, repoID int64, sortType string) ([]*Label, error) { +func getLabelsByRepoID(e Engine, repoID int64, sortType string, listOptions ListOptions) ([]*Label, error) { labels := make([]*Label, 0, 10) sess := e.Where("repo_id = ?", repoID) @@ -313,12 +314,16 @@ func getLabelsByRepoID(e Engine, repoID int64, sortType string) ([]*Label, error sess.Asc("name") } + if listOptions.Page != 0 { + sess = listOptions.setSessionPagination(sess) + } + return labels, sess.Find(&labels) } // GetLabelsByRepoID returns all labels that belong to given repository by ID. -func GetLabelsByRepoID(repoID int64, sortType string) ([]*Label, error) { - return getLabelsByRepoID(x, repoID, sortType) +func GetLabelsByRepoID(repoID int64, sortType string, listOptions ListOptions) ([]*Label, error) { + return getLabelsByRepoID(x, repoID, sortType, listOptions) } func getLabelsByIssueID(e Engine, issueID int64) ([]*Label, error) { |