Commit 54ba4fdb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch...

Merge branch '52771-ldap-users-can-t-choose-private-or-internal-when-creating-a-new-group' into 'master'

Fix new group visibility form for non-admins

Closes #52771

See merge request gitlab-org/gitlab-ce!22468
parents c81d4a65 42dd6bf2
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
%p %p
= _('Who will be able to see this group?') = _('Who will be able to see this group?')
= link_to _('View the documentation'), help_page_path("public_access/public_access"), target: '_blank' = link_to _('View the documentation'), help_page_path("public_access/public_access"), target: '_blank'
= render 'shared/visibility_level', f: f, visibility_level: @group.visibility_level, can_change_visibility_level: can_change_group_visibility_level?(@group), form_model: @group, with_label: false = render 'shared/visibility_level', f: f, visibility_level: default_group_visibility, can_change_visibility_level: true, form_model: @group, with_label: false
= render 'create_chat_team', f: f if Gitlab.config.mattermost.enabled = render 'create_chat_team', f: f if Gitlab.config.mattermost.enabled
......
---
title: Fix bug stopping non-admin users from changing visibility level on group creation
merge_request: 22468
author:
type: fixed
require 'spec_helper' require 'spec_helper'
describe 'Group' do describe 'Group' do
let(:user) { create(:admin) }
before do before do
sign_in(create(:admin)) sign_in(user)
end end
matcher :have_namespace_error_message do matcher :have_namespace_error_message do
...@@ -16,6 +18,24 @@ describe 'Group' do ...@@ -16,6 +18,24 @@ describe 'Group' do
visit new_group_path visit new_group_path
end end
describe 'as a non-admin' do
let(:user) { create(:user) }
it 'creates a group and persists visibility radio selection', :js do
stub_application_setting(default_group_visibility: :private)
fill_in 'Group name', with: 'test-group'
find("input[name='group[visibility_level]'][value='#{Gitlab::VisibilityLevel::PUBLIC}']").click
click_button 'Create group'
group = Group.find_by(name: 'test-group')
expect(group.visibility_level).to eq(Gitlab::VisibilityLevel::PUBLIC)
expect(current_path).to eq(group_path(group))
expect(page).to have_selector '.visibility-icon .fa-globe'
end
end
describe 'with space in group path' do describe 'with space in group path' do
it 'renders new group form with validation errors' do it 'renders new group form with validation errors' do
fill_in 'Group URL', with: 'space group' fill_in 'Group URL', with: 'space group'
......
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