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
7c5774a4
Commit
7c5774a4
authored
May 20, 2021
by
Vitaly Slobodin
Committed by
Mikołaj Wawrzyniak
May 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide billing plans with hide card attribute
parent
aee6da52
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
18 deletions
+26
-18
ee/app/helpers/subscriptions_helper.rb
ee/app/helpers/subscriptions_helper.rb
+2
-2
ee/changelogs/unreleased/vs-hide-plans-with-hide-card-attr.yml
...angelogs/unreleased/vs-hide-plans-with-hide-card-attr.yml
+5
-0
ee/spec/helpers/subscriptions_helper_spec.rb
ee/spec/helpers/subscriptions_helper_spec.rb
+19
-16
No files found.
ee/app/helpers/subscriptions_helper.rb
View file @
7c5774a4
...
...
@@ -34,13 +34,13 @@ module SubscriptionsHelper
GitlabSubscriptions
::
FetchSubscriptionPlansService
.
new
(
plan: :free
).
execute
.
map
(
&
:symbolize_keys
)
.
reject
{
|
plan_data
|
plan_data
[
:free
]
}
.
map
{
|
plan_data
|
plan_data
.
slice
(
:id
,
:code
,
:price_per_year
,
:deprecated
,
:name
)
}
.
map
{
|
plan_data
|
plan_data
.
slice
(
:id
,
:code
,
:price_per_year
,
:deprecated
,
:name
,
:hide_card
)
}
end
def
subscription_available_plans
return
plans_data
unless
::
Feature
.
enabled?
(
:hide_deprecated_billing_plans
)
plans_data
.
reject
{
|
plan_data
|
plan_data
[
:deprecated
]
}
plans_data
.
reject
{
|
plan_data
|
plan_data
[
:deprecated
]
||
plan_data
[
:hide_card
]
}
end
def
present_groups
(
groups
)
...
...
ee/changelogs/unreleased/vs-hide-plans-with-hide-card-attr.yml
0 → 100644
View file @
7c5774a4
---
title
:
Hide billing plans with truthy hide_card attribute
merge_request
:
61990
author
:
type
:
fixed
ee/spec/helpers/subscriptions_helper_spec.rb
View file @
7c5774a4
...
...
@@ -83,26 +83,29 @@ RSpec.describe SubscriptionsHelper do
it
{
is_expected
.
to
include
(
available_plans:
'[{"id":"bronze_id","code":"bronze","price_per_year":48.0,"deprecated":true,"name":"Bronze Plan"}]'
)
}
end
context
'when ff purchase_deprecated_plans is enabled'
do
before
do
stub_feature_flags
(
hide_deprecated_billing_plans:
true
)
context
'when bronze_plan has hide_card attribute set to true'
do
let
(
:bronze_plan
)
do
{
"id"
=>
"bronze_id"
,
"name"
=>
"Bronze Plan"
,
"deprecated"
=>
false
,
"hide_card"
=>
true
,
"free"
=>
false
,
"code"
=>
"bronze"
,
"price_per_year"
=>
48.0
}
end
it
{
is_expected
.
to
include
(
available_plans:
'[{"id":"bronze_id","code":"bronze","price_per_year":48.0,"name":"Bronze Plan"}]'
)
}
context
'when bronze_plan is deprecated'
do
let
(
:bronze_plan
)
do
{
"id"
=>
"bronze_id"
,
"name"
=>
"Bronze Plan"
,
"deprecated"
=>
true
,
"free"
=>
false
,
"code"
=>
"bronze"
,
"price_per_year"
=>
48.0
}
context
'and is set to hide_deprecated_billing_plans true'
do
before
do
stub_feature_flags
(
hide_deprecated_billing_plans:
true
)
end
it
{
is_expected
.
to
include
(
available_plans:
'[]'
)
}
it
{
is_expected
.
not_to
include
(
available_plans:
"[{
\"
id
\"
:
\"
bronze_id
\"
,
\"
code
\"
:
\"
bronze
\"
,
\"
price_per_year
\"
:48.0,
\"
deprecated
\"
:false,
\"
name
\"
:
\"
Bronze Plan
\"
,
\"
hide_card
\"
:true}]"
)
}
end
context
'and is set to false'
do
it
{
is_expected
.
to
include
(
available_plans:
"[{
\"
id
\"
:
\"
bronze_id
\"
,
\"
code
\"
:
\"
bronze
\"
,
\"
price_per_year
\"
:48.0,
\"
deprecated
\"
:false,
\"
name
\"
:
\"
Bronze Plan
\"
,
\"
hide_card
\"
:true}]"
)
}
end
end
end
...
...
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