Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-05-27 00:10:40 +00:00
parent 84d72a5660
commit 969309e2bd
25 changed files with 265 additions and 122 deletions

View file

@ -54,8 +54,6 @@ docs-lint links:
extends:
- .docs:rules:docs-lint
image: registry.gitlab.com/gitlab-org/gitlab-docs/lint-html:alpine-3.13-ruby-2.7.2
# TODO: revert to .default-retry when https://gitlab.com/gitlab-org/gitlab/-/issues/331002 is fixed.
retry: 2
stage: test
needs: []
script:

View file

@ -0,0 +1,55 @@
<script>
import importGroupIllustration from '@gitlab/svgs/dist/illustrations/group-import.svg';
import newGroupIllustration from '@gitlab/svgs/dist/illustrations/group-new.svg';
import { s__ } from '~/locale';
import NewNamespacePage from '~/vue_shared/new_namespace/new_namespace_page.vue';
import createGroupDescriptionDetails from './create_group_description_details.vue';
const PANELS = [
{
name: 'create-group-pane',
selector: '#create-group-pane',
title: s__('GroupsNew|Create group'),
description: s__(
'GroupsNew|Assemble related projects together and grant members access to several projects at once.',
),
illustration: newGroupIllustration,
details: createGroupDescriptionDetails,
},
{
name: 'import-group-pane',
selector: '#import-group-pane',
title: s__('GroupsNew|Import group'),
description: s__(
'GroupsNew|Export groups with all their related data and move to a new GitLab instance.',
),
illustration: importGroupIllustration,
details: 'Migrate your existing groups from another instance of GitLab.',
},
];
export default {
components: {
NewNamespacePage,
},
props: {
hasErrors: {
type: Boolean,
required: false,
default: false,
},
},
PANELS,
};
</script>
<template>
<new-namespace-page
:jump-to-last-persisted-panel="hasErrors"
:initial-breadcrumb="s__('New group')"
:panels="$options.PANELS"
:title="s__('GroupsNew|Create new group')"
persistence-key="new_group_last_active_tab"
/>
</template>

View file

@ -0,0 +1,44 @@
<script>
import { GlSprintf, GlLink } from '@gitlab/ui';
import { helpPagePath } from '~/helpers/help_page_helper';
export default {
components: {
GlLink,
GlSprintf,
},
paths: {
groupsHelpPath: helpPagePath('user/group/index'),
subgroupsHelpPath: helpPagePath('user/group/subgroups/index'),
},
};
</script>
<template>
<div>
<p>
<gl-sprintf
:message="
s__(
'GroupsNew|%{linkStart}Groups%{linkEnd} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects. Groups can also be nested by creating subgroups.',
)
"
>
<template #link="{ content }">
<gl-link :href="$options.paths.groupsHelpPath" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
</p>
<p>
<gl-sprintf
:message="
s__('GroupsNew|Groups can also be nested by creating %{linkStart}subgroups%{linkEnd}.')
"
>
<template #link="{ content }">
<gl-link :href="$options.paths.subgroupsHelpPath" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
</p>
</div>
</template>

View file

