Commit 6af07421 authored by Igor Drozdov's avatar Igor Drozdov

Move merge-request merge_pipeline to cached_widget

Remove merge_request_cached_merge_pipeline_serializer FF

The FF has been enabled by default for some time
We can remove it

Changelog: performance
parent 398e4a87
......@@ -50,11 +50,7 @@ class MergeRequestPollCachedWidgetEntity < IssuableEntity
MergeRequests::PipelineEntity.represent(merge_request.actual_head_pipeline, options)
end
expose :merge_pipeline, if: ->(mr, _) {
Feature.enabled?(:merge_request_cached_merge_pipeline_serializer, mr.project, default_enabled: :yaml) &&
mr.merged? &&
can?(request.current_user, :read_pipeline, mr.target_project)
} do |merge_request, options|
expose :merge_pipeline, if: ->(mr, _) { mr.merged? && can?(request.current_user, :read_pipeline, mr.target_project) } do |merge_request, options|
MergeRequests::PipelineEntity.represent(merge_request.merge_pipeline, options)
end
......
......@@ -19,14 +19,6 @@ class MergeRequestPollWidgetEntity < Grape::Entity
# User entities
expose :merge_user, using: UserEntity
expose :merge_pipeline, if: ->(mr, _) {
Feature.disabled?(:merge_request_cached_merge_pipeline_serializer, mr.project, default_enabled: :yaml) &&
mr.merged? &&
can?(request.current_user, :read_pipeline, mr.target_project)
} do |merge_request, options|
MergeRequests::PipelineEntity.represent(merge_request.merge_pipeline, options)
end
expose :default_merge_commit_message
expose :mergeable do |merge_request, options|
......
---
name: merge_request_cached_merge_pipeline_serializer
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57827
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326317
milestone: '13.11'
type: development
group: group::source code
default_enabled: false
......@@ -302,16 +302,6 @@ RSpec.describe MergeRequestPollCachedWidgetEntity do
expect(subject[:merge_pipeline]).to be_nil
end
end
context 'when merge_request_cached_merge_pipeline_serializer is disabled' do
before do
stub_feature_flags(merge_request_cached_merge_pipeline_serializer: false)
end
it 'returns nil' do
expect(subject[:merge_pipeline]).to be_nil
end
end
end
end
......
......@@ -22,54 +22,6 @@ RSpec.describe MergeRequestPollWidgetEntity do
.to eq(resource.default_merge_commit_message(include_description: true))
end
describe 'merge_pipeline' do
before do
stub_feature_flags(merge_request_cached_merge_pipeline_serializer: false)
end
it 'returns nil' do
expect(subject[:merge_pipeline]).to be_nil
end
context 'when is merged' do
let_it_be(:resource) { create(:merged_merge_request, source_project: project, merge_commit_sha: project.commit.id) }
let_it_be(:pipeline) { create(:ci_empty_pipeline, project: project, ref: resource.target_branch, sha: resource.merge_commit_sha) }
before do
project.add_maintainer(user)
end
context 'when user cannot read pipelines on target project' do
before do
project.team.truncate
end
it 'returns nil' do
expect(subject[:merge_pipeline]).to be_nil
end
end
it 'returns merge_pipeline' do
pipeline_payload =
MergeRequests::PipelineEntity
.represent(pipeline, request: request)
.as_json
expect(subject[:merge_pipeline]).to eq(pipeline_payload)
end
context 'when merge_request_cached_merge_pipeline_serializer is enabled' do
before do
stub_feature_flags(merge_request_cached_merge_pipeline_serializer: true)
end
it 'returns nil' do
expect(subject[:merge_pipeline]).to be_nil
end
end
end
end
describe 'new_blob_path' do
context 'when user can push to project' do
it 'returns path' do
......
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