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
96aad6d6
Commit
96aad6d6
authored
Nov 25, 2019
by
Shreyas Agarwal
Committed by
Nick Thomas
Nov 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Show plan of parent group on subgroup details page"
parent
d00e35f1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
6 deletions
+60
-6
ee/app/models/ee/namespace.rb
ee/app/models/ee/namespace.rb
+6
-3
ee/app/views/admin/_namespace_plan_badge.html.haml
ee/app/views/admin/_namespace_plan_badge.html.haml
+1
-1
ee/app/views/admin/_namespace_plan_info.html.haml
ee/app/views/admin/_namespace_plan_info.html.haml
+1
-1
ee/changelogs/unreleased/8831-show-plan-of-parent-group-on-subgroup-details-page.yml
...31-show-plan-of-parent-group-on-subgroup-details-page.yml
+5
-0
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+1
-1
ee/spec/models/namespace_spec.rb
ee/spec/models/namespace_spec.rb
+46
-0
No files found.
ee/app/models/ee/namespace.rb
View file @
96aad6d6
...
...
@@ -142,9 +142,12 @@ module EE
def
actual_plan
strong_memoize
(
:actual_plan
)
do
subscription
=
find_or_create_subscription
subscription
&
.
hosted_plan
||
Plan
.
free
||
Plan
.
default
if
parent_id
root_ancestor
.
actual_plan
else
subscription
=
find_or_create_subscription
subscription
&
.
hosted_plan
||
Plan
.
free
||
Plan
.
default
end
end
end
...
...
ee/app/views/admin/_namespace_plan_badge.html.haml
View file @
96aad6d6
-
namespace
=
local_assigns
.
fetch
(
:namespace
)
-
return
unless
Gitlab
::
CurrentSettings
.
should_check_namespace_plan?
&&
namespace
.
actual_plan
&
.
paid?
%span
.plan-badge.has-tooltip
{
data:
{
plan:
namespace
.
actual_plan
.
name
},
title:
"#{namespace.actual_plan.title} Plan"
}
%span
.plan-badge.has-tooltip
{
data:
{
plan:
namespace
.
actual_plan
_
name
},
title:
"#{namespace.actual_plan.title} Plan"
}
=
custom_icon
(
'icon_premium'
)
ee/app/views/admin/_namespace_plan_info.html.haml
View file @
96aad6d6
...
...
@@ -4,7 +4,7 @@
%li
%span
.light
Plan:
-
if
namespace
.
actual_plan
&
.
paid?
%strong
.plan-badge.inline
{
data:
{
plan:
namespace
.
actual_plan
.
name
}
}
%strong
.plan-badge.inline
{
data:
{
plan:
namespace
.
actual_plan
_
name
}
}
=
custom_icon
(
'icon_premium'
)
=
namespace
.
actual_plan
.
title
-
else
...
...
ee/changelogs/unreleased/8831-show-plan-of-parent-group-on-subgroup-details-page.yml
0 → 100644
View file @
96aad6d6
---
title
:
Resolve Show plan of root group on subgroup details page
merge_request
:
20218
author
:
type
:
added
ee/lib/ee/api/entities.rb
View file @
96aad6d6
...
...
@@ -147,7 +147,7 @@ module EE
namespace
.
billable_members_count
(
options
[
:requested_hosted_plan
])
end
expose
:plan
,
if:
->
(
namespace
,
opts
)
{
::
Ability
.
allowed?
(
opts
[
:current_user
],
:admin_namespace
,
namespace
)
}
do
|
namespace
,
_
|
namespace
.
actual_plan
&
.
name
namespace
.
actual_plan
_
name
end
end
end
...
...
ee/spec/models/namespace_spec.rb
View file @
96aad6d6
...
...
@@ -668,6 +668,32 @@ describe Namespace do
expect
(
namespace
.
gitlab_subscription
).
to
be_present
end
end
context
'when namespace is a subgroup with a parent'
do
let
(
:subgroup
)
{
create
(
:namespace
,
parent:
namespace
)
}
context
'when free plan does exist'
do
before
do
free_plan
end
it
'does not generates a subscription'
do
expect
(
subgroup
.
actual_plan
).
to
eq
(
free_plan
)
expect
(
subgroup
.
gitlab_subscription
).
not_to
be_present
end
end
context
'when namespace has a subscription associated'
do
before
do
create
(
:gitlab_subscription
,
namespace:
namespace
,
hosted_plan:
gold_plan
)
end
it
'returns the plan from the subscription'
do
expect
(
subgroup
.
actual_plan
).
to
eq
(
gold_plan
)
expect
(
subgroup
.
gitlab_subscription
).
not_to
be_present
end
end
end
end
end
...
...
@@ -687,6 +713,26 @@ describe Namespace do
expect
(
namespace
.
actual_plan_name
).
to
eq
'free'
end
end
context
'when namespace is a subgroup with a parent'
do
let
(
:subgroup
)
{
create
(
:namespace
,
parent:
namespace
)
}
context
'when namespace has a subscription associated'
do
before
do
create
(
:gitlab_subscription
,
namespace:
namespace
,
hosted_plan:
gold_plan
)
end
it
'returns an associated plan name'
do
expect
(
subgroup
.
actual_plan_name
).
to
eq
'gold'
end
end
context
'when namespace does not have subscription associated'
do
it
'returns a free plan name'
do
expect
(
subgroup
.
actual_plan_name
).
to
eq
'free'
end
end
end
end
describe
'#billable_members_count'
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