@ -1,8 +1,9 @@
import $ from 'jquery';
import Vue from 'vue';
import BindInOut from '~/behaviors/bind_in_out';
import initFilePickers from '~/file_pickers';
import Group from '~/group';
import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
import { parseBoolean } from '~/lib/utils/common_utils';
import NewGroupCreationApp from './components/app.vue';
import GroupPathValidator from './group_path_validator';
new GroupPathValidator(); // eslint-disable-line no-new
@ -12,15 +13,21 @@ initFilePickers();
new Group(); // eslint-disable-line no-new
const CONTAINER_SELECTOR = '.group-edit-container .nav-tabs';
const DEFAULT_ACTION = '#create-group-pane';
// eslint-disable-next-line no-new
new LinkedTabs({
defaultAction: DEFAULT_ACTION,
parentEl: CONTAINER_SELECTOR,
hashedTabs: true,
});
function initNewGroupCreation(el) {
const { hasErrors } = el.dataset;
if (window.location.hash) {
$(CONTAINER_SELECTOR).find(`a[href="${window.location.hash}"]`).tab('show');
const props = {
hasErrors: parseBoolean(hasErrors),
};
return new Vue({
el,
render(h) {
return h(NewGroupCreationApp, { props });
},
});
}
const el = document.querySelector('.js-new-group-creation');
initNewGroupCreation(el);

View file

@ -129,7 +129,7 @@ export default {
<gl-icon name="chevron-right" :size="8" />
</template>
</gl-breadcrumb>
<legacy-container :key="activePanel.name" class="gl-mt-3" :selector="activePanel.selector" />
<legacy-container :key="activePanel.name" :selector="activePanel.selector" />
</div>
</div>
</template>

View file

@ -49,7 +49,7 @@ module MergeRequests
#
if merge_request.previous_changes.include?('target_branch') ||
merge_request.previous_changes.include?('source_branch')
merge_request.mark_as_unchecked
merge_request.mark_as_unchecked unless merge_request.unchecked?
end
end

View file

@ -22,6 +22,6 @@
.col-sm-4
= recaptcha_tags
.row
.form-actions.col-sm-12
.col-sm-12
= f.submit _('Create group'), class: "btn gl-button btn-confirm"
= link_to _('Cancel'), dashboard_groups_path, class: 'btn gl-button btn-default btn-cancel'

View file

@ -2,47 +2,24 @@
- @hide_top_links = true
- page_title _('New Group')
- header_title _("Groups"), dashboard_groups_path
- active_tab = local_assigns.fetch(:active_tab, 'create')
- add_page_specific_style 'page_bundles/new_namespace'
.group-edit-container.gl-mt-3
.row
.col-lg-3.group-settings-sidebar
%h4.prepend-top-0
= _('New group')
%p
- group_docs_path = help_page_path('user/group/index')
- group_docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: group_docs_path }
= s_('%{group_docs_link_start}Groups%{group_docs_link_end} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects.').html_safe % { group_docs_link_start: group_docs_link_start, group_docs_link_end: '</a>'.html_safe }
%p
- subgroup_docs_path = help_page_path('user/group/subgroups/index')
- subgroup_docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: subgroup_docs_path }
= s_('Groups can also be nested by creating %{subgroup_docs_link_start}subgroups%{subgroup_docs_link_end}.').html_safe % { subgroup_docs_link_start: subgroup_docs_link_start, subgroup_docs_link_end: '</a>'.html_safe }
%p
= _('Projects that belong to a group are prefixed with the group namespace. Existing projects may be moved into a group.')
.group-edit-container.gl-mt-5
.col-lg-9.js-toggle-container
%ul.nav.nav-tabs.nav-links.gitlab-tabs{ role: 'tablist' }
%li.nav-item{ role: 'presentation' }
%a.nav-link.active{ href: '#create-group-pane', id: 'create-group-tab', role: 'tab', data: { toggle: 'tab', track_label: 'create_group', track_event: 'click_tab', track_value: '' } }
%span.d-none.d-sm-block= s_('GroupsNew|Create group')
%span.d-block.d-sm-none= s_('GroupsNew|Create')
%li.nav-item{ role: 'presentation' }
%a.nav-link{ href: '#import-group-pane', id: 'import-group-tab', role: 'tab', data: { toggle: 'tab', track_label: 'import_group', track_event: 'click_tab', track_value: '' } }
%span.d-none.d-sm-block= s_('GroupsNew|Import group')
%span.d-block.d-sm-none= s_('GroupsNew|Import')
.js-new-group-creation{ data: { has_errors: @group.errors.any?.to_s } }
.tab-content.gitlab-tab-content.gl-border-none
.tab-pane.js-toggle-container{ id: 'create-group-pane', class: active_when(active_tab == 'create'), role: 'tabpanel' }
= form_for @group, html: { class: 'group-form gl-show-field-errors' } do |f|
= render 'new_group_fields', f: f, group_name_id: 'create-group-name'
.row{ 'v-cloak': true }
#create-group-pane.tab-pane
= form_for @group, html: { class: 'group-form gl-show-field-errors' } do |f|
= render 'new_group_fields', f: f, group_name_id: 'create-group-name'
.tab-pane.no-padding.js-toggle-container{ id: 'import-group-pane', class: active_when(active_tab) == 'import', role: 'tabpanel' }
- if import_sources_enabled?
- if Feature.enabled?(:bulk_import)
= render 'import_group_from_another_instance_panel'
.gl-mt-7.gl-border-b-solid.gl-border-gray-100.gl-border-1
= render 'import_group_from_file_panel'
- else
.nothing-here-block
%h4= s_('GroupsNew|No import options available')
%p= s_('GroupsNew|Contact an administrator to enable options for importing your group.')
#import-group-pane.tab-pane
- if import_sources_enabled?
- if Feature.enabled?(:bulk_import)
= render 'import_group_from_another_instance_panel'
.gl-mt-7.gl-border-b-solid.gl-border-gray-100.gl-border-1
= render 'import_group_from_file_panel'
- else
.nothing-here-block
%h4= s_('GroupsNew|No import options available')
%p= s_('GroupsNew|Contact an administrator to enable options for importing your group.')

