diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-30 03:08:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-30 03:08:16 +0300 |
commit | 7b5ff5df506fb54eea0e5d58aadecd0e184ca089 (patch) | |
tree | 8e1748068f8a2c17cb99948f1e2721718f41f0e4 /app/finders | |
parent | ab593c8ded443f7ade3540ff8dac69ee51bc74fd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/clusters/agents_finder.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/finders/clusters/agents_finder.rb b/app/finders/clusters/agents_finder.rb index 8bc78300a44..14277db3f85 100644 --- a/app/finders/clusters/agents_finder.rb +++ b/app/finders/clusters/agents_finder.rb @@ -13,8 +13,7 @@ module Clusters def execute return ::Clusters::Agent.none unless can_read_cluster_agents? - agents = object.cluster_agents - agents = agents.with_name(params[:name]) if params[:name].present? + agents = filter_clusters(object.cluster_agents) agents.ordered_by_name end @@ -23,8 +22,16 @@ module Clusters attr_reader :object, :current_user, :params + def filter_clusters(agents) + agents = agents.with_name(params[:name]) if params[:name].present? + + agents + end + def can_read_cluster_agents? current_user&.can?(:read_cluster, object) end end end + +Clusters::AgentsFinder.prepend_mod_with('Clusters::AgentsFinder') |