Commit b48fe2d8 authored by Jay's avatar Jay Committed by Dmytro Zaporozhets

Add license FAQ link to license expired message

Add a FAQ link to the license we display to users when their license is
expired, or is about to expire.

finishes:
https://gitlab.com/gitlab-org/gitlab/issues/7681
parent e178d5e5
---
title: Add license FAQ link to license expired message
merge_request:
author:
type: added
...@@ -48,6 +48,13 @@ module LicenseHelper ...@@ -48,6 +48,13 @@ module LicenseHelper
message << 'service.' message << 'service.'
end end
unless is_trial
renewal_faq_url = 'https://about.gitlab.com/pricing/licensing-faq/#self-managed-gitlab'
renewal_faq_link_start = "<a href='#{renewal_faq_url}' target='_blank'>".html_safe
link_end = '</a>'.html_safe
message << _('For renewal instructions %{link_start}view our Licensing FAQ.%{link_end}') % { link_start: renewal_faq_link_start, link_end: link_end }
end
message.join(' ').html_safe message.join(' ').html_safe
end end
......
...@@ -9,6 +9,32 @@ describe LicenseHelper do ...@@ -9,6 +9,32 @@ describe LicenseHelper do
end end
describe '#license_message' do describe '#license_message' do
context 'license installed' do
subject { license_message(signed_in: true, is_admin: false) }
let(:license) { double('License') }
let(:faq_link_regex) { /For renewal instructions <a href.*>view our Licensing FAQ\.<\/a>/ }
before do
allow(License).to receive(:current).and_return(license)
allow(license).to receive(:notify_users?).and_return(true)
allow(license).to receive(:expired?).and_return(false)
allow(license).to receive(:remaining_days).and_return(4)
end
it 'does NOT have a license faq link if license is a trial' do
allow(license).to receive(:trial?).and_return(true)
expect(subject).not_to match(faq_link_regex)
end
it 'has license faq link if license is not a trial' do
allow(license).to receive(:trial?).and_return(false)
expect(subject).to match(faq_link_regex)
end
end
context 'no license installed' do context 'no license installed' do
before do before do
allow(License).to receive(:current).and_return(nil) allow(License).to receive(:current).and_return(nil)
......
...@@ -8450,6 +8450,9 @@ msgstr "" ...@@ -8450,6 +8450,9 @@ msgstr ""
msgid "For public projects, anyone can view pipelines and access job details (output logs and artifacts)" msgid "For public projects, anyone can view pipelines and access job details (output logs and artifacts)"
msgstr "" msgstr ""
msgid "For renewal instructions %{link_start}view our Licensing FAQ.%{link_end}"
msgstr ""
msgid "Forgot your password?" msgid "Forgot your password?"
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