diff options
Diffstat (limited to 'app/models/protected_branch.rb')
-rw-r--r-- | app/models/protected_branch.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 735e2bdea81..94c3b83564f 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -2,6 +2,7 @@ class ProtectedBranch < ApplicationRecord include ProtectedRef + include Gitlab::SQL::Pattern scope :requiring_code_owner_approval, -> { where(code_owner_approval_required: true) } @@ -45,6 +46,12 @@ class ProtectedBranch < ApplicationRecord # NOOP # end + + def self.by_name(query) + return none if query.blank? + + where(fuzzy_arel_match(:name, query.downcase)) + end end ProtectedBranch.prepend_if_ee('EE::ProtectedBranch') |