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
4e6d7554
Commit
4e6d7554
authored
Dec 14, 2020
by
Mark Chao
Committed by
Igor Drozdov
Dec 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix namespace billing page accessing billable members
Other than groups, a namespace can be passed
parent
51ab9e7b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
18 deletions
+48
-18
ee/app/assets/javascripts/billings/subscriptions/components/subscription_table_row.vue
...lings/subscriptions/components/subscription_table_row.vue
+4
-2
ee/app/assets/javascripts/billings/subscriptions/index.js
ee/app/assets/javascripts/billings/subscriptions/index.js
+2
-0
ee/app/helpers/billing_plans_helper.rb
ee/app/helpers/billing_plans_helper.rb
+9
-8
ee/spec/frontend/billings/subscriptions/components/subscription_table_row_spec.js
...s/subscriptions/components/subscription_table_row_spec.js
+18
-5
ee/spec/helpers/billing_plans_helper_spec.rb
ee/spec/helpers/billing_plans_helper_spec.rb
+15
-3
No files found.
ee/app/assets/javascripts/billings/subscriptions/components/subscription_table_row.vue
View file @
4e6d7554
...
...
@@ -26,12 +26,14 @@ export default {
default
:
false
,
},
},
inject
:
[
'
billableSeatsHref
'
],
inject
:
[
'
billableSeatsHref
'
,
'
isGroup
'
],
computed
:
{
...
mapState
([
'
hasBillableGroupMembers
'
]),
},
created
()
{
if
(
this
.
isGroup
)
{
this
.
fetchHasBillableGroupMembers
();
}
},
methods
:
{
...
mapActions
([
'
fetchHasBillableGroupMembers
'
]),
...
...
ee/app/assets/javascripts/billings/subscriptions/index.js
View file @
4e6d7554
...
...
@@ -16,6 +16,7 @@ export default (containerId = 'js-billing-plans') => {
namespaceId
,
namespaceName
,
addSeatsHref
,
isGroup
,
planUpgradeHref
,
planRenewHref
,
customerPortalUrl
,
...
...
@@ -29,6 +30,7 @@ export default (containerId = 'js-billing-plans') => {
namespaceId
,
namespaceName
,
addSeatsHref
,
isGroup
,
planUpgradeHref
,
planRenewHref
,
customerPortalUrl
,
...
...
ee/app/helpers/billing_plans_helper.rb
View file @
4e6d7554
...
...
@@ -9,17 +9,18 @@ module BillingPlansHelper
number_to_currency
(
value
,
unit:
'$'
,
strip_insignificant_zeros:
true
,
format:
"%u%n"
)
end
def
subscription_plan_data_attributes
(
group
,
plan
)
return
{}
unless
group
def
subscription_plan_data_attributes
(
namespace
,
plan
)
return
{}
unless
namespace
{
namespace_id:
group
.
id
,
namespace_name:
group
.
name
,
add_seats_href:
add_seats_url
(
group
),
plan_upgrade_href:
plan_upgrade_url
(
group
,
plan
),
plan_renew_href:
plan_renew_url
(
group
),
namespace_id:
namespace
.
id
,
namespace_name:
namespace
.
name
,
is_group:
namespace
.
group?
,
add_seats_href:
add_seats_url
(
namespace
),
plan_upgrade_href:
plan_upgrade_url
(
namespace
,
plan
),
plan_renew_href:
plan_renew_url
(
namespace
),
customer_portal_url:
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/subscriptions"
,
billable_seats_href:
billable_seats_href
(
group
)
billable_seats_href:
billable_seats_href
(
namespace
)
}
end
...
...
ee/spec/frontend/billings/subscriptions/components/subscription_table_row_spec.js
View file @
4e6d7554
...
...
@@ -39,7 +39,11 @@ describe('subscription table row', () => {
const
defaultProps
=
{
header
:
HEADER
,
columns
:
COLUMNS
};
const
createComponent
=
({
props
=
{},
billableSeatsHref
=
BILLABLE_SEATS_URL
}
=
{})
=>
{
const
createComponent
=
({
props
=
{},
billableSeatsHref
=
BILLABLE_SEATS_URL
,
isGroup
=
true
,
}
=
{})
=>
{
if
(
wrapper
)
{
throw
new
Error
(
'
wrapper already exists!
'
);
}
...
...
@@ -51,6 +55,7 @@ describe('subscription table row', () => {
},
provide
:
{
billableSeatsHref
,
isGroup
,
},
store
,
localVue
,
...
...
@@ -86,13 +91,21 @@ describe('subscription table row', () => {
.
at
(
0
)
.
find
(
'
[data-testid="seats-usage-button"]
'
);
describe
(
'
d
efault
'
,
()
=>
{
beforeEach
(
()
=>
{
describe
(
'
d
ispatched actions
'
,
()
=>
{
it
(
'
dispatches action when created if namespace is group
'
,
()
=>
{
createComponent
();
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
fetchHasBillableGroupMembers
'
);
});
it
(
'
dispatches correct actions when created
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
fetchHasBillableGroupMembers
'
);
it
(
'
does not dispatch action when created if namespace is not group
'
,
()
=>
{
createComponent
({
isGroup
:
false
});
expect
(
store
.
dispatch
).
not
.
toHaveBeenCalledWith
(
'
fetchHasBillableGroupMembers
'
);
});
});
describe
(
'
default
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
});
it
(
`should render one header cell and
${
COLUMNS
.
length
}
visible columns in total`
,
()
=>
{
...
...
ee/spec/helpers/billing_plans_helper_spec.rb
View file @
4e6d7554
...
...
@@ -21,6 +21,7 @@ RSpec.describe BillingPlansHelper do
expect
(
helper
.
subscription_plan_data_attributes
(
group
,
plan
))
.
to
eq
(
namespace_id:
group
.
id
,
namespace_name:
group
.
name
,
is_group:
true
,
add_seats_href:
add_seats_href
,
plan_upgrade_href:
upgrade_href
,
plan_renew_href:
renew_href
,
...
...
@@ -48,6 +49,7 @@ RSpec.describe BillingPlansHelper do
expect
(
helper
.
subscription_plan_data_attributes
(
group
,
plan
))
.
to
eq
(
namespace_id:
group
.
id
,
namespace_name:
group
.
name
,
is_group:
true
,
customer_portal_url:
customer_portal_url
,
billable_seats_href:
billable_seats_href
,
add_seats_href:
add_seats_href
,
...
...
@@ -55,6 +57,16 @@ RSpec.describe BillingPlansHelper do
plan_upgrade_href:
nil
)
end
end
context
'when namespace is passed in'
do
it
'returns false for is_group'
do
namespace
=
build
(
:namespace
)
result
=
helper
.
subscription_plan_data_attributes
(
namespace
,
plan
)
expect
(
result
).
to
include
(
is_group:
false
)
end
end
end
describe
'#use_new_purchase_flow?'
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