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

Apply reviewer suggestions

parent b3e2cbf3
...@@ -91,9 +91,7 @@ module NamespacesHelper ...@@ -91,9 +91,7 @@ module NamespacesHelper
def show_minute_limit_banner?(namespace) def show_minute_limit_banner?(namespace)
return false unless Gitlab.com? && ::Feature.enabled?(:show_minute_limit_banner) return false unless Gitlab.com? && ::Feature.enabled?(:show_minute_limit_banner)
return true if namespace.root_ancestor.free_plan? && !minute_limit_banner_dismissed? namespace.root_ancestor.free_plan? && !minute_limit_banner_dismissed? ? true : false
false
end end
private private
......
- if show_minute_limit_banner?(namespace) - if show_minute_limit_banner?(namespace)
.container-fluid.container-limited.pt-3 .container-fluid
= render Pajamas::AlertComponent.new(title: s_("Free tier projects CI minutes quota"), .row
alert_class: 'gl-mt-5 js-minute-limit-banner', = render Pajamas::AlertComponent.new(title: s_("Changes to free tier public projects"),
alert_data: { feature_id: ::Users::CalloutsHelper::MINUTE_LIMIT_BANNER, dismiss_endpoint: callouts_path }) do alert_class: 'gl-mt-5 js-minute-limit-banner',
.gl-alert-body alert_data: { feature_id: ::Users::CalloutsHelper::MINUTE_LIMIT_BANNER, dismiss_endpoint: callouts_path }) do
- 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") .gl-alert-body
- 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") - 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")
- faq_link = external_link("FAQ", "https://about.gitlab.com/pricing/faq-efficient-free-tier/#public-projects-on-gitlab-saas-free-tier") - 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_("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 } = 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 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 rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/358191
milestone: '14.10' milestone: '14.10'
type: development type: development
......
...@@ -1467,6 +1467,9 @@ msgstr[1] "" ...@@ -1467,6 +1467,9 @@ msgstr[1] ""
msgid "1-9 contributions" msgid "1-9 contributions"
msgstr "" 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" msgid "10-19 contributions"
msgstr "" msgstr ""
...@@ -7053,6 +7056,9 @@ msgstr "" ...@@ -7053,6 +7056,9 @@ msgstr ""
msgid "Changes the title to \"%{title_param}\"." msgid "Changes the title to \"%{title_param}\"."
msgstr "" msgstr ""
msgid "Changes to free tier public projects"
msgstr ""
msgid "Changes to the title have not been saved" msgid "Changes to the title have not been saved"
msgstr "" msgstr ""
...@@ -13612,9 +13618,6 @@ msgstr "" ...@@ -13612,9 +13618,6 @@ msgstr ""
msgid "Editing" msgid "Editing"
msgstr "" 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" msgid "Elapsed time"
msgstr "" msgstr ""
...@@ -16248,9 +16251,6 @@ msgstr "" ...@@ -16248,9 +16251,6 @@ msgstr ""
msgid "Free Trial of GitLab.com Ultimate" msgid "Free Trial of GitLab.com Ultimate"
msgstr "" msgstr ""
msgid "Free tier projects CI minutes quota"
msgstr ""
msgid "Freeze end" msgid "Freeze end"
msgstr "" msgstr ""
......
...@@ -273,75 +273,30 @@ RSpec.describe NamespacesHelper do ...@@ -273,75 +273,30 @@ RSpec.describe NamespacesHelper do
let(:project) { create(:project) } let(:project) { create(:project) }
context 'on dot com' do context 'on dot com' do
before do using RSpec::Parameterized::TableSyntax
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
it 'does not show the banner' do where(:feature_flag_enabled, :free_project, :user_dismissed_banner, :should_show_banner) do
expect(helper.show_minute_limit_banner?(project)).to eq(false) true | true | false | true
end true | true | true | false
end true | false | false | false
false | true | false | false
end end
context 'when show_minute_limit_banner feature flag is not enabled' do with_them do
before 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 end
context 'for a free project and user has not dismissed callout' do it 'shows the banner if required' do
before do expect(helper.show_minute_limit_banner?(project)).to eq(should_show_banner)
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
end end
end end
end end
context 'not dot com' do 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 context 'when feature flag is enabled for a free project and user has not dismissed callout' do
before do before do
stub_feature_flags(show_minute_limit_banner: true) 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