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
47ccbc7c
Commit
47ccbc7c
authored
Aug 25, 2020
by
Dallas Reedy
Committed by
Nick Thomas
Aug 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Omit sub-groups from trial eligibility
parent
1858d57b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
6 deletions
+19
-6
ee/app/models/ee/namespace.rb
ee/app/models/ee/namespace.rb
+1
-0
ee/changelogs/unreleased/228781-stop-subgroups-from-being-able-to-create-trials.yml
...28781-stop-subgroups-from-being-able-to-create-trials.yml
+5
-0
ee/spec/helpers/ee/trial_helper_spec.rb
ee/spec/helpers/ee/trial_helper_spec.rb
+4
-6
ee/spec/models/user_spec.rb
ee/spec/models/user_spec.rb
+9
-0
No files found.
ee/app/models/ee/namespace.rb
View file @
47ccbc7c
...
...
@@ -40,6 +40,7 @@ module EE
scope
:eligible_for_trial
,
->
do
left_joins
(
gitlab_subscription: :hosted_plan
)
.
where
(
parent_id:
nil
,
gitlab_subscriptions:
{
trial:
[
nil
,
false
],
trial_ends_on:
[
nil
]
},
plans:
{
name:
[
nil
,
*::
Plan
::
PLANS_ELIGIBLE_FOR_TRIAL
]
}
)
...
...
ee/changelogs/unreleased/228781-stop-subgroups-from-being-able-to-create-trials.yml
0 → 100644
View file @
47ccbc7c
---
title
:
Omit sub-groups from trial selection menu
merge_request
:
40300
author
:
type
:
fixed
ee/spec/helpers/ee/trial_helper_spec.rb
View file @
47ccbc7c
...
...
@@ -64,7 +64,7 @@ RSpec.describe EE::TrialHelper do
let_it_be
(
:subgroup2
)
{
create
:group
,
parent:
group2
,
name:
'Sub-Group 2'
}
let_it_be
(
:subsubgroup1
)
{
create
:group
,
parent:
subgroup2
,
name:
'Sub-Sub-Group 1'
}
let
(
:
all_groups
)
{
[
group1
,
group2
,
subgroup1
,
subgroup2
,
subsubgroup1
].
map
(
&
:id
)
}
let
(
:
top_level_groups
)
{
[
group1
,
group2
].
map
(
&
:id
)
}
before
do
group1
.
add_owner
(
user
)
...
...
@@ -72,7 +72,7 @@ RSpec.describe EE::TrialHelper do
end
context
'and none of the groups have subscriptions'
do
it
{
is_expected
.
to
eq
(
al
l_groups
)
}
it
{
is_expected
.
to
eq
(
top_leve
l_groups
)
}
end
context
'and the groups have subscriptions'
do
...
...
@@ -89,7 +89,7 @@ RSpec.describe EE::TrialHelper do
let!
(
:subscription_subsubgroup1
)
{
create
:gitlab_subscription
,
:free
,
*
subsubgroup1_traits
,
namespace:
subsubgroup1
}
context
'and none of the groups have been trialed yet'
do
it
{
is_expected
.
to
eq
(
al
l_groups
)
}
it
{
is_expected
.
to
eq
(
top_leve
l_groups
)
}
end
context
'and some of the groups are being or have been trialed'
do
...
...
@@ -97,9 +97,7 @@ RSpec.describe EE::TrialHelper do
let
(
:subgroup1_traits
)
{
:expired_trial
}
let
(
:subgroup2_traits
)
{
:active_trial
}
let
(
:some_groups
)
{
[
group2
,
subsubgroup1
].
map
(
&
:id
)
}
it
{
is_expected
.
to
eq
(
some_groups
)
}
it
{
is_expected
.
to
eq
([
group2
.
id
])
}
end
context
'and all of the groups are being or have been trialed'
do
...
...
ee/spec/models/user_spec.rb
View file @
47ccbc7c
...
...
@@ -1058,6 +1058,7 @@ RSpec.describe User do
let_it_be
(
:non_trialed_group_z
)
{
create
:group
,
name:
'Zeta'
,
gitlab_subscription:
create
(
:gitlab_subscription
,
:free
)
}
let_it_be
(
:non_trialed_group_a
)
{
create
:group
,
name:
'Alpha'
,
gitlab_subscription:
create
(
:gitlab_subscription
,
:free
)
}
let_it_be
(
:trialed_group
)
{
create
:group
,
name:
'Omitted'
,
gitlab_subscription:
create
(
:gitlab_subscription
,
:free
,
trial:
true
)
}
let_it_be
(
:non_trialed_subgroup
)
{
create
:group
,
name:
'Sub-group'
,
gitlab_subscription:
create
(
:gitlab_subscription
,
:free
),
parent:
non_trialed_group_a
}
subject
{
user
.
manageable_groups_eligible_for_trial
}
...
...
@@ -1105,6 +1106,14 @@ RSpec.describe User do
it
{
is_expected
.
to
eq
[
non_trialed_group_a
,
non_trialed_group_z
]
}
end
context
'owner of a top-level group with a sub-group'
do
before
do
non_trialed_group_a
.
add_owner
(
user
)
end
it
{
is_expected
.
to
eq
[
non_trialed_group_a
]
}
end
end
describe
'#active_for_authentication?'
do
...
...
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