Commit 01263b0c authored by Robert Speicher's avatar Robert Speicher

Merge branch '222311-do-not-suggest-pipeline-on-merged' into 'master'

Resolved MRs should not show suggest pipeline popup

See merge request gitlab-org/gitlab!34639
parents 405fd65a 2e7cb7f8
......@@ -95,7 +95,9 @@ class MergeRequestWidgetEntity < Grape::Entity
end
def can_add_ci_config_path?(merge_request)
merge_request.source_project&.uses_default_ci_config? &&
merge_request.open? &&
merge_request.source_branch_exists? &&
merge_request.source_project&.uses_default_ci_config? &&
!merge_request.source_project.has_ci? &&
merge_request.commits_count.positive? &&
can?(current_user, :read_build, merge_request.source_project) &&
......
......@@ -155,6 +155,36 @@ describe MergeRequestWidgetEntity do
expect(subject[:merge_request_add_ci_config_path]).to be_nil
end
end
context 'when merge request is merged' do
before do
resource.mark_as_merged!
end
it 'returns a blank ci config path' do
expect(subject[:merge_request_add_ci_config_path]).to be_nil
end
end
context 'when merge request is closed' do
before do
resource.close!
end
it 'returns a blank ci config path' do
expect(subject[:merge_request_add_ci_config_path]).to be_nil
end
end
context 'when source branch does not exist' do
before do
resource.source_project.repository.rm_branch(user, resource.source_branch)
end
it 'returns a blank ci config path' do
expect(subject[:merge_request_add_ci_config_path]).to be_nil
end
end
end
context 'when user does not have permissions' 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