diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-26 06:07:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-26 06:07:24 +0300 |
commit | 694926dda342630084c55ad7eba1655fa266b161 (patch) | |
tree | a6d446bce6da7710c6a9432c4167143677f5b726 /app/finders | |
parent | e5fec17b5823511bda9bb1ac0dc64ab9c84a2a2f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/merge_request_target_project_finder.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/finders/merge_request_target_project_finder.rb b/app/finders/merge_request_target_project_finder.rb index fdb3bac8935..ea1aa6d2e9e 100644 --- a/app/finders/merge_request_target_project_finder.rb +++ b/app/finders/merge_request_target_project_finder.rb @@ -11,9 +11,10 @@ class MergeRequestTargetProjectFinder @project_feature = project_feature end - def execute(include_routes: false) + def execute(search: nil, include_routes: false) if source_project.fork_network - include_routes ? projects.inc_routes : projects + items = include_routes ? projects.inc_routes : projects + by_search(items, search) else Project.id_in(source_project.id) end @@ -31,4 +32,10 @@ class MergeRequestTargetProjectFinder .non_archived .with_feature_available_for_user(project_feature, current_user) end + + # rubocop: disable CodeReuse/ActiveRecord + def by_search(items, search) + items.joins(:route).fuzzy_search(search, [Route.arel_table[:path], Route.arel_table[:name], :description]) + end + # rubocop: enable CodeReuse/ActiveRecord end |