Commit e1587c3e authored by Phil Hughes's avatar Phil Hughes

Merge branch 'cat-fix-namespaceid-import-39078' into 'master'

Fixes namespace_id for user with no groups import

See merge request gitlab-org/gitlab!26038
parents 7948c4dd 15fe3fbe
......@@ -15,7 +15,7 @@
.input-group-prepend.static-namespace.has-tooltip{ title: user_url(current_user.username) + '/' }
.input-group-text.border-0
#{user_url(current_user.username)}/
= hidden_field_tag :namespace_id, value: current_user.namespace_id
= hidden_field_tag :namespace_id, current_user.namespace_id
.form-group.col-12.col-sm-6.project-path
= label_tag :path, _('Project slug'), class: 'label-bold'
= text_field_tag :path, @path, placeholder: "my-awesome-project", class: "js-path-name form-control", tabindex: 2, required: true
---
title: Fixes project import failures when user is not part of any groups
merge_request: 26038
author:
type: fixed
......@@ -5,17 +5,18 @@ require 'spec_helper'
describe 'import/gitlab_projects/new.html.haml' do
include Devise::Test::ControllerHelpers
let(:user) { build_stubbed(:user, namespace: build_stubbed(:namespace)) }
let(:namespace) { build_stubbed(:namespace) }
let(:user) { build_stubbed(:user, namespace: namespace) }
before do
allow(view).to receive(:current_user).and_return(user)
end
context 'when the user has no other namespaces' do
it 'shows a namespace_id hidden field tag' do
it 'adds a namespace_id hidden field tag with the namespace id as value' do
render
expect(rendered).to have_css('input[name="namespace_id"]', count: 1, visible: false)
expect(rendered).to have_css("input[name='namespace_id'][value='#{namespace.id}']", count: 1, visible: false)
end
end
......
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