diff options
author | Jason Song <i@wolfogre.com> | 2022-10-03 20:05:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 20:05:53 +0800 |
commit | a08b48454970a0639039b730cbe616686e82bc0f (patch) | |
tree | e1e99706522b35ebab854c91a8a2a51adc56304a /models | |
parent | af849ac00965ed3e2722ed89309da4c353fd9bee (diff) | |
download | gitea-a08b48454970a0639039b730cbe616686e82bc0f.tar.gz gitea-a08b48454970a0639039b730cbe616686e82bc0f.zip |
Tag list should include draft releases with existing tags (#21263)
Before, a tag for a draft release disappeared in the tag list, fix #21262.
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models')
-rw-r--r-- | models/repo/release.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/models/repo/release.go b/models/repo/release.go index 9a4de26c68..2b484c9b84 100644 --- a/models/repo/release.go +++ b/models/repo/release.go @@ -200,6 +200,7 @@ type FindReleasesOptions struct { IsPreRelease util.OptionalBool IsDraft util.OptionalBool TagNames []string + HasSha1 util.OptionalBool // useful to find draft releases which are created with existing tags } func (opts *FindReleasesOptions) toConds(repoID int64) builder.Cond { @@ -221,6 +222,13 @@ func (opts *FindReleasesOptions) toConds(repoID int64) builder.Cond { if !opts.IsDraft.IsNone() { cond = cond.And(builder.Eq{"is_draft": opts.IsDraft.IsTrue()}) } + if !opts.HasSha1.IsNone() { + if opts.HasSha1.IsTrue() { + cond = cond.And(builder.Neq{"sha1": ""}) + } else { + cond = cond.And(builder.Eq{"sha1": ""}) + } + } return cond } |