View file

@ -1,15 +1,14 @@
- return unless show_registration_enabled_user_callout?
%div{ class: [container_class, @content_class, 'gl-pt-5!'] }
.gl-alert.gl-alert-warning.js-registration-enabled-callout{ role: 'alert', data: { feature_id: UserCalloutsHelper::REGISTRATION_ENABLED_CALLOUT, dismiss_endpoint: user_callouts_path } }
= sprite_icon('warning', size: 16, css_class: 'gl-alert-icon')
%button.gl-alert-dismiss.js-close{ type: 'button', aria: { label: _('Close') }, data: { testid: 'close-registration-enabled-callout' } }
= sprite_icon('close', size: 16)
.gl-alert-title
= _('Open registration is enabled on your instance.')
.gl-alert-body
= html_escape(_('%{anchorOpen}Learn more%{anchorClose} about how you can customize / disable registration on your instance.')) % { anchorOpen: "<a href=\"#{help_page_path('user/admin_area/settings/sign_up_restrictions')}\">".html_safe, anchorClose: '</a>'.html_safe }
.gl-alert-actions
= link_to general_admin_application_settings_path(anchor: 'js-signup-settings'), class: 'btn gl-alert-action btn-info btn-md gl-button' do
%span.gl-button-text
= _('View setting')
= render 'shared/global_alert',
title: _('Open registration is enabled on your instance.'),
variant: :warning,
alert_class: 'js-registration-enabled-callout',
alert_data: { feature_id: UserCalloutsHelper::REGISTRATION_ENABLED_CALLOUT, dismiss_endpoint: user_callouts_path },
close_button_data: { testid: 'close-registration-enabled-callout' } do
.gl-alert-body
= html_escape(_('%{anchorOpen}Learn more%{anchorClose} about how you can customize / disable registration on your instance.')) % { anchorOpen: "<a href=\"#{help_page_path('user/admin_area/settings/sign_up_restrictions')}\">".html_safe, anchorClose: '</a>'.html_safe }
.gl-alert-actions
= link_to general_admin_application_settings_path(anchor: 'js-signup-settings'), class: 'btn gl-alert-action btn-info btn-md gl-button' do
%span.gl-button-text
= _('View setting')

View file

