Commit 6135870d authored by charlie ablett's avatar charlie ablett

Merge branch 'jswain_subscription_banner_auto_renew_shouldnt_display' into 'master'

Subscription banner shouldn't display for auto-renew

See merge request gitlab-org/gitlab!37127
parents be4faf17 314f8285
---
title: Expired subscription banner doesn't display for auto-renew
merge_request: 37127
author:
type: changed
...@@ -49,12 +49,8 @@ module Gitlab ...@@ -49,12 +49,8 @@ module Gitlab
end end
def expiring_subject def expiring_subject
if auto_renew?
_('Your subscription will automatically renew in %{remaining_days}.') % { remaining_days: remaining_days_formatted }
else
_('Your subscription will expire in %{remaining_days}.') % { remaining_days: remaining_days_formatted } _('Your subscription will expire in %{remaining_days}.') % { remaining_days: remaining_days_formatted }
end end
end
def expiration_blocking_message def expiration_blocking_message
return '' unless subscribable.will_block_changes? return '' unless subscribable.will_block_changes?
...@@ -93,9 +89,6 @@ module Gitlab ...@@ -93,9 +89,6 @@ module Gitlab
end end
def namespace_expiring_message def namespace_expiring_message
if auto_renew?
_('We will automatically renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} on %{strong}%{expires_on}%{strong_close}. There\'s nothing that you need to do, we\'ll let you know when the renewal is complete. Need more seats, a higher plan or just want to review your payment method?') % { expires_on: expires_at_or_cutoff_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
else
message = [] message = []
message << _('Your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} will expire on %{strong}%{expires_on}%{strong_close}.') % { expires_on: expires_at_or_cutoff_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name } message << _('Your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} will expire on %{strong}%{expires_on}%{strong_close}.') % { expires_on: expires_at_or_cutoff_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
...@@ -104,7 +97,6 @@ module Gitlab ...@@ -104,7 +97,6 @@ module Gitlab
message.join(' ') message.join(' ')
end end
end
def expiring_features_message def expiring_features_message
case plan_name case plan_name
...@@ -126,6 +118,8 @@ module Gitlab ...@@ -126,6 +118,8 @@ module Gitlab
end end
def require_notification? def require_notification?
return false if expiring_auto_renew?
auto_renew_choice_exists? && expired_subscribable_within_notification_window? auto_renew_choice_exists? && expired_subscribable_within_notification_window?
end end
...@@ -133,6 +127,10 @@ module Gitlab ...@@ -133,6 +127,10 @@ module Gitlab
auto_renew? != nil auto_renew? != nil
end end
def expiring_auto_renew?
auto_renew? && !expired_but_within_cutoff?
end
def expired_subscribable_within_notification_window? def expired_subscribable_within_notification_window?
return true unless expired_but_within_cutoff? return true unless expired_but_within_cutoff?
......
...@@ -197,16 +197,8 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do ...@@ -197,16 +197,8 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
context 'is auto_renew' do context 'is auto_renew' do
let(:auto_renew) { true } let(:auto_renew) { true }
it 'has a nice subject' do it 'returns nil' do
Timecop.freeze(today) do expect(subject).to be nil
expect(subject).to include('Your subscription will automatically renew in 2 days.')
end
end
it 'has an expiration blocking message' do
Timecop.freeze(today) do
expect(subject).to include("We will automatically renew your Ultimate subscription for No Limit Records on 2020-03-09. There's nothing that you need to do, we'll let you know when the renewal is complete. Need more seats, a higher plan or just want to review your payment method?")
end
end end
end end
end end
......
...@@ -26584,9 +26584,6 @@ msgstr "" ...@@ -26584,9 +26584,6 @@ msgstr ""
msgid "We want to be sure it is you, please confirm you are not a robot." msgid "We want to be sure it is you, please confirm you are not a robot."
msgstr "" msgstr ""
msgid "We will automatically renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} on %{strong}%{expires_on}%{strong_close}. There's nothing that you need to do, we'll let you know when the renewal is complete. Need more seats, a higher plan or just want to review your payment method?"
msgstr ""
msgid "We've found no vulnerabilities" msgid "We've found no vulnerabilities"
msgstr "" msgstr ""
...@@ -27630,9 +27627,6 @@ msgstr "" ...@@ -27630,9 +27627,6 @@ msgstr ""
msgid "Your subscription has been downgraded." msgid "Your subscription has been downgraded."
msgstr "" msgstr ""
msgid "Your subscription will automatically renew in %{remaining_days}."
msgstr ""
msgid "Your subscription will expire in %{remaining_days}." msgid "Your subscription will expire in %{remaining_days}."
msgstr "" msgstr ""
......
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