forked from forgejo/forgejo
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>
This commit is contained in:
parent
95c3dc856a
commit
62bcb2b7f1
8 changed files with 95 additions and 22 deletions
|
@ -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).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue