Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-11-09 09:08:59 +00:00
parent 4bfebcc481
commit 079ad2772f
12 changed files with 73 additions and 53 deletions

View file

@ -151,6 +151,10 @@ class MergeRequestWidgetEntity < Grape::Entity
can?(current_user, :create_pipeline, merge_request.source_project)
end
def use_merge_base_with_merged_results?
object.actual_head_pipeline&.merge_request_event_type == :merged_result
end
def head_pipeline_downloadable_path_for_report_type(file_type)
object.head_pipeline&.present(current_user: current_user)
&.downloadable_path_for_report_type(file_type)
@ -161,11 +165,6 @@ class MergeRequestWidgetEntity < Grape::Entity
&.downloadable_path_for_report_type(file_type)
end
def use_merge_base_with_merged_results?
Feature.enabled?(:merge_base_pipelines, object.target_project) &&
object.actual_head_pipeline&.merge_request_event_type == :merged_result
end
def merge_base_pipeline_downloadable_path_for_report_type(file_type)
object.merge_base_pipeline&.present(current_user: current_user)
&.downloadable_path_for_report_type(file_type)

View file

@ -41,7 +41,7 @@
- if can_reopen_merge_request
%li{ class: merge_request_button_visibility(@merge_request, false) }
= link_to 'Reopen', merge_request_path(@merge_request, merge_request: { state_event: :reopen }), method: :put, class: 'reopen-mr-link', title: 'Reopen merge request'
- unless current_user == @merge_request.author
- unless @merge_request.merged? || current_user == @merge_request.author
%li= link_to 'Report abuse', new_abuse_report_path(user_id: @merge_request.author.id, ref_url: merge_request_url(@merge_request))
- if can_update_merge_request

View file

@ -21,5 +21,6 @@
- else
= render 'shared/issuable/close_reopen_report_toggle', issuable: issuable, warn_before_close: add_blocked_class
- else
= link_to _('Report abuse'), new_abuse_report_path(user_id: issuable.author.id, ref_url: issuable_url(issuable)),
class: 'd-none d-md-block btn btn-grouped btn-close-color', title: _('Report abuse')
- unless issuable.is_a?(MergeRequest) && issuable.merged?
= link_to _('Report abuse'), new_abuse_report_path(user_id: issuable.author.id, ref_url: issuable_url(issuable)),
class: 'd-none d-md-block btn btn-grouped btn-close-color', title: _('Report abuse')

View file

@ -0,0 +1,5 @@
---
title: Remove "Report abuse" button from a merged Merge Request
merge_request: 46031
author: Takuya Noguchi
type: fixed

View file

@ -0,0 +1,5 @@
---
title: Use updated base report for CodeQuality MergeRequest widdget
merge_request: 46384
author:
type: changed

View file

@ -1,7 +0,0 @@
---
name: merge_base_pipelines
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44648
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/263724
type: development
group: group::testing
default_enabled: false

View file

@ -1,7 +1,7 @@
---
# Error: gitlab.AlertBoxCaution
#
# Makes sure DANGER: alert boxes follow standard formatting.
# Makes sure CAUTION: alert boxes follow standard formatting.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: substitution

View file

@ -1,7 +1,7 @@
---
# Warning: gitlab.CurlStringsQuoted
#
# Ensures all codeblocks using curl quote any URL strings.
# Ensures all code blocks using curl quote any URL strings.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence

View file

@ -1,8 +1,17 @@
---
# Error: gitlab.VersionText
#
# Checks for use of some of the top misused terms at GitLab.
# For substitutions only flagged as warnings, see SubstitutionWarning.yml
# Checks that version text is formatted correctly.
#
# Specifically looks for either of the following that is immediately followed on the next line
# by content, which will break rendering:
#
# - `> Introduced` (version text without a link)
# - `> [Introduced` (version text with a link)
#
# Because it excludes `-`, it doesn't look for multi-line version text, for which content
# immediately on the next line is ok. However, this will often highlight where multi-line version
# text is attempted without `-` characters.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence

View file

@ -4853,9 +4853,6 @@ msgstr ""
msgid "Cannot enable shared runners because parent group does not allow it"
msgstr ""
msgid "Cannot find user key."
msgstr ""
msgid "Cannot have multiple Jira imports running at the same time"
msgstr ""

View file

