1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Added URL mapping for Release attachments like on github.com (#1707)

This commit is contained in:
gdeverlant
2019-01-06 23:37:30 +01:00
committed by techknowlogick
parent dd006db5a7
commit d3dc07f282
5 changed files with 71 additions and 9 deletions

View File

@@ -14,6 +14,7 @@ import (
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
api "code.gitea.io/sdk/gitea"
"github.com/go-xorm/builder"
)
@@ -283,6 +284,15 @@ func GetReleasesByRepoID(repoID int64, opts FindReleasesOptions, page, pageSize
return rels, err
}
// GetReleasesByRepoIDAndNames returns a list of releases of repository according repoID and tagNames.
func GetReleasesByRepoIDAndNames(repoID int64, tagNames []string) (rels []*Release, err error) {
err = x.
Desc("created_unix").
In("tag_name", tagNames).
Find(&rels, Release{RepoID: repoID})
return rels, err
}
// GetReleaseCountByRepoID returns the count of releases of repository
func GetReleaseCountByRepoID(repoID int64, opts FindReleasesOptions) (int64, error) {
return x.Where(opts.toConds(repoID)).Count(&Release{})