Commit 91839e85 authored by Thong Kuah's avatar Thong Kuah

Allow callsite for merge request view

The view was generating a cross-database query. Add a specific allowlist
to this callsite so that we can shrink the spec allowlist (it is being
referenced 3,000 times in CI).
parent 7470746a
......@@ -126,6 +126,10 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
set_pipeline_variables
::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336891') do
@number_of_pipelines = @pipelines.size
end
render
end
......
......@@ -6,7 +6,6 @@
- page_description @merge_request.description_html
- page_card_attributes @merge_request.card_attributes
- suggest_changes_help_path = help_page_path('user/project/merge_requests/reviews/suggestions.md')
- number_of_pipelines = @pipelines.size
- mr_action = j(params[:tab].presence || 'show')
- add_page_specific_style 'page_bundles/merge_requests'
- add_page_specific_style 'page_bundles/pipelines'
......@@ -32,11 +31,11 @@
= tab_link_for @merge_request, :commits do
= _("Commits")
%span.badge.badge-pill.gl-badge.badge-muted.sm= @commits_count
- if number_of_pipelines.nonzero?
- if @number_of_pipelines.nonzero?
= render "projects/merge_requests/tabs/tab", name: "pipelines", class: "pipelines-tab" do
= tab_link_for @merge_request, :pipelines do
= _("Pipelines")
%span.badge.badge-pill.gl-badge.badge-muted.sm.js-pipelines-mr-count= number_of_pipelines
%span.badge.badge-pill.gl-badge.badge-muted.sm.js-pipelines-mr-count= @number_of_pipelines
= render "projects/merge_requests/tabs/tab", name: "diffs", class: "diffs-tab", id: "diffs-tab", qa_selector: "diffs_tab" do
= tab_link_for @merge_request, :diffs do
= _("Changes")
......@@ -76,7 +75,7 @@
= render "projects/merge_requests/tabs/pane", name: "commits", id: "commits", class: "commits" do
-# This tab is always loaded via AJAX
= render "projects/merge_requests/tabs/pane", name: "pipelines", id: "pipelines", class: "pipelines" do
- if number_of_pipelines.nonzero?
- if @number_of_pipelines.nonzero?
= render 'projects/commit/pipelines_list', disable_initialization: true, endpoint: pipelines_project_merge_request_path(@project, @merge_request)
- params = request.query_parameters
- if Feature.enabled?(:default_merge_ref_for_diffs, @project, default_enabled: :yaml)
......
......@@ -183,7 +183,6 @@
- "./spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb"
- "./spec/features/merge_request/user_sees_merge_widget_spec.rb"
- "./spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb"
- "./spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb"
- "./spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb"
- "./spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb"
- "./spec/features/merge_request/user_sees_pipelines_spec.rb"
......
......@@ -16,7 +16,7 @@ RSpec.shared_context 'merge request show action' do
assign(:merge_request, merge_request)
assign(:note, note)
assign(:noteable, merge_request)
assign(:pipelines, [])
assign(:number_of_pipelines, 0)
assign(:issuable_sidebar, serialize_issuable_sidebar(user, project, merge_request))
preload_view_requirements(merge_request, note)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment