From 47b878858ada27fc4c74eeadcc1e467d2da90e04 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 17 Sep 2023 16:24:40 +0800 Subject: Search branches (#27055) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve #25233 图片 图片 --- models/git/branch_list.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'models') diff --git a/models/git/branch_list.go b/models/git/branch_list.go index 131a149782..b5c1301a1d 100644 --- a/models/git/branch_list.go +++ b/models/git/branch_list.go @@ -70,6 +70,7 @@ type FindBranchOptions struct { ExcludeBranchNames []string IsDeletedBranch util.OptionalBool OrderBy string + Keyword string } func (opts *FindBranchOptions) Cond() builder.Cond { @@ -84,6 +85,9 @@ func (opts *FindBranchOptions) Cond() builder.Cond { if !opts.IsDeletedBranch.IsNone() { cond = cond.And(builder.Eq{"is_deleted": opts.IsDeletedBranch.IsTrue()}) } + if opts.Keyword != "" { + cond = cond.And(builder.Like{"name", opts.Keyword}) + } return cond } -- cgit v1.2.3