Commit 706b4380 authored by Sam Figueroa's avatar Sam Figueroa

Add additional instructions for personal billing page

- Add context to assist users in creating and/or moving a project
  to a group.

- refs: https://gitlab.com/gitlab-org/gitlab/-/issues/352629
        https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82738#note_894049190
parent f72d6331
......@@ -168,6 +168,36 @@ module BillingPlansHelper
}
end
def add_namespace_plan_to_group_instructions
link_end = '</a>'.html_safe
move_link_url = help_page_path 'user/project/settings/index',
anchor: "transferring-an-existing-project-into-another-namespace"
move_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: move_link_url }
if current_user.owned_or_maintainers_groups.any?
html_escape_once(
s_("BillingPlans|You'll have to %{move_link_start}move this project%{move_link_end} to one of your groups.")
).html_safe % {
move_link_start: move_link_start,
move_link_end: link_end
}
else
create_group_link_url = new_group_path anchor: "create-group-pane"
create_group_link_start = '<a href="%{url}">'.html_safe % { url: create_group_link_url }
html_escape_once(
s_("BillingPlans|You don't have any groups. You'll need to %{create_group_link_start}create one%{create_group_link_end} and %{move_link_start}move this project to it%{move_link_end}.")
).html_safe % {
create_group_link_start: create_group_link_start,
create_group_link_end: link_end,
move_link_start: move_link_start,
move_link_end: link_end
}
end
end
private
def add_seats_url(group)
......
......@@ -23,6 +23,8 @@
- if namespace.free_personal?
- groups_link = link_to s_("BillingPlans|group"), dashboard_groups_path
%p= html_escape_once(s_("BillingPlans|Looking to purchase or manage a subscription for your group? Navigate to your %{groups_link} and go to %{strong_open}Settings &gt; Billing.%{strong_close}")).html_safe % { groups_link: groups_link.html_safe, strong_open: '<strong>'.html_safe, strong_close: '</strong>'.html_safe }
%p.gl-mt-1
= add_namespace_plan_to_group_instructions
- elsif parent_group
%p= s_("BillingPlans|This group uses the plan associated with its parent group.")
- parent_billing_page_link = link_to parent_group.full_name, group_billings_path(parent_group)
......
......@@ -42,6 +42,24 @@ RSpec.describe 'Profiles > Billing', :js do
expect(page).not_to have_field(placeholder: SearchHelpers::INPUT_PLACEHOLDER)
end
context "wtihout a group" do
it 'displays help for moving groups' do
visit profile_billings_path
expect(page).to have_content "You don't have any groups."
end
end
context "with a maintained or owned group" do
it 'displays help for moving groups' do
create(:group).add_owner user
visit profile_billings_path
expect(page).not_to have_content "You don't have any groups"
expect(page).to have_content "You'll have to move this project"
end
end
end
end
end
......@@ -590,4 +590,26 @@ RSpec.describe BillingPlansHelper, :saas do
expect(helper.start_free_trial_data).to eq data
end
end
describe '#add_namespace_plan_to_group_instructions' do
let_it_be(:current_user) { create :user }
before do
allow(helper).to receive(:current_user).and_return(current_user)
end
context 'with maintained or owned group' do
it 'instructs to move the project to a group' do
create(:group).add_owner current_user
expect(helper.add_namespace_plan_to_group_instructions).to eq 'You&#39;ll have to <a href="/help/user/project/settings/index#transferring-an-existing-project-into-another-namespace" target="_blank" rel="noopener noreferrer">move this project</a> to one of your groups.'
end
end
context 'without a group' do
it 'instructs to create a group then move the project to a group' do
expect(helper.add_namespace_plan_to_group_instructions).to eq 'You don&#39;t have any groups. You&#39;ll need to <a href="/groups/new#create-group-pane">create one</a> and <a href="/help/user/project/settings/index#transferring-an-existing-project-into-another-namespace" target="_blank" rel="noopener noreferrer">move this project to it</a>.'
end
end
end
end
......@@ -5686,6 +5686,12 @@ msgstr ""
msgid "BillingPlans|While GitLab is ending availability of the Bronze plan, you can still renew your Bronze subscription one additional time before %{eoa_bronze_plan_end_date}. We are also offering a limited time free upgrade to our Premium Plan (up to 25 users)! Learn more about the changes and offers in our %{announcement_link}."
msgstr ""
msgid "BillingPlans|You don't have any groups. You'll need to %{create_group_link_start}create one%{create_group_link_end} and %{move_link_start}move this project to it%{move_link_end}."
msgstr ""
msgid "BillingPlans|You'll have to %{move_link_start}move this project%{move_link_end} to one of your groups."
msgstr ""
msgid "BillingPlans|Your GitLab.com %{plan} trial will %{strong_open}expire after %{expiration_date}%{strong_close}. You can retain access to the %{plan} features by upgrading below."
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