Commit bdeebb00 authored by Ruben Davila's avatar Ruben Davila

Fix some broken specs plus small refactors.

parent 1f7aefb1
...@@ -10,11 +10,9 @@ class Admin::TrialsController < Admin::ApplicationController ...@@ -10,11 +10,9 @@ class Admin::TrialsController < Admin::ApplicationController
if save_license if save_license
redirect_to admin_license_url, notice: 'Your trial license was successfully activated' redirect_to admin_license_url, notice: 'Your trial license was successfully activated'
else else
message = <<~MSG message = 'An error occurred while generating the trial license, please try again a few minutes.<br>'\
An error occurred while generating the trial license, please try again a few minutes.<br> 'If the error persist please try by creating the license from '\
If the error persist please try by creating the license from '<a href="https://about.gitlab.com/free-trial/" target="_blank">this page</a>.'
<a href="https://about.gitlab.com/free-trial/" target="_blank">this page</a>.
MSG
flash.now[:alert] = message.html_safe flash.now[:alert] = message.html_safe
render :new render :new
...@@ -41,7 +39,7 @@ class Admin::TrialsController < Admin::ApplicationController ...@@ -41,7 +39,7 @@ class Admin::TrialsController < Admin::ApplicationController
def check_presence_of_license def check_presence_of_license
if error_message.present? if error_message.present?
redirect_to admin_license_url, alert: error_message.html_safe redirect_to admin_license_url, alert: error_message
end end
end end
...@@ -49,10 +47,8 @@ class Admin::TrialsController < Admin::ApplicationController ...@@ -49,10 +47,8 @@ class Admin::TrialsController < Admin::ApplicationController
def error_message def error_message
@message ||= if License.trial.present? @message ||= if License.trial.present?
<<~MSG 'You have already used a free trial, if you want to extend it please contact us at '\
You have already used a free trial, if you want to extend it please contact us at '<a href="mailto:sales@gitlab.com">sales@gitlab.com</a>.'.html_safe
<a href="mailto:sales@gitlab.com">sales@gitlab.com</a>
MSG
elsif License.current&.active? elsif License.current&.active?
'You already have an active license key installed on this server.' 'You already have an active license key installed on this server.'
end end
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
= render "blank_state_admin_welcome" = render "blank_state_admin_welcome"
- else - else
= render "blank_state_welcome" = render "blank_state_welcome"
- if !current_license&.trial? && current_user.admin? - if !current_license && current_user.admin?
.col-md-6.section-container .col-md-6.section-container
.container.section-body.section-ee-trial .container.section-body.section-ee-trial
= render "blank_state_ee_trial" = render "blank_state_ee_trial"
- if current_user&.admin? && license_message.present? - if current_license&.trial? && license_message.present?
.alert.alert-dismissible.gitlab-ee-trial-banner.hidden.js-gitlab-ee-trial-banner{ role: 'alert', 'data-license-expiry' => current_license.expires_at } .alert.alert-dismissible.gitlab-ee-trial-banner.hidden.js-gitlab-ee-trial-banner{ role: 'alert', 'data-license-expiry' => current_license.expires_at }
%button.close{ type: 'button', 'data-dismiss' => 'alert', 'aria-label' => 'Dismiss banner' } %button.close{ type: 'button', 'data-dismiss' => 'alert', 'aria-label' => 'Dismiss banner' }
= icon('times', 'aria-hidden' => 'true') = icon('times', 'aria-hidden' => 'true')
......
= render "layouts/header/ee_trial_banner" = render "layouts/header/ee_trial_banner"
%header.navbar.navbar-gitlab.navbar-gitlab-new.js-navbar-gitlab{ class: nav_header_class } %header.navbar.navbar-gitlab.navbar-gitlab-new.js-navbar-gitlab{ class: nav_header_class }
%a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content %a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content
.container-fluid .container-fluid
......
...@@ -301,7 +301,7 @@ describe License do ...@@ -301,7 +301,7 @@ describe License do
let!(:license) { create(:license, trial: true) } let!(:license) { create(:license, trial: true) }
it 'returns false' do it 'returns false' do
expect(described_class.block_changes?).to eq(false) expect(described_class.block_changes?).to be_falsey
end end
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