diff options
author | John Olheiser <42128690+jolheiser@users.noreply.github.com> | 2019-11-24 23:17:51 -0600 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-11-25 13:17:51 +0800 |
commit | 62bcb2b7f1ce1a64f828d94f045d06bd8605455a (patch) | |
tree | 05e9c5c46e08ca787bc08326af6cadb130ded0fd /models/issue_label.go | |
parent | 95c3dc856a7d4199232549e3b4d76769ef868bda (diff) | |
download | gitea-62bcb2b7f1ce1a64f828d94f045d06bd8605455a.tar.gz gitea-62bcb2b7f1ce1a64f828d94f045d06bd8605455a.zip |
Add avatar and issue labels to template repositories (#9149)
* Add avatar and issue labels
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix redundant if-err
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'models/issue_label.go')
-rw-r--r-- | models/issue_label.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/models/issue_label.go b/models/issue_label.go index 77281e9bd4..ef1f37d775 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -279,10 +279,9 @@ func GetLabelsInRepoByIDs(repoID int64, labelIDs []int64) ([]*Label, error) { Find(&labels) } -// GetLabelsByRepoID returns all labels that belong to given repository by ID. -func GetLabelsByRepoID(repoID int64, sortType string) ([]*Label, error) { +func getLabelsByRepoID(e Engine, repoID int64, sortType string) ([]*Label, error) { labels := make([]*Label, 0, 10) - sess := x.Where("repo_id = ?", repoID) + sess := e.Where("repo_id = ?", repoID) switch sortType { case "reversealphabetically": @@ -298,6 +297,11 @@ func GetLabelsByRepoID(repoID int64, sortType string) ([]*Label, error) { 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 getLabelsByIssueID(e Engine, issueID int64) ([]*Label, error) { var labels []*Label return labels, e.Where("issue_label.issue_id = ?", issueID). |