aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThibault Meyer <0xbaadf00d@users.noreply.github.com>2016-08-26 02:43:53 +0200
committer无闻 <u@gogs.io>2016-08-25 17:43:53 -0700
commitf50e568fd12feda20b1a899486914881564bea12 (patch)
tree7780a7575524037c56b494a0ab5e419bb25d5043
parentf8a48ffaad481ee9eaa8a42e0e7d64c12c90ef86 (diff)
downloadgitea-f50e568fd12feda20b1a899486914881564bea12.tar.gz
gitea-f50e568fd12feda20b1a899486914881564bea12.zip
Fix #3189: Sort labels by name (#3446)
* Fix #3189 #3445: Order labels by name * Order labels by name on Issues view
-rw-r--r--models/issue_label.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/models/issue_label.go b/models/issue_label.go
index a3015b02cd..62d687a262 100644
--- a/models/issue_label.go
+++ b/models/issue_label.go
@@ -103,13 +103,13 @@ func GetLabelInRepoByID(repoID, labelID int64) (*Label, error) {
// it silently ignores label IDs that are not belong to the repository.
func GetLabelsInRepoByIDs(repoID int64, labelIDs []int64) ([]*Label, error) {
labels := make([]*Label, 0, len(labelIDs))
- return labels, x.Where("repo_id = ?", repoID).In("id", base.Int64sToStrings(labelIDs)).Find(&labels)
+ return labels, x.Where("repo_id = ?", repoID).In("id", base.Int64sToStrings(labelIDs)).Asc("name").Find(&labels)
}
// GetLabelsByRepoID returns all labels that belong to given repository by ID.
func GetLabelsByRepoID(repoID int64) ([]*Label, error) {
labels := make([]*Label, 0, 10)
- return labels, x.Where("repo_id = ?", repoID).Find(&labels)
+ return labels, x.Where("repo_id = ?", repoID).Asc("name").Find(&labels)
}
func getLabelsByIssueID(e Engine, issueID int64) ([]*Label, error) {
@@ -126,7 +126,7 @@ func getLabelsByIssueID(e Engine, issueID int64) ([]*Label, error) {
}
labels := make([]*Label, 0, len(labelIDs))
- return labels, e.Where("id > 0").In("id", base.Int64sToStrings(labelIDs)).Find(&labels)
+ return labels, e.Where("id > 0").In("id", base.Int64sToStrings(labelIDs)).Asc("name").Find(&labels)
}
// GetLabelsByIssueID returns all labels that belong to given issue by ID.