@ -105,6 +105,7 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
end
context 'on a merge request' do
let(:container) { find('.detail-page-header-actions') }
let(:project) { create(:project, :repository) }
let(:issuable) { create(:merge_request, source_project: project) }
@ -120,24 +121,47 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
it_behaves_like 'an issuable close/reopen/report toggle'
context 'when the merge request is closed' do
let(:issuable) { create(:merge_request, :closed, source_project: project) }
it 'shows both the `Edit` and `Reopen` button' do
expect(container).to have_link('Edit')
expect(container).not_to have_button('Report abuse')
expect(container).not_to have_button('Close merge request')
expect(container).to have_link('Reopen merge request')
end
context 'when the merge request author is the current user' do
let(:issuable) { create(:merge_request, :closed, source_project: project, author: user) }
it 'shows both the `Edit` and `Reopen` button' do
expect(container).to have_link('Edit')
expect(container).not_to have_link('Report abuse')
expect(container).not_to have_selector('button.dropdown-toggle')
expect(container).not_to have_button('Close merge request')
expect(container).to have_link('Reopen merge request')
end
end
end
context 'when the merge request is merged' do
let(:issuable) { create(:merge_request, :merged, source_project: project) }
it 'shows only the `Report abuse` and `Edit` button' do
expect(page).to have_link('Report abuse')
expect(page).to have_link(exact_text: 'Edit')
expect(page).not_to have_button('Close merge request')
expect(page).not_to have_button('Reopen merge request')
it 'shows only the `Edit` button' do
expect(container).to have_link(exact_text: 'Edit')
expect(container).not_to have_link('Report abuse')
expect(container).not_to have_button('Close merge request')
expect(container).not_to have_button('Reopen merge request')
end
context 'when the merge request author is the current user' do
let(:issuable) { create(:merge_request, :merged, source_project: project, author: user) }
it 'shows only the `Edit` button' do
expect(page).to have_link('Report abuse')
expect(page).to have_link(exact_text: 'Edit')
expect(page).not_to have_button('Close merge request')
expect(page).not_to have_button('Reopen merge request')
expect(container).to have_link(exact_text: 'Edit')
expect(container).not_to have_link('Report abuse')
expect(container).not_to have_button('Close merge request')
expect(container).not_to have_button('Reopen merge request')
end
end
end
@ -154,10 +178,10 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
end
it 'only shows a `Report abuse` button' do
expect(page).to have_link('Report abuse')
expect(page).not_to have_button('Close merge request')
expect(page).not_to have_button('Reopen merge request')
expect(page).not_to have_link(exact_text: 'Edit')
expect(container).to have_link('Report abuse')
expect(container).not_to have_button('Close merge request')
expect(container).not_to have_button('Reopen merge request')
expect(container).not_to have_link(exact_text: 'Edit')
end
end
end

View file

@ -106,29 +106,16 @@ RSpec.describe MergeRequestWidgetEntity do
let(:merge_base_job_id) { merge_base_pipeline.builds.first.id }
it 'has head_path and base_path entries' do
expect(subject[:codeclimate][:head_path]).to be_present
expect(subject[:codeclimate][:base_path]).to be_present
expect(subject[:codeclimate][:head_path]).to include("/jobs/#{generic_job_id}/artifacts/download?file_type=codequality")
expect(subject[:codeclimate][:base_path]).to include("/jobs/#{generic_job_id}/artifacts/download?file_type=codequality")
end
context 'on pipelines for merged results' do
let(:pipeline) { create(:ci_pipeline, :merged_result_pipeline, :with_codequality_report, project: project) }
context 'with merge_base_pipelines enabled' do
it 'returns URLs from the head_pipeline and merge_base_pipeline' do
expect(subject[:codeclimate][:head_path]).to include("/jobs/#{generic_job_id}/artifacts/download?file_type=codequality")
expect(subject[:codeclimate][:base_path]).to include("/jobs/#{merge_base_job_id}/artifacts/download?file_type=codequality")
end
end
context 'with merge_base_pipelines disabled' do
before do
stub_feature_flags(merge_base_pipelines: false)
end
it 'returns URLs from the head_pipeline and base_pipeline' do
expect(subject[:codeclimate][:head_path]).to include("/jobs/#{generic_job_id}/artifacts/download?file_type=codequality")
expect(subject[:codeclimate][:base_path]).to include("/jobs/#{generic_job_id}/artifacts/download?file_type=codequality")
end
it 'returns URLs from the head_pipeline and merge_base_pipeline' do
expect(subject[:codeclimate][:head_path]).to include("/jobs/#{generic_job_id}/artifacts/download?file_type=codequality")
expect(subject[:codeclimate][:base_path]).to include("/jobs/#{merge_base_job_id}/artifacts/download?file_type=codequality")
end
end
end