diff options
author | gdeverlant <e.bekrek@yandex.com> | 2019-01-06 23:37:30 +0100 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2019-01-06 17:37:30 -0500 |
commit | d3dc07f282936849897f861346777b47c8c388d3 (patch) | |
tree | 2da810fc1d6671bf8659f9bf868e184698f0fc7c /models/release.go | |
parent | dd006db5a719b33aef7887faab48718e4b0f2786 (diff) | |
download | gitea-d3dc07f282936849897f861346777b47c8c388d3.tar.gz gitea-d3dc07f282936849897f861346777b47c8c388d3.zip |
Added URL mapping for Release attachments like on github.com (#1707)
Diffstat (limited to 'models/release.go')
-rw-r--r-- | models/release.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/release.go b/models/release.go index c1c8b933d0..0c78707d6b 100644 --- a/models/release.go +++ b/models/release.go @@ -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{}) |