Commit 68c9640a authored by Ruben Davila's avatar Ruben Davila

Remove broadcast message when there is no license present

parent 9f98d10c
......@@ -19,38 +19,11 @@ module LicenseHelper
@license_message =
if License.current
yes_license_message(signed_in, is_admin)
else
no_license_message(is_admin, in_html: in_html)
end
end
private
def no_license_message(is_admin, in_html: true)
upload_a_license =
if in_html
link_to('Upload a license', new_admin_license_path)
else
'Upload a license'
end
message = []
message << 'No GitLab Enterprise Edition license has been provided yet.'
message << 'Pushing code and creation of issues and merge requests has been disabled.'
message <<
if is_admin
"#{upload_a_license} in the admin area to activate this functionality."
else
'Ask an admin to upload a license to activate this functionality.'
end
if in_html
content_tag(:p, message.join(' ').html_safe)
else
message.join(' ')
end
end
def yes_license_message(signed_in, is_admin)
license = License.current
......
......@@ -8,12 +8,6 @@ Feature: Admin license
And I visit admin license page
Then I should see to whom the license is licensed
Scenario: Viewing license when there is none
Given There is no license
And I visit admin license page
Then I should see a warning telling me there is no license
And I should be redirected to the license upload page
Scenario: Viewing expired license
Given there is a license
And the current license is expired
......
......@@ -14,10 +14,6 @@ class Spinach::Features::AdminLicense < Spinach::FeatureSteps
License.destroy_all
end
step 'I should see a warning telling me there is no license' do
expect(page).to have_content "No GitLab Enterprise Edition license has been provided yet."
end
step 'I should be redirected to the license upload page' do
expect(current_path).to eq(new_admin_license_path)
end
......
......@@ -11,18 +11,14 @@ describe LicenseHelper do
let(:is_admin) { true }
it 'displays correct error message for admin user' do
admin_msg = '<p>No GitLab Enterprise Edition license has been provided yet. Pushing code and creation of issues and merge requests has been disabled. <a href="/admin/license/new">Upload a license</a> in the admin area to activate this functionality.</p>'
expect(license_message(signed_in: true, is_admin: is_admin)).to eq(admin_msg)
expect(license_message(signed_in: true, is_admin: is_admin)).to be_blank
end
end
context 'normal user' do
let(:is_admin) { false }
it 'displays correct error message for normal user' do
user_msg = '<p>No GitLab Enterprise Edition license has been provided yet. Pushing code and creation of issues and merge requests has been disabled. Ask an admin to upload a license to activate this functionality.</p>'
expect(license_message(signed_in: true, is_admin: is_admin)).to eq(user_msg)
expect(license_message(signed_in: true, is_admin: is_admin)).to be_blank
end
end
end
......
......@@ -781,18 +781,13 @@ describe 'Git HTTP requests', lib: true do
let(:env) { { user: user.username, password: user.password } }
before do
project.team << [user, :master]
end
it 'responds with status 403 Forbidden' do
msg = 'No GitLab Enterprise Edition license has been provided yet. Pushing code and creation of issues and merge requests has been disabled. Ask an admin to upload a license to activate this functionality.'
allow(License).to receive(:current).and_return(nil)
upload(path, env) do |response|
expect(response).to have_http_status(:forbidden)
expect(response.body).to eq(msg)
end
project.team << [user, :master]
end
it_behaves_like 'pushes are allowed'
it_behaves_like 'pushes are allowed'
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