Commit aa3951fe authored by Rubén Dávila's avatar Rubén Dávila Committed by James Lopez

Enable the Buy CI Minutes button for Groups with free or trial plan

Changes that were initially added to hide this button has been reverted
given now it's possible to purchase extra CI minutes for free plans.
parent f1b91890
...@@ -292,12 +292,6 @@ module EE ...@@ -292,12 +292,6 @@ module EE
actual_plan_name == GOLD_PLAN actual_plan_name == GOLD_PLAN
end end
def paid_plan?
return false if trial?
!(free_plan? || early_adopter_plan?)
end
def use_elasticsearch? def use_elasticsearch?
::Gitlab::CurrentSettings.elasticsearch_indexes_namespace?(self) ::Gitlab::CurrentSettings.elasticsearch_indexes_namespace?(self)
end end
......
# frozen_string_literal: true # frozen_string_literal: true
class FetchSubscriptionPlansService class FetchSubscriptionPlansService
URL = 'https://customers.gitlab.com/gitlab_plans'.freeze URL = "#{EE::SUBSCRIPTIONS_URL}/gitlab_plans".freeze
def initialize(plan:) def initialize(plan:)
@plan = plan @plan = plan
......
...@@ -10,10 +10,9 @@ ...@@ -10,10 +10,9 @@
%strong= @group.name %strong= @group.name
group group
- if @group.paid_plan? .col-sm-6
.col-sm-6 %p.text-right
%p.text-right = link_to 'Buy additional minutes', EE::SUBSCRIPTIONS_PLANS_URL, target: '_blank', class: 'btn btn-inverted btn-success right text-right'
= link_to 'Buy additional minutes', 'https://customers.gitlab.com/subscriptions', target: '_blank', class: 'btn btn-inverted btn-success right text-right'
= render "namespaces/pipelines_quota/list", = render "namespaces/pipelines_quota/list",
locals: { namespace: @group, projects: @projects } locals: { namespace: @group, projects: @projects }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
%p.mb-0 %p.mb-0
%span= _('Try all GitLab has to offer for 30 days.') %span= _('Try all GitLab has to offer for 30 days.')
%span.d-none.d-sm-inline= _('No credit card required.') %span.d-none.d-sm-inline= _('No credit card required.')
= link_to _('Start your trial'), 'https://customers.gitlab.com/trials/new?gl_com=true', class: "btn btn-primary mt-2 mt-sm-0 #{button_css_class}", target: '_blank' = link_to _('Start your trial'), "#{EE::SUBSCRIPTIONS_URL}/trials/new?gl_com=true", class: "btn btn-primary mt-2 mt-sm-0 #{button_css_class}", target: '_blank'
- if is_dismissable - if is_dismissable
%button.btn.btn-default.close.js-close{ type: 'button', %button.btn.btn-default.close.js-close{ type: 'button',
......
...@@ -56,39 +56,4 @@ describe Namespace do ...@@ -56,39 +56,4 @@ describe Namespace do
expect(namespace.use_elasticsearch?).to eq(true) expect(namespace.use_elasticsearch?).to eq(true)
end end
end end
describe '#paid_plan?' do
using RSpec::Parameterized::TableSyntax
let(:namespace) { create(:namespace) }
before(:all) do
%i[free_plan early_adopter_plan bronze_plan silver_plan gold_plan].each do |plan|
create(plan)
end
end
subject { namespace.paid_plan? }
where(:plan_code, :trial, :expected_result) do
described_class::FREE_PLAN | false | false
described_class::EARLY_ADOPTER_PLAN | false | false
described_class::BRONZE_PLAN | false | true
described_class::SILVER_PLAN | false | true
described_class::GOLD_PLAN | false | true
described_class::BRONZE_PLAN | true | false
described_class::SILVER_PLAN | true | false
described_class::GOLD_PLAN | true | false
end
with_them do
before do
namespace.update!(gitlab_subscription_attributes: { trial: trial, hosted_plan: Plan.find_by_name(plan_code) })
end
it do
is_expected.to eq(expected_result)
end
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