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,11 +49,7 @@ module Gitlab
end
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 }
end
_('Your subscription will expire in %{remaining_days}.') % { remaining_days: remaining_days_formatted }
end
def expiration_blocking_message
......@@ -93,17 +89,13 @@ module Gitlab
end
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 }
message << expiring_features_message
message << expiring_features_message
message.join(' ')
end
message.join(' ')
end
def expiring_features_message
......@@ -126,6 +118,8 @@ module Gitlab
end
def require_notification?
return false if expiring_auto_renew?
auto_renew_choice_exists? && expired_subscribable_within_notification_window?
end
......@@ -133,6 +127,10 @@ module Gitlab
auto_renew? != nil
end
def expiring_auto_renew?
auto_renew? && !expired_but_within_cutoff?
end
def expired_subscribable_within_notification_window?
return true unless expired_but_within_cutoff?
......
......@@ -197,16 +197,8 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
context 'is auto_renew' do
let(:auto_renew) { true }
it 'has a nice subject' do
Timecop.freeze(today) do
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
it 'returns nil' do
expect(subject).to be nil
end
end
end
......
......@@ -26584,9 +26584,6 @@ msgstr ""
msgid "We want to be sure it is you, please confirm you are not a robot."
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"
msgstr ""
......@@ -27630,9 +27627,6 @@ msgstr ""
msgid "Your subscription has been downgraded."
msgstr ""
msgid "Your subscription will automatically renew in %{remaining_days}."
msgstr ""
msgid "Your subscription will expire in %{remaining_days}."
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