Commit 96cf6f50 authored by Serena Fang's avatar Serena Fang

Apply reviewer suggestions

parent b3e2cbf3
......@@ -91,9 +91,7 @@ module NamespacesHelper
def show_minute_limit_banner?(namespace)
return false unless Gitlab.com? && ::Feature.enabled?(:show_minute_limit_banner)
return true if namespace.root_ancestor.free_plan? && !minute_limit_banner_dismissed?
false
namespace.root_ancestor.free_plan? && !minute_limit_banner_dismissed? ? true : false
end
private
......
- if show_minute_limit_banner?(namespace)
.container-fluid.container-limited.pt-3
= render Pajamas::AlertComponent.new(title: s_("Free tier projects CI minutes quota"),
alert_class: 'gl-mt-5 js-minute-limit-banner',
alert_data: { feature_id: ::Users::CalloutsHelper::MINUTE_LIMIT_BANNER, dismiss_endpoint: callouts_path }) do
.gl-alert-body
- minutes_quota_link = external_link("included in the 400 minutes per month CI/CD minutes quota", "https://about.gitlab.com/blog/2021/11/11/public-project-minute-limits")
- enrollment_link = external_link("enroll in the GitLab's Open Source Program", "https://about.gitlab.com/blog/2022/02/04/ultimate-perks-for-open-source-projects")
- faq_link = external_link("FAQ", "https://about.gitlab.com/pricing/faq-efficient-free-tier/#public-projects-on-gitlab-saas-free-tier")
= s_("Effective June 1, 2022, all free tier public projects will be %{minutes_quota_link}. Existing free tier public open source projects will have to %{enrollment_link} before July 1, 2022 to continue to receive GitLab Ultimate benefits. Please visit the %{faq_link} for more information.").html_safe % { minutes_quota_link: minutes_quota_link, enrollment_link: enrollment_link, faq_link: faq_link }
.container-fluid
.row
= render Pajamas::AlertComponent.new(title: s_("Changes to free tier public projects"),
alert_class: 'gl-mt-5 js-minute-limit-banner',
alert_data: { feature_id: ::Users::CalloutsHelper::MINUTE_LIMIT_BANNER, dismiss_endpoint: callouts_path }) do
.gl-alert-body
- minutes_quota_link = external_link("included in the 400 minutes per month CI/CD minutes quota", "https://about.gitlab.com/blog/2021/11/11/public-project-minute-limits")
- enrollment_link = external_link("enroll in GitLab's Open Source Program", "https://about.gitlab.com/blog/2022/02/04/ultimate-perks-for-open-source-projects")
- faq_link = external_link("FAQ", "https://about.gitlab.com/pricing/faq-efficient-free-tier/#public-projects-on-gitlab-saas-free-tier")
= s_("1. Effective June 1, 2022, all free tier public projects will be %{minutes_quota_link}. <br> 2. Before July 1, 2022, all free tier public open source projects will need to %{enrollment_link} to continue to receive GitLab Ultimate benefits. <br><br>Please visit the %{faq_link} for more information.").html_safe % { minutes_quota_link: minutes_quota_link, enrollment_link: enrollment_link, faq_link: faq_link }
---
name: show_minute_limit_banner
introduced_by_url:
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84644
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/358191
milestone: '14.10'
type: development
......
......@@ -1467,6 +1467,9 @@ msgstr[1] ""
msgid "1-9 contributions"
msgstr ""
msgid "1. Effective June 1, 2022, all free tier public projects will be %{minutes_quota_link}. <br> 2. Before July 1, 2022, all free tier public open source projects will need to %{enrollment_link} to continue to receive GitLab Ultimate benefits. <br><br>Please visit the %{faq_link} for more information."
msgstr ""
msgid "10-19 contributions"
msgstr ""
......@@ -7053,6 +7056,9 @@ msgstr ""
msgid "Changes the title to \"%{title_param}\"."
msgstr ""
msgid "Changes to free tier public projects"
msgstr ""
msgid "Changes to the title have not been saved"
msgstr ""
......@@ -13612,9 +13618,6 @@ msgstr ""
msgid "Editing"
msgstr ""
msgid "Effective June 1, 2022, all free tier public projects will be %{minutes_quota_link}. Existing free tier public open source projects will have to %{enrollment_link} before July 1, 2022 to continue to receive GitLab Ultimate benefits. Please visit the %{faq_link} for more information."
msgstr ""
msgid "Elapsed time"
msgstr ""
......@@ -16248,9 +16251,6 @@ msgstr ""
msgid "Free Trial of GitLab.com Ultimate"
msgstr ""
msgid "Free tier projects CI minutes quota"
msgstr ""
msgid "Freeze end"
msgstr ""
......
......@@ -273,75 +273,30 @@ RSpec.describe NamespacesHelper do
let(:project) { create(:project) }
context 'on dot com' do
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
context 'when show_minute_limit_banner feature flag enabled' do
before do
stub_feature_flags(show_minute_limit_banner: true)
end
context 'for a free project' do
before do
allow(project.root_ancestor).to receive(:free_plan?).and_return(true)
end
context 'when user has not dismissed banner' do
before do
allow(helper).to receive(:user_dismissed?).with(Users::CalloutsHelper::MINUTE_LIMIT_BANNER).and_return(false)
end
it 'shows the banner' do
expect(helper.show_minute_limit_banner?(project)).to eq(true)
end
end
context 'when user has dismissed banner' do
before do
allow(helper).to receive(:user_dismissed?).with(Users::CalloutsHelper::MINUTE_LIMIT_BANNER).and_return(true)
end
it 'does not show the banner' do
expect(helper.show_minute_limit_banner?(project)).to eq(false)
end
end
end
context 'for a non-free project' do
before do
allow(project.root_ancestor).to receive(:free_plan?).and_return(false)
end
using RSpec::Parameterized::TableSyntax
it 'does not show the banner' do
expect(helper.show_minute_limit_banner?(project)).to eq(false)
end
end
where(:feature_flag_enabled, :free_project, :user_dismissed_banner, :should_show_banner) do
true | true | false | true
true | true | true | false
true | false | false | false
false | true | false | false
end
context 'when show_minute_limit_banner feature flag is not enabled' do
with_them do
before do
stub_feature_flags(show_minute_limit_banner: false)
allow(Gitlab).to receive(:com?).and_return(true)
stub_feature_flags(show_minute_limit_banner: feature_flag_enabled)
allow(project.root_ancestor).to receive(:free_plan?).and_return(free_project)
allow(helper).to receive(:user_dismissed?).with(Users::CalloutsHelper::MINUTE_LIMIT_BANNER).and_return(user_dismissed_banner)
end
context 'for a free project and user has not dismissed callout' do
before do
allow(project.root_ancestor).to receive(:free_plan?).and_return(true)
allow(helper).to receive(:user_dismissed?).with(Users::CalloutsHelper::MINUTE_LIMIT_BANNER).and_return(false)
end
it 'does not show banner' do
expect(helper.show_minute_limit_banner?(project)).to eq(false)
end
it 'shows the banner if required' do
expect(helper.show_minute_limit_banner?(project)).to eq(should_show_banner)
end
end
end
context 'not dot com' do
before do
allow(Gitlab).to receive(:com?).and_return(false)
end
context 'when feature flag is enabled for a free project and user has not dismissed callout' do
before do
stub_feature_flags(show_minute_limit_banner: true)
......
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