Merge branch 'ce-10725-restructure-project-merge-request-settings-page' into 'master'

CE Backport for "Restructure project merge request settings page"

See merge request gitlab-org/gitlab-ce!26834
This commit is contained in:
Michael Kozono 2019-04-18 16:46:33 +00:00
commit 9cb136bd18
9 changed files with 136 additions and 101 deletions

View file

@ -0,0 +1,19 @@
- form = local_assigns.fetch(:form)
.form-group
%b= s_('ProjectSettings|Merge checks')
%p.text-secondary= s_('ProjectSettings|These checks must pass before merge requests can be merged')
.form-check.mb-2.builds-feature{ class: ("hidden" if @project && @project.project_feature.send(:builds_access_level) == 0) }
= form.check_box :only_allow_merge_if_pipeline_succeeds, class: 'form-check-input'
= form.label :only_allow_merge_if_pipeline_succeeds, class: 'form-check-label' do
= s_('ProjectSettings|Pipelines must succeed')
.descr.text-secondary
= s_('ProjectSettings|Pipelines need to be configured to enable this feature.')
= link_to icon('question-circle'),
help_page_path('ci/merge_request_pipelines/index.md',
anchor: 'pipelines-for-merge-requests'),
target: '_blank'
.form-check.mb-2
= form.check_box :only_allow_merge_if_all_discussions_are_resolved, class: 'form-check-input'
= form.label :only_allow_merge_if_all_discussions_are_resolved, class: 'form-check-label' do
= s_('ProjectSettings|All discussions must be resolved')

View file

@ -1,30 +1,33 @@
- form = local_assigns.fetch(:form) - form = local_assigns.fetch(:form)
.form-group .form-group
= label_tag :merge_method_merge, class: 'label-bold' do %b= s_('ProjectSettings|Merge method')
= _('Merge method') %p.text-secondary= s_('ProjectSettings|This will dictate the commit history when you merge a merge request')
.form-check .form-check.mb-2
= form.radio_button :merge_method, :merge, class: "js-merge-method-radio form-check-input" = form.radio_button :merge_method, :merge, class: "js-merge-method-radio form-check-input"
= label_tag :project_merge_method_merge, class: 'form-check-label' do = label_tag :project_merge_method_merge, class: 'form-check-label' do
.mb-3 = s_('ProjectSettings|Merge commit')
= _('Merge commit') .descr.text-secondary
.text-secondary = s_('ProjectSettings|Every merge creates a merge commit')
= _('A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.')
.form-check .form-check.mb-2
= form.radio_button :merge_method, :rebase_merge, class: "js-merge-method-radio form-check-input" = form.radio_button :merge_method, :rebase_merge, class: "js-merge-method-radio form-check-input"
= label_tag :project_merge_method_rebase_merge, class: 'form-check-label' do = label_tag :project_merge_method_rebase_merge, class: 'form-check-label' do
.mb-3 = s_('ProjectSettings|Merge commit with semi-linear history')
= _('Merge commit with semi-linear history') .descr.text-secondary
.text-secondary = s_('ProjectSettings|Every merge creates a merge commit')
= _('A merge commit is created for every merge, but merging is only allowed if fast-forward merge is possible. This way you could make sure that if this merge request would build, after merging to target branch it would also build.') %br
.text-secondary = s_('ProjectSettings|Fast-forward merges only')
= _('When fast-forward merge is not possible, the user is given the option to rebase.') %br
= s_('ProjectSettings|When conflicts arise the user is given the option to rebase')
.form-check .form-check.mb-2
= form.radio_button :merge_method, :ff, class: "js-merge-method-radio qa-radio-button-merge-ff form-check-input" = form.radio_button :merge_method, :ff, class: "js-merge-method-radio qa-radio-button-merge-ff form-check-input"
= label_tag :project_merge_method_ff, class: 'form-check-label' do = label_tag :project_merge_method_ff, class: 'form-check-label' do
.mb-3 = s_('ProjectSettings|Fast-forward merge')
= _('Fast-forward merge') .descr.text-secondary
.text-secondary = s_('ProjectSettings|No merge commits are created')
= _('No merge commits are created and all merges are fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded. When fast-forward merge is not possible, the user is given the option to rebase.') %br
= s_('ProjectSettings|Fast-forward merges only')
%br
= s_('ProjectSettings|When conflicts arise the user is given the option to rebase')

View file

