Commit 1fa35c64 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'jswain_update_renewal_banner_respects_autorenew' into 'master'

Renewal banner has specific auto-renew messaging

See merge request gitlab-org/gitlab!28579
parents 8ffb3de5 75e1d74e
---
title: Renewal banner has auto-renew specific messaging
merge_request: 28579
author:
type: added
......@@ -35,7 +35,11 @@ module Gitlab
def expired_subject
if subscribable.block_changes?
if auto_renew?
_('Something went wrong with your automatic subscription renewal')
else
_('Your subscription has been downgraded')
end
else
_('Your subscription expired!')
end
......@@ -44,8 +48,12 @@ module Gitlab
def expiring_subject
remaining_days = pluralize(subscribable.remaining_days, 'day')
if auto_renew?
_('Your subscription will automatically renew in %{remaining_days}') % { remaining_days: remaining_days }
else
_('Your subscription will expire in %{remaining_days}') % { remaining_days: remaining_days }
end
end
def expiration_blocking_message
return '' unless subscribable.will_block_changes?
......@@ -56,25 +64,41 @@ module Gitlab
end
def expired_message
if subscribable.block_changes?
if namespace
_('You didn\'t renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} so it was downgraded to the free plan.') % { plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
else
_('You didn\'t renew your %{strong}%{plan_name}%{strong_close} subscription so it was downgraded to the GitLab Core Plan.') % { plan_name: plan_name, strong: strong, strong_close: strong_close }
end
else
return block_changes_message if subscribable.block_changes?
remaining_days = pluralize((subscribable.block_changes_at - Date.today).to_i, 'day')
_('No worries, you can still use all the %{strong}%{plan_name}%{strong_close} features for now. You have %{remaining_days} to renew your subscription.') % { plan_name: plan_name, remaining_days: remaining_days, strong: strong, strong_close: strong_close }
end
def block_changes_message
return namespace_block_changes_message if namespace
_('You didn\'t renew your %{strong}%{plan_name}%{strong_close} subscription so it was downgraded to the GitLab Core Plan.') % { plan_name: plan_name, strong: strong, strong_close: strong_close }
end
def expiring_message
if namespace
_('Your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} will expire on %{strong}%{expires_on}%{strong_close}. After that, you will not to be able to create issues or merge requests as well as many other features.') % { expires_on: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
def namespace_block_changes_message
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: subscribable.expires_at.strftime("%Y-%m-%d") }
else
_('You didn\'t renew your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} so it was downgraded to the free plan.') % { plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
end
end
def expiring_message
return namespace_expiring_message if namespace
_('Your %{strong}%{plan_name}%{strong_close} subscription will expire on %{strong}%{expires_on}%{strong_close}. After that, you will not to be able to create issues or merge requests as well as many other features.') % { expires_on: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close }
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: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
else
_('Your %{strong}%{plan_name}%{strong_close} subscription for %{strong}%{namespace_name}%{strong_close} will expire on %{strong}%{expires_on}%{strong_close}. After that, you will not to be able to create issues or merge requests as well as many other features.') % { expires_on: subscribable.expires_at.strftime("%Y-%m-%d"), plan_name: plan_name, strong: strong, strong_close: strong_close, namespace_name: namespace.name }
end
end
def notifiable?
......@@ -102,5 +126,9 @@ module Gitlab
def strong_close
'</strong>'.html_safe
end
def auto_renew?
subscribable.try(:auto_renew?)
end
end
end
......@@ -66,8 +66,6 @@ describe Gitlab::ExpiringSubscriptionMessage do
end
it 'has a nice subject' do
allow(subscribable).to receive(:will_block_changes?).and_return(false)
Timecop.freeze(today) do
expect(subject).to include('Your subscription has been downgraded')
end
......@@ -89,6 +87,24 @@ describe Gitlab::ExpiringSubscriptionMessage do
expect(subject).to include("You didn't renew your Ultimate subscription for No Limit Records so it was downgraded to the free plan")
end
end
context 'is auto_renew' do
before do
allow(subscribable).to receive(:auto_renew?).and_return(true)
end
it 'has a nice subject' do
Timecop.freeze(today) do
expect(subject).to include('Something went wrong with your automatic subscription renewal')
end
end
it 'has an expiration blocking message' do
Timecop.freeze(today) do
expect(subject).to include("We tried to automatically renew your Ultimate subscription for No Limit Records on 2020-03-01 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@gitlab.com). They'll gladly help with your subscription renewal.")
end
end
end
end
end
......@@ -146,6 +162,22 @@ describe Gitlab::ExpiringSubscriptionMessage do
expect(subject).to include('Your Ultimate subscription for No Limit Records will expire on 2020-03-09. After that, you will not to be able to create issues or merge requests as well as many other features.')
end
end
context 'is auto_renew' do
before do
allow(subscribable).to receive(:auto_renew?).and_return(true)
end
it 'has a nice subject' do
expect(subject).to include('Your subscription will automatically renew in 4 days')
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
......
......@@ -19217,6 +19217,9 @@ msgstr ""
msgid "Something went wrong while updating your list settings"
msgstr ""
msgid "Something went wrong with your automatic subscription renewal"
msgstr ""
msgid "Something went wrong, unable to add %{project} to dashboard"
msgstr ""
......@@ -23353,9 +23356,15 @@ msgstr ""
msgid "We sent you an email with reset password instructions"
msgstr ""
msgid "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."
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 ""
......@@ -24285,6 +24294,9 @@ 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