Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
45770951
Commit
45770951
authored
Feb 25, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'growth-60-apply-license-to-selected-group' into 'master'"
This reverts merge request !25126
parent
4ecc362c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
96 deletions
+11
-96
ee/app/controllers/subscriptions/groups_controller.rb
ee/app/controllers/subscriptions/groups_controller.rb
+1
-6
ee/app/controllers/subscriptions_controller.rb
ee/app/controllers/subscriptions_controller.rb
+7
-17
ee/app/views/subscriptions/groups/edit.html.haml
ee/app/views/subscriptions/groups/edit.html.haml
+1
-3
ee/spec/controllers/subscriptions/groups_controller_spec.rb
ee/spec/controllers/subscriptions/groups_controller_spec.rb
+0
-8
ee/spec/controllers/subscriptions_controller_spec.rb
ee/spec/controllers/subscriptions_controller_spec.rb
+0
-37
ee/spec/views/subscriptions/groups/edit.html.haml_spec.rb
ee/spec/views/subscriptions/groups/edit.html.haml_spec.rb
+2
-22
locale/gitlab.pot
locale/gitlab.pot
+0
-3
No files found.
ee/app/controllers/subscriptions/groups_controller.rb
View file @
45770951
...
...
@@ -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
...
...
ee/app/controllers/subscriptions_controller.rb
View file @
45770951
...
...
@@ -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
...
...
ee/app/views/subscriptions/groups/edit.html.haml
View file @
45770951
...
...
@@ -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
...
...
ee/spec/controllers/subscriptions/groups_controller_spec.rb
View file @
45770951
...
...
@@ -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
...
...
ee/spec/controllers/subscriptions_controller_spec.rb
View file @
45770951
...
...
@@ -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
ee/spec/views/subscriptions/groups/edit.html.haml_spec.rb
View file @
45770951
...
...
@@ -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
locale/gitlab.pot
View file @
45770951
...
...
@@ -18564,9 +18564,6 @@ msgstr ""
msgid "Subscription deletion failed."
msgstr ""
msgid "Subscription successfully applied to \"%{group_name}\""
msgstr ""
msgid "Subscription successfully created."
msgstr ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment