Commit bd64e82c authored by charlie ablett's avatar charlie ablett

Merge branch 'jswain_dont_display_subscribable_banner_to_auto_renew_nil' into 'master'

Don't show subscribable banner to auto_renew:nil

See merge request gitlab-org/gitlab!38962
parents 3e9c8001 db03a959
......@@ -495,7 +495,7 @@ class License < ApplicationRecord
starts_at > Date.current
end
def auto_renew?
def auto_renew
false
end
......
---
title: Only show subscribable banner when auto-renew is set
merge_request: 38962
author:
type: fixed
......@@ -9,6 +9,8 @@ module Gitlab
attr_reader :subscribable, :signed_in, :is_admin, :namespace
delegate :auto_renew, to: :subscribable
def initialize(subscribable:, signed_in:, is_admin:, namespace: nil)
@subscribable = subscribable
@signed_in = signed_in
......@@ -38,7 +40,7 @@ module Gitlab
def expired_subject
if subscribable.block_changes?
if auto_renew?
if auto_renew
_('Something went wrong with your automatic subscription renewal.')
else
_('Your subscription has been downgraded.')
......@@ -73,7 +75,7 @@ module Gitlab
end
def namespace_block_changes_message
if auto_renew?
if auto_renew
support_link = '<a href="mailto:support@gitlab.com">support@gitlab.com</a>'.html_safe
_('We tried to automatically renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} on %{expires_on} but something went wrong so your subscription was downgraded to the free plan. Don\'t worry, your data is safe. We suggest you check your payment method and get in touch with our support team (%{support_link}). They\'ll gladly help with your subscription renewal.') % { plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name, support_link: support_link, expires_on: expires_at_or_cutoff_at.strftime("%Y-%m-%d") }
......@@ -124,11 +126,11 @@ module Gitlab
end
def auto_renew_choice_exists?
auto_renew? != nil
!auto_renew.nil?
end
def expiring_auto_renew?
auto_renew? && !expired_but_within_cutoff?
!!auto_renew && !expired_but_within_cutoff?
end
def expired_subscribable_within_notification_window?
......@@ -149,10 +151,6 @@ module Gitlab
'</strong>'.html_safe
end
def auto_renew?
subscribable.auto_renew?
end
def grace_period_effective_from
Date.parse('2020-07-22')
end
......
......@@ -33,7 +33,7 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
before do
allow(subscribable).to receive(:plan).and_return('ultimate')
allow(subscribable).to receive(:expires_at).and_return(expired_date)
allow(subscribable).to receive(:auto_renew?).and_return(auto_renew)
allow(subscribable).to receive(:auto_renew).and_return(auto_renew)
end
context 'subscribable should not notify admins' do
......
......@@ -964,9 +964,9 @@ RSpec.describe License do
end
end
describe '#auto_renew?' do
describe '#auto_renew' do
it 'is false' do
expect(license.auto_renew?).to be false
expect(license.auto_renew).to be false
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