@ -1,13 +1,14 @@
- if show_auto_devops_implicitly_enabled_banner?(project, current_user)
.qa-auto-devops-banner.auto-devops-implicitly-enabled-banner.gl-alert.gl-alert-info
= sprite_icon('information-o', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
%button.js-close.gl-alert-dismiss{ type: 'button', 'aria-label' => _('Dismiss'), class: 'hide-auto-devops-implicitly-enabled-banner alert-link', data: { project_id: project.id } }
= sprite_icon('close', css_class: 'gl-icon')
= render 'shared/global_alert',
variant: :info,
alert_class: 'qa-auto-devops-banner auto-devops-implicitly-enabled-banner',
close_button_class: 'hide-auto-devops-implicitly-enabled-banner',
close_button_data: { project_id: project.id } do
.gl-alert-body
= s_("AutoDevOps|The Auto DevOps pipeline has been enabled and will be used if no alternative CI configuration file is found.")
- unless Gitlab.config.registry.enabled
%div
= _('Container registry is not enabled on this GitLab instance. Ask an administrator to enable it in order for Auto DevOps to work.')
.gl-alert-actions.gl-mt-3
- unless Gitlab.config.registry.enabled
%div
= _('Container registry is not enabled on this GitLab instance. Ask an administrator to enable it in order for Auto DevOps to work.')
.gl-alert-actions
= link_to _('Settings'), project_settings_ci_cd_path(project), class: 'alert-link btn gl-button btn-info'
= link_to _('More information'), help_page_path('topics/autodevops/index.md'), target: '_blank', class: 'alert-link btn gl-button btn-default gl-ml-2'

View file

@ -0,0 +1,20 @@
- icons = { info: 'information-o', warning: 'warning', success: 'check-circle', danger: 'error', tip: 'bulb' }
- title = local_assigns.fetch(:title, nil)
- variant = local_assigns.fetch(:variant, :info)
- alert_class = local_assigns.fetch(:alert_class, nil)
- alert_data = local_assigns.fetch(:alert_data, nil)
- close_button_class = local_assigns.fetch(:close_button_class, nil)
- close_button_data = local_assigns.fetch(:close_button_data, nil)
- icon = icons[variant]
%div{ role: 'alert', class: ["gl-alert-#{variant}", alert_class], data: alert_data }
%div{ class: [container_class, @content_class, 'gl-px-0!'] }
.gl-alert
= sprite_icon(icon, size: 16, css_class: "gl-alert-icon#{' gl-alert-icon-no-title' if title.nil?}")
%button.gl-alert-dismiss.js-close{ type: 'button', aria: { label: _('Close') }, class: close_button_class, data: close_button_data }
= sprite_icon('close', size: 16)
- if title
.gl-alert-title
= title
= yield

View file

@ -339,12 +339,12 @@ If parsing JUnit report XML results in an error, an indicator is shown next to t
Upload your screenshots as [artifacts](yaml/README.md#artifactsreportsjunit) to GitLab. If JUnit
report format XML files contain an `attachment` tag, GitLab parses the attachment. Note that:
- The `attachment` tag **must** contain the absolute path to the screenshots you uploaded. For
- The `attachment` tag **must** contain the relative path to `$CI_PROJECT_DIR` of the screenshots you uploaded. For
example:
```xml
<testcase time="1.00" name="Test">
<system-out>[[ATTACHMENT|/absolute/path/to/some/file]]</system-out>
<system-out>[[ATTACHMENT|/path/to/some/file]]</system-out>
</testcase>
```

View file

@ -772,3 +772,7 @@ For Maven builds, add the following to your `pom.xml` file:
### Flawfinder encoding error
This occurs when Flawfinder encounters an invalid UTF-8 character. To fix this, convert all source code in your project to UTF-8 character encoding. This can be done with [`cvt2utf`](https://github.com/x1angli/cvt2utf) or [`iconv`](https://www.gnu.org/software/libiconv/documentation/libiconv-1.13/iconv.1.html) either over the entire project or per job using the [`before_script`](../../../ci/yaml/README.md#before_script) feature.
### Semgrep slowness, unexpected results, or other errors
If Semgrep is slow, reports too many false positives or false negatives, crashes, fails, or is otherwise broken, see the Semgrep docs for [troubleshooting GitLab SAST](https://semgrep.dev/docs/troubleshooting/gitlab-sast/).

View file

@ -105,7 +105,7 @@ on an existing group's page.
![Navigation paths to create a new group](img/new_group_navigation_v13_8.png)
1. On the New Group page, select the **Import group** tab.
1. On the New Group page, select **Import group**.
![Fill in import details](img/import_panel_v13_8.png)

View file

@ -51,6 +51,7 @@ To create a group:
1. From the top menu, either:
- Select **Groups > Your Groups**, and on the right, select the **New group** button.
- To the left of the search box, select the plus sign and then **New group**.
1. Select **Create group**.
1. For the **Group name**, use only:
- Alphanumeric characters
- Emojis

View file

@ -558,9 +558,6 @@ msgstr ""
msgid "%{global_id} is not a valid ID for %{expected_types}."
msgstr ""
msgid "%{group_docs_link_start}Groups%{group_docs_link_end} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects."
msgstr ""
msgid "%{group_name} activity"
msgstr ""
@ -16085,9 +16082,6 @@ msgstr ""
msgid "Groups and subgroups"
msgstr ""
msgid "Groups can also be nested by creating %{subgroup_docs_link_start}subgroups%{subgroup_docs_link_end}."
msgstr ""
msgid "Groups to synchronize"
msgstr ""
@ -16124,22 +16118,31 @@ msgstr ""
msgid "GroupsEmptyState|You can manage your group members permissions and access to each project in the group."
msgstr ""
msgid "GroupsNew|%{linkStart}Groups%{linkEnd} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects. Groups can also be nested by creating subgroups."
msgstr ""
msgid "GroupsNew|Assemble related projects together and grant members access to several projects at once."
msgstr ""
msgid "GroupsNew|Connect instance"
msgstr ""
msgid "GroupsNew|Contact an administrator to enable options for importing your group."
msgstr ""
msgid "GroupsNew|Create"
msgid "GroupsNew|Create group"
msgstr ""
msgid "GroupsNew|Create group"
msgid "GroupsNew|Create new group"
msgstr ""
msgid "GroupsNew|Export groups with all their related data and move to a new GitLab instance."
msgstr ""
msgid "GroupsNew|GitLab source URL"
msgstr ""
msgid "GroupsNew|Import"
msgid "GroupsNew|Groups can also be nested by creating %{linkStart}subgroups%{linkEnd}."
msgstr ""
msgid "GroupsNew|Import group"
@ -26160,9 +26163,6 @@ msgstr ""
msgid "Projects shared with %{group_name}"
msgstr ""
msgid "Projects that belong to a group are prefixed with the group namespace. Existing projects may be moved into a group."
msgstr ""
msgid "Projects to index"
msgstr ""

View file

@ -38,6 +38,14 @@ module QA
fill_element(:import_gitlab_token, token)
end
def click_import_group
click_on 'Import group'
end
def click_create_group
click_on 'Create group'
end
# Connect gitlab instance
#
# @param [String] gitlab_url

View file

@ -29,6 +29,7 @@ module QA
group_show.go_to_new_subgroup
Page::Group::New.perform do |group_new|
group_new.click_create_group
group_new.set_path(path)
group_new.set_visibility('Public')
group_new.create

View file

@ -10,9 +10,13 @@ module QA
Page::Dashboard::Groups.perform do |groups|
groups.click_new_group
expect(groups).to have_content(
/Create a Mattermost team for this group/
)
Page::Group::New.perform do |group_new|
group_new.click_create_group
expect(group_new).to have_content(
/Create a Mattermost team for this group/
)
end
end
end
end

View file

@ -1,10 +1,12 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Verify', :runner do
# TODO: Remove `:requires_admin` meta when the feature flag is removed
RSpec.describe 'Verify', :runner, :requires_admin do
describe 'Pipeline creation and processing' do
let(:executor) { "qa-runner-#{Time.now.to_i}" }
let(:max_wait) { 30 }
let(:feature_flag) { :ci_drop_new_builds_when_ci_quota_exceeded }
let(:project) do
Resource::Project.fabricate_via_api! do |project|
@ -20,8 +22,13 @@ module QA
end
end
before do
Runtime::Feature.enable(feature_flag, project: project)
end
after do
runner.remove_via_api!
Runtime::Feature.disable(feature_flag, project: project)
end
it 'users creates a pipeline which gets processed', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1849' do
@ -47,7 +54,7 @@ module QA
- echo 'FAILURE'
- exit 1
test-tags:
test-tags-mismatch:
tags:
- invalid
script: echo 'NOOP'
@ -70,7 +77,7 @@ module QA
{
'test-success': :passed,
'test-failure': :failed,
'test-tags': :pending,
'test-tags-mismatch': :failed,
'test-artifacts': :passed
}.each do |job, status|
Page::Project::Pipeline::Show.perform do |pipeline|

View file

@ -16,6 +16,8 @@ RSpec.describe 'Dashboard Group' do
it 'creates new group', :js do
visit dashboard_groups_path
find('[data-testid="new-group-button"]').click
click_link 'Create group'
new_name = 'Samurai'
fill_in 'group_name', with: new_name

View file

@ -15,7 +15,7 @@ RSpec.describe 'Import/Export - Connect to another instance', :js do
visit new_group_path
find('#import-group-tab').click
click_link 'Import group'
end
context 'when the user provides valid credentials' do

View file

@ -28,9 +28,9 @@ RSpec.describe 'Import/Export - Group Import', :js do
group_name = 'Test Group Import'
visit new_group_path
click_link 'Import group'
fill_in :group_name, with: group_name
find('#import-group-tab').click
fill_in :import_group_name, with: group_name
expect(page).to have_content 'Import group from file'
attach_file(file) do
@ -51,9 +51,9 @@ RSpec.describe 'Import/Export - Group Import', :js do
context 'when modifying the pre-filled path' do
it 'successfully imports the group' do
visit new_group_path
click_link 'Import group'
fill_in :group_name, with: 'Test Group Import'
find('#import-group-tab').click
fill_in :import_group_name, with: 'Test Group Import'
fill_in :import_group_path, with: 'custom-path'
attach_file(file) do
@ -74,7 +74,7 @@ RSpec.describe 'Import/Export - Group Import', :js do
it 'suggests a unique path' do
visit new_group_path
find('#import-group-tab').click
click_link 'Import group'
fill_in :import_group_path, with: 'test-group-import'
expect(page).to have_content 'Group path is already taken. Suggestions: test-group-import1'
@ -87,9 +87,9 @@ RSpec.describe 'Import/Export - Group Import', :js do
it 'displays an error' do
visit new_group_path
click_link 'Import group'
fill_in :group_name, with: 'Test Group Import'
find('#import-group-tab').click
fill_in :import_group_name, with: 'Test Group Import'
attach_file(file) do
find('.js-filepicker-button').click
end

View file

@ -15,9 +15,10 @@ RSpec.describe 'Group' do
end
end
describe 'create a group' do
describe 'create a group', :js do
before do
visit new_group_path
click_link 'Create group'
end
describe 'as a non-admin' do
@ -50,13 +51,14 @@ RSpec.describe 'Group' do
fill_in 'Group URL', with: 'space group'
click_button 'Create group'
expect(current_path).to eq(groups_path)
expect(page).to have_namespace_error_message
expect(current_path).to eq(new_group_path)
expect(page).to have_text('Please choose a group URL with no special characters.')
end
end
describe 'with .atom at end of group path' do
it 'renders new group form with validation errors' do
fill_in 'Group name', with: 'test-group'
fill_in 'Group URL', with: 'atom_group.atom'
click_button 'Create group'
@ -67,6 +69,7 @@ RSpec.describe 'Group' do
describe 'with .git at end of group path' do
it 'renders new group form with validation errors' do
fill_in 'Group name', with: 'test-group'
fill_in 'Group URL', with: 'git_group.git'
click_button 'Create group'
@ -109,6 +112,7 @@ RSpec.describe 'Group' do
stub_mattermost_setting(enabled: mattermost_enabled)
visit new_group_path
click_link 'Create group'
end
context 'Mattermost enabled' do
@ -119,7 +123,7 @@ RSpec.describe 'Group' do
end
it 'unchecks the checkbox by default' do
expect(find('#group_create_chat_team')['checked']).to eq(false)
expect(find('#group_create_chat_team')).not_to be_checked
end
it 'updates the team URL on graph path update', :js do
@ -147,6 +151,7 @@ RSpec.describe 'Group' do
stub_application_setting(recaptcha_enabled: true)
allow(Gitlab::Recaptcha).to receive(:load_configurations!)
visit new_group_path
click_link 'Create group'
end
it 'renders recaptcha' do
@ -159,6 +164,7 @@ RSpec.describe 'Group' do
stub_feature_flags(recaptcha_on_top_level_group_creation: false)
stub_application_setting(recaptcha_enabled: true)
visit new_group_path
click_link 'Create group'
end
it 'does not render recaptcha' do
@ -167,30 +173,30 @@ RSpec.describe 'Group' do
end
end
describe 'create a nested group' do
describe 'create a nested group', :js do
let_it_be(:group) { create(:group, path: 'foo') }
context 'as admin' do
let(:user) { create(:admin) }
before do
visit new_group_path(group, parent_id: group.id)
visit new_group_path(parent_id: group.id)
end
context 'when admin mode is enabled', :enable_admin_mode do
it 'creates a nested group' do
click_link 'Create group'
fill_in 'Group name', with: 'bar'
fill_in 'Group URL', with: 'bar'
click_button 'Create group'
expect(current_path).to eq(group_path('foo/bar'))
expect(page).to have_content("Group 'bar' was successfully created.")
expect(page).to have_selector 'h1', text: 'bar'
end
end
context 'when admin mode is disabled' do
it 'is not allowed' do
expect(page).to have_gitlab_http_status(:not_found)
expect(page).not_to have_button('Create group')
end
end
end
@ -203,14 +209,14 @@ RSpec.describe 'Group' do
sign_out(:user)
sign_in(user)
visit new_group_path(group, parent_id: group.id)
visit new_group_path(parent_id: group.id)
click_link 'Create group'
fill_in 'Group name', with: 'bar'
fill_in 'Group URL', with: 'bar'
click_button 'Create group'
expect(current_path).to eq(group_path('foo/bar'))
expect(page).to have_content("Group 'bar' was successfully created.")
expect(page).to have_selector 'h1', text: 'bar'
end
end
@ -221,7 +227,7 @@ RSpec.describe 'Group' do
end
context 'when creating subgroup' do
let(:path) { new_group_path(group, parent_id: group.id) }
let(:path) { new_group_path(parent_id: group.id) }
it 'does not render recaptcha' do
visit path
@ -237,6 +243,7 @@ RSpec.describe 'Group' do
before do
group.add_owner(user)
visit new_group_path(parent_id: group.id)
click_link 'Create group'
end
it 'shows a message if group url is available' do
@ -255,14 +262,15 @@ RSpec.describe 'Group' do
end
end
it 'checks permissions to avoid exposing groups by parent_id' do
it 'checks permissions to avoid exposing groups by parent_id', :js do
group = create(:group, :private, path: 'secret-group')
sign_out(:user)
sign_in(create(:user))
visit new_group_path(parent_id: group.id)
expect(page).not_to have_content('secret-group')
expect(page).to have_title('Not Found')
expect(page).to have_content('Page Not Found')
end
describe 'group edit', :js do

View file

@ -768,6 +768,13 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
update_merge_request({ target_branch: 'target' })
end
it "does not try to mark as unchecked if it's already unchecked" do
expect(merge_request).to receive(:unchecked?).and_return(true)
expect(merge_request).not_to receive(:mark_as_unchecked)
update_merge_request({ target_branch: "target" })
end
end
context 'when auto merge is enabled and target branch changed' do