diff options
Diffstat (limited to 'app/controllers/projects/branches_controller.rb')
-rw-r--r-- | app/controllers/projects/branches_controller.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 1e17dd586c7..e60544129ff 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -27,6 +27,7 @@ class Projects::BranchesController < Projects::ApplicationController # Fetch branches for the specified mode fetch_branches_by_mode + fetch_merge_requests_for_branches @refs_pipelines = @project.ci_pipelines.latest_successful_for_refs(@branches.map(&:name)) @merged_branch_names = repository.merged_branch_names(@branches.map(&:name)) @@ -199,6 +200,15 @@ class Projects::BranchesController < Projects::ApplicationController Projects::BranchesByModeService.new(@project, params.merge(sort: @sort, mode: @mode)).execute end + def fetch_merge_requests_for_branches + @related_merge_requests = @project + .source_of_merge_requests + .including_target_project + .by_target_branch(@project.default_branch) + .by_sorted_source_branches(@branches.map(&:name)) + .group_by(&:source_branch) + end + def fetch_branches_for_overview # Here we get one more branch to indicate if there are more data we're not showing limit = @overview_max_branches + 1 |