Commit 45770951 authored by Rémy Coutable's avatar Rémy Coutable

Revert "Merge branch 'growth-60-apply-license-to-selected-group' into 'master'"

This reverts merge request !25126
parent 4ecc362c
......@@ -13,12 +13,7 @@ module Subscriptions
def update
if Groups::UpdateService.new(@group, current_user, group_params).execute
notice = if params[:new_user] == 'true'
_('Welcome to GitLab, %{first_name}!' % { first_name: current_user.first_name })
else
_('Subscription successfully applied to "%{group_name}"' % { group_name: @group.name })
end
notice = _('Welcome to GitLab, %{first_name}!' % { first_name: current_user.first_name })
redirect_to group_path(@group), notice: notice
else
@group.path = @group.path_before_last_save || @group.path_was
......
......@@ -47,15 +47,10 @@ class SubscriptionsController < ApplicationController
def create
current_user.update(setup_for_company: true) if params[:setup_for_company]
if params[:selected_group]
group = current_user.free_namespaces.find(params[:selected_group])
else
group_name = params[:setup_for_company] ? customer_params[:company] : "#{current_user.name}'s Group"
path = Namespace.clean_path(group_name)
group = Groups::CreateService.new(current_user, name: group_name, path: path).execute
return render json: group.errors.to_json unless group.persisted?
end
group_name = params[:setup_for_company] ? customer_params[:company] : "#{current_user.name}'s Group"
path = Namespace.clean_path(group_name)
group = Groups::CreateService.new(current_user, name: group_name, path: path).execute
return render json: group.errors.to_json unless group.persisted?
response = Subscriptions::CreateService.new(
current_user,
......@@ -65,14 +60,9 @@ class SubscriptionsController < ApplicationController
).execute
if response[:success]
redirect_location = if params[:selected_group]
group_path(group)
else
plan_id, quantity = subscription_params.values_at(:plan_id, :quantity)
edit_subscriptions_group_path(group.path, plan_id: plan_id, quantity: quantity, new_user: params[:new_user])
end
response[:data] = { location: redirect_location }
plan_id, quantity = subscription_params.values_at(:plan_id, :quantity)
response[:data] = { location: edit_subscriptions_group_path(group.path, plan_id: plan_id, quantity: quantity) }
track_paid_signup_flow_event('end', label: plan_id, value: quantity)
end
......
......@@ -10,15 +10,13 @@
- number_of_users = n_('1 user', '%{num} users', params[:quantity].to_i) % { num: params[:quantity] }
%p= _('You have successfully purchased a %{plan} plan subscription for %{seats}. You’ll receive a receipt via email.') % { plan: plan_title, seats: number_of_users }
.edit-group.d-flex.flex-column.align-items-center.gl-pt-5
- if params[:new_user]
#progress-bar
#progress-bar
%h2.center= _('Create a group for your organization')
%p
%div= _('A group represents your organization in GitLab.')
%div= _('Your %{plan} plan will be applied to your group.' % { plan: plan_title })
= form_for [:subscriptions, @group], html: { class: 'gl-show-field-errors card w-100 gl-p-3' } do |f|
= hidden_field_tag :new_user, params[:new_user]
= form_errors(@group)
.row
.form-group.group-name-holder.col-sm-12
......
......@@ -68,14 +68,6 @@ describe Subscriptions::GroupsController do
expect(subject).to have_gitlab_http_status(:redirect)
expect(subject).to redirect_to('/new-path')
end
it { is_expected.to set_flash[:notice].to('Subscription successfully applied to "New name"') }
context 'with new_user param' do
subject { post :update, params: { id: group.to_param, group: params, new_user: 'true' } }
it { is_expected.to set_flash[:notice].to("Welcome to GitLab, #{user.first_name}!") }
end
end
context 'when the group cannot be saved' do
......
......@@ -212,43 +212,6 @@ describe SubscriptionsController do
expect(response.body).to eq('{"errors":"error message"}')
end
end
context 'when selecting an existing group' do
let_it_be(:selected_group) { create(:group) }
let(:params) do
{
selected_group: selected_group.id,
customer: { country: 'NL' },
subscription: { plan_id: 'x', quantity: 1 }
}
end
before do
selected_group.add_owner(user)
end
it 'does not create a group' do
expect { subject }.to not_change { Group.count }
end
it 'returns the selected group location in JSON format' do
subject
expect(response.body).to eq({ location: "/#{selected_group.path}" }.to_json)
end
end
context 'when selecting a non existing group' do
let(:params) do
{
selected_group: -1,
customer: { country: 'NL' },
subscription: { plan_id: 'x', quantity: 1 }
}
end
it { is_expected.to have_gitlab_http_status(:not_found) }
end
end
end
end
......@@ -13,9 +13,9 @@ describe 'subscriptions/groups/edit' do
allow(view).to receive(:current_user).and_return(User.new)
end
let(:quantity) { '1' }
context 'a single user' do
let(:quantity) { '1' }
it 'displays the correct notification for 1 user' do
render
......@@ -32,24 +32,4 @@ describe 'subscriptions/groups/edit' do
expect(rendered).to have_text('You have successfully purchased a Bronze plan subscription for 2 users. You’ll receive a receipt via email.')
end
end
context 'with new_user in the params' do
before do
allow(view).to receive(:params).and_return(new_user: 'true')
end
it 'displays the progress bar' do
render
expect(rendered).to have_selector('#progress-bar')
end
end
context 'without new_user in the params' do
it 'does not display the progress bar' do
render
expect(rendered).not_to have_selector('#progress-bar')
end
end
end
......@@ -18564,9 +18564,6 @@ msgstr ""
msgid "Subscription deletion failed."
msgstr ""
msgid "Subscription successfully applied to \"%{group_name}\""
msgstr ""
msgid "Subscription successfully created."
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