diff options
author | Bruno Sofiato <bruno.sofiato@gmail.com> | 2024-09-17 15:33:11 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-18 02:33:11 +0800 |
commit | 7dde3e64894edf9949f5199c0d1084bb3015cac9 (patch) | |
tree | 9f4ca6191a46ea960e258ae500ecaa8bc0eb1f6f /models/repo/release.go | |
parent | f528df944bb9436afcb9272add2ee0cccefbdb55 (diff) | |
download | gitea-7dde3e64894edf9949f5199c0d1084bb3015cac9.tar.gz gitea-7dde3e64894edf9949f5199c0d1084bb3015cac9.zip |
Included tag search capabilities (#32045)
Resolves #31998
The first screenshot shows the tag page without any filter being
applied:

The second one, shows the page when the given filter returns no tag:

The last one shows a single tag being filtered:

Signed-off-by: Bruno Sofiato <bruno.sofiato@gmail.com>
Diffstat (limited to 'models/repo/release.go')
-rw-r--r-- | models/repo/release.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/repo/release.go b/models/repo/release.go index 1643258301..7c66cbc1af 100644 --- a/models/repo/release.go +++ b/models/repo/release.go @@ -234,6 +234,7 @@ type FindReleasesOptions struct { IsDraft optional.Option[bool] TagNames []string HasSha1 optional.Option[bool] // useful to find draft releases which are created with existing tags + NamePattern optional.Option[string] } func (opts FindReleasesOptions) ToConds() builder.Cond { @@ -261,6 +262,11 @@ func (opts FindReleasesOptions) ToConds() builder.Cond { cond = cond.And(builder.Eq{"sha1": ""}) } } + + if opts.NamePattern.Has() && opts.NamePattern.Value() != "" { + cond = cond.And(builder.Like{"lower_tag_name", strings.ToLower(opts.NamePattern.Value())}) + } + return cond } |