@ -0,0 +1,14 @@
- form = local_assigns.fetch(:form)
.form-group
%b= s_('ProjectSettings|Merge options')
%p.text-secondary= s_('ProjectSettings|Additional merge request capabilities that influence how and when merges will be performed')
= render_if_exists 'projects/merge_pipelines_settings', form: form
.form-check.mb-2
= form.check_box :resolve_outdated_diff_discussions, class: 'form-check-input'
= form.label :resolve_outdated_diff_discussions, class: 'form-check-label' do
= s_('ProjectSettings|Automatically resolve merge request diff discussions when they become outdated')
.form-check.mb-2
= form.check_box :printing_merge_request_link_enabled, class: 'form-check-input'
= form.label :printing_merge_request_link_enabled, class: 'form-check-label' do
= s_('ProjectSettings|Show link to create/view merge request when pushing from the command line')

View file

@ -1,24 +0,0 @@
- form = local_assigns.fetch(:form)
.form-group
.form-check.builds-feature{ class: ("hidden" if @project && @project.project_feature.send(:builds_access_level) == 0) }
= form.check_box :only_allow_merge_if_pipeline_succeeds, class: 'form-check-input'
= form.label :only_allow_merge_if_pipeline_succeeds, class: 'form-check-label' do
.mb-3
= _('Only allow merge requests to be merged if the pipeline succeeds')
.text-secondary
= _('Pipelines need to be configured to enable this feature.')
= link_to icon('question-circle'), help_page_path('user/project/merge_requests/merge_when_pipeline_succeeds', anchor: 'only-allow-merge-requests-to-be-merged-if-the-pipeline-succeeds'), target: '_blank'
= render_if_exists 'projects/merge_pipelines_settings', form: form
.form-check
= form.check_box :only_allow_merge_if_all_discussions_are_resolved, class: 'form-check-input'
= form.label :only_allow_merge_if_all_discussions_are_resolved, class: 'form-check-label' do
%p= _('Only allow merge requests to be merged if all discussions are resolved')
.form-check
= form.check_box :resolve_outdated_diff_discussions, class: 'form-check-input'
= form.label :resolve_outdated_diff_discussions, class: 'form-check-label' do
%p= _('Automatically resolve merge request diff discussions when they become outdated')
.form-check
= form.check_box :printing_merge_request_link_enabled, class: 'form-check-input'
= form.label :printing_merge_request_link_enabled, class: 'form-check-label' do
%p= _('Show link to create/view merge request when pushing from the command line')

View file

@ -2,4 +2,6 @@
= render 'projects/merge_request_merge_method_settings', project: @project, form: form = render 'projects/merge_request_merge_method_settings', project: @project, form: form
= render 'projects/merge_request_merge_settings', form: form = render 'projects/merge_request_merge_options_settings', project: @project, form: form
= render 'projects/merge_request_merge_checks_settings', project: @project, form: form

View file

@ -27,7 +27,7 @@
.settings-header .settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Merge requests') %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Merge requests')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand') %button.btn.btn-default.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand')
%p= _('Choose your merge method, set up a default merge request description template.') %p= _('Choose your merge method, options, checks, and set up a default merge request description template.')
.settings-content .settings-content
= render_if_exists 'shared/promotions/promote_mr_features' = render_if_exists 'shared/promotions/promote_mr_features'

View file

@ -0,0 +1,5 @@
---
title: Reorganize project merge request settings
merge_request: 26834
author:
type: changed

View file

