diff options
Diffstat (limited to 'app/finders/merge_request_target_project_finder.rb')
-rw-r--r-- | app/finders/merge_request_target_project_finder.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/finders/merge_request_target_project_finder.rb b/app/finders/merge_request_target_project_finder.rb index 85a73e0c6ff..dc9b28ab0a0 100644 --- a/app/finders/merge_request_target_project_finder.rb +++ b/app/finders/merge_request_target_project_finder.rb @@ -5,29 +5,30 @@ class MergeRequestTargetProjectFinder attr_reader :current_user, :source_project - def initialize(current_user: nil, source_project:) + def initialize(current_user: nil, source_project:, project_feature: :merge_requests) @current_user = current_user @source_project = source_project + @project_feature = project_feature end - # rubocop: disable CodeReuse/ActiveRecord def execute(include_routes: false) if source_project.fork_network include_routes ? projects.inc_routes : projects else - Project.where(id: source_project) + Project.id_in(source_project.id) end end - # rubocop: enable CodeReuse/ActiveRecord private + attr_reader :project_feature + def projects source_project .fork_network .projects .public_or_visible_to_user(current_user) .non_archived - .with_feature_available_for_user(:merge_requests, current_user) + .with_feature_available_for_user(project_feature, current_user) end end |