@ -375,12 +375,6 @@ msgstr ""
msgid "A member of GitLab's abuse team will review your report as soon as possible." msgid "A member of GitLab's abuse team will review your report as soon as possible."
msgstr "" msgstr ""
msgid "A merge commit is created for every merge, and merging is allowed as long as there are no conflicts."
msgstr ""
msgid "A merge commit is created for every merge, but merging is only allowed if fast-forward merge is possible. This way you could make sure that if this merge request would build, after merging to target branch it would also build."
msgstr ""
msgid "A new branch will be created in your fork and a new merge request will be started." msgid "A new branch will be created in your fork and a new merge request will be started."
msgstr "" msgstr ""
@ -1173,9 +1167,6 @@ msgstr ""
msgid "Automatically marked as default internal user" msgid "Automatically marked as default internal user"
msgstr "" msgstr ""
msgid "Automatically resolve merge request diff discussions when they become outdated"
msgstr ""
msgid "Automatically resolved" msgid "Automatically resolved"
msgstr "" msgstr ""
@ -1722,7 +1713,7 @@ msgstr ""
msgid "Choose visibility level, enable/disable project features (issues, repository, wiki, snippets) and set permissions." msgid "Choose visibility level, enable/disable project features (issues, repository, wiki, snippets) and set permissions."
msgstr "" msgstr ""
msgid "Choose your merge method, set up a default merge request description template." msgid "Choose your merge method, options, checks, and set up a default merge request description template."
msgstr "" msgstr ""
msgid "CiStatusLabel|canceled" msgid "CiStatusLabel|canceled"
@ -4003,9 +3994,6 @@ msgstr ""
msgid "Failure" msgid "Failure"
msgstr "" msgstr ""
msgid "Fast-forward merge"
msgstr ""
msgid "Fast-forward merge without a merge commit" msgid "Fast-forward merge without a merge commit"
msgstr "" msgstr ""
@ -5508,15 +5496,9 @@ msgstr ""
msgid "Merge Requests" msgid "Merge Requests"
msgstr "" msgstr ""
msgid "Merge commit"
msgstr ""
msgid "Merge commit message" msgid "Merge commit message"
msgstr "" msgstr ""
msgid "Merge commit with semi-linear history"
msgstr ""
msgid "Merge events" msgid "Merge events"
msgstr "" msgstr ""
@ -5526,9 +5508,6 @@ msgstr ""
msgid "Merge in progress" msgid "Merge in progress"
msgstr "" msgstr ""
msgid "Merge method"
msgstr ""
msgid "Merge request" msgid "Merge request"
msgstr "" msgstr ""
@ -5993,9 +5972,6 @@ msgstr ""
msgid "No license. All rights reserved" msgid "No license. All rights reserved"
msgstr "" msgstr ""
msgid "No merge commits are created and all merges are fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded. When fast-forward merge is not possible, the user is given the option to rebase."
msgstr ""
msgid "No merge requests found" msgid "No merge requests found"
msgstr "" msgstr ""
@ -6190,12 +6166,6 @@ msgstr ""
msgid "Only admins" msgid "Only admins"
msgstr "" msgstr ""
msgid "Only allow merge requests to be merged if all discussions are resolved"
msgstr ""
msgid "Only allow merge requests to be merged if the pipeline succeeds"
msgstr ""
msgid "Only mirror protected branches" msgid "Only mirror protected branches"
msgstr "" msgstr ""
@ -6460,9 +6430,6 @@ msgstr ""
msgid "Pipelines for last year" msgid "Pipelines for last year"
msgstr "" msgstr ""
msgid "Pipelines need to be configured to enable this feature."
msgstr ""
msgid "Pipelines settings for '%{project_name}' were successfully updated." msgid "Pipelines settings for '%{project_name}' were successfully updated."
msgstr "" msgstr ""
@ -7096,15 +7063,69 @@ msgstr ""
msgid "ProjectPage|Project ID: %{project_id}" msgid "ProjectPage|Project ID: %{project_id}"
msgstr "" msgstr ""
msgid "ProjectSettings|Additional merge request capabilities that influence how and when merges will be performed"
msgstr ""
msgid "ProjectSettings|All discussions must be resolved"
msgstr ""
msgid "ProjectSettings|Automatically resolve merge request diff discussions when they become outdated"
msgstr ""
msgid "ProjectSettings|Badges" msgid "ProjectSettings|Badges"
msgstr "" msgstr ""
msgid "ProjectSettings|Customize your project badges." msgid "ProjectSettings|Customize your project badges."
msgstr "" msgstr ""
msgid "ProjectSettings|Every merge creates a merge commit"
msgstr ""
msgid "ProjectSettings|Fast-forward merge"
msgstr ""
msgid "ProjectSettings|Fast-forward merges only"
msgstr ""
msgid "ProjectSettings|Learn more about badges." msgid "ProjectSettings|Learn more about badges."
msgstr "" msgstr ""
msgid "ProjectSettings|Merge checks"
msgstr ""
msgid "ProjectSettings|Merge commit"
msgstr ""
msgid "ProjectSettings|Merge commit with semi-linear history"
msgstr ""
msgid "ProjectSettings|Merge method"
msgstr ""
msgid "ProjectSettings|Merge options"
msgstr ""
msgid "ProjectSettings|No merge commits are created"
msgstr ""
msgid "ProjectSettings|Pipelines must succeed"
msgstr ""
msgid "ProjectSettings|Pipelines need to be configured to enable this feature."
msgstr ""
msgid "ProjectSettings|Show link to create/view merge request when pushing from the command line"
msgstr ""
msgid "ProjectSettings|These checks must pass before merge requests can be merged"
msgstr ""
msgid "ProjectSettings|This will dictate the commit history when you merge a merge request"
msgstr ""
msgid "ProjectSettings|When conflicts arise the user is given the option to rebase"
msgstr ""
msgid "Projects" msgid "Projects"
msgstr "" msgstr ""
@ -8147,9 +8168,6 @@ msgstr ""
msgid "Show latest version" msgid "Show latest version"
msgstr "" msgstr ""
msgid "Show link to create/view merge request when pushing from the command line"
msgstr ""
msgid "Show parent pages" msgid "Show parent pages"
msgstr "" msgstr ""
@ -10168,9 +10186,6 @@ msgstr ""
msgid "When enabled, users cannot use GitLab until the terms have been accepted." msgid "When enabled, users cannot use GitLab until the terms have been accepted."
msgstr "" msgstr ""
msgid "When fast-forward merge is not possible, the user is given the option to rebase."
msgstr ""
msgid "When leaving the URL blank, classification labels can still be specified without disabling cross project features or performing external authorization checks." msgid "When leaving the URL blank, classification labels can still be specified without disabling cross project features or performing external authorization checks."
msgstr "" msgstr ""

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe 'Projects > Settings > User manages merge request settings' do describe 'Projects > Settings > User manages merge request settings' do
@ -30,16 +31,16 @@ describe 'Projects > Settings > User manages merge request settings' do
context 'when Merge Request and Pipelines are initially enabled', :js do context 'when Merge Request and Pipelines are initially enabled', :js do
context 'when Pipelines are initially enabled' do context 'when Pipelines are initially enabled' do
it 'shows the Merge Requests settings' do it 'shows the Merge Requests settings' do
expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).to have_content 'Pipelines must succeed'
expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).to have_content 'All discussions must be resolved'
within('.sharing-permissions-form') do within('.sharing-permissions-form') do
find('.project-feature-controls[data-for="project[project_feature_attributes][merge_requests_access_level]"] .project-feature-toggle').click find('.project-feature-controls[data-for="project[project_feature_attributes][merge_requests_access_level]"] .project-feature-toggle').click
find('input[value="Save changes"]').send_keys(:return) find('input[value="Save changes"]').send_keys(:return)
end end
expect(page).not_to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).not_to have_content 'Pipelines must succeed'
expect(page).not_to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).not_to have_content 'All discussions must be resolved'
end end
end end
@ -50,16 +51,16 @@ describe 'Projects > Settings > User manages merge request settings' do
end end
it 'shows the Merge Requests settings that do not depend on Builds feature' do it 'shows the Merge Requests settings that do not depend on Builds feature' do
expect(page).not_to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).not_to have_content 'Pipelines must succeed'
expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).to have_content 'All discussions must be resolved'
within('.sharing-permissions-form') do within('.sharing-permissions-form') do
find('.project-feature-controls[data-for="project[project_feature_attributes][builds_access_level]"] .project-feature-toggle').click find('.project-feature-controls[data-for="project[project_feature_attributes][builds_access_level]"] .project-feature-toggle').click
find('input[value="Save changes"]').send_keys(:return) find('input[value="Save changes"]').send_keys(:return)
end end
expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).to have_content 'Pipelines must succeed'
expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).to have_content 'All discussions must be resolved'
end end
end end
end end
@ -71,16 +72,16 @@ describe 'Projects > Settings > User manages merge request settings' do
end end
it 'does not show the Merge Requests settings' do it 'does not show the Merge Requests settings' do
expect(page).not_to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).not_to have_content 'Pipelines must succeed'
expect(page).not_to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).not_to have_content 'All discussions must be resolved'
within('.sharing-permissions-form') do within('.sharing-permissions-form') do
find('.project-feature-controls[data-for="project[project_feature_attributes][merge_requests_access_level]"] .project-feature-toggle').click find('.project-feature-controls[data-for="project[project_feature_attributes][merge_requests_access_level]"] .project-feature-toggle').click
find('input[value="Save changes"]').send_keys(:return) find('input[value="Save changes"]').send_keys(:return)
end end
expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).to have_content 'Pipelines must succeed'
expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).to have_content 'All discussions must be resolved'
end end
end end