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
07533e37
Commit
07533e37
authored
Jun 22, 2021
by
Alper Akgun
Committed by
Markus Koller
Jun 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add parameters to in app purchase links
Changelog: changed
parent
bc070a39
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
13 deletions
+42
-13
ee/app/helpers/billing_plans_helper.rb
ee/app/helpers/billing_plans_helper.rb
+8
-8
ee/app/views/groups/security/discover/show.html.haml
ee/app/views/groups/security/discover/show.html.haml
+3
-2
ee/app/views/projects/security/discover/show.html.haml
ee/app/views/projects/security/discover/show.html.haml
+3
-2
ee/spec/helpers/billing_plans_helper_spec.rb
ee/spec/helpers/billing_plans_helper_spec.rb
+28
-1
No files found.
ee/app/helpers/billing_plans_helper.rb
View file @
07533e37
...
...
@@ -133,6 +133,14 @@ module BillingPlansHelper
!
namespace
.
free_personal?
&&
namespace
.
eligible_for_trial?
end
def
plan_purchase_url
(
group
,
plan
)
if
use_new_purchase_flow?
(
group
)
new_subscriptions_path
(
plan_id:
plan
.
id
,
namespace_id:
group
.
id
,
source:
params
[
:source
])
else
"
#{
plan
.
purchase_link
.
href
}
&gl_namespace_id=
#{
group
.
id
}
"
end
end
private
def
add_seats_url
(
group
)
...
...
@@ -141,14 +149,6 @@ module BillingPlansHelper
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab/namespaces/
#{
group
.
id
}
/extra_seats"
end
def
plan_purchase_url
(
group
,
plan
)
if
use_new_purchase_flow?
(
group
)
new_subscriptions_path
(
plan_id:
plan
.
id
,
namespace_id:
group
.
id
)
else
"
#{
plan
.
purchase_link
.
href
}
&gl_namespace_id=
#{
group
.
id
}
"
end
end
def
plan_upgrade_url
(
group
,
plan
)
return
unless
group
&&
plan
&
.
id
...
...
ee/app/views/groups/security/discover/show.html.haml
View file @
07533e37
...
...
@@ -2,6 +2,7 @@
-
page_title
_
(
"Security"
)
-
add_page_specific_style
'page_bundles/security_discover'
-
linkFeedback
=
'https://gitlab.com/gitlab-org/growth/ui-ux/issues/25'
-
linkUpgrade
=
group_billings_path
(
@group
.
root_ancestor
)
-
content
=
'discover-group-security'
-
linkUpgrade
=
group_billings_path
(
@group
.
root_ancestor
,
source:
content
)
#js-security-discover-app
{
data:
{
group:
{
id:
@group
.
id
,
name:
@group
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
'discover-group-security'
),
secondary:
linkUpgrade
,
feedback:
linkFeedback
}
}
}
#js-security-discover-app
{
data:
{
group:
{
id:
@group
.
id
,
name:
@group
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
content
),
secondary:
linkUpgrade
,
feedback:
linkFeedback
}
}
}
ee/app/views/projects/security/discover/show.html.haml
View file @
07533e37
...
...
@@ -2,6 +2,7 @@
-
page_title
_
(
"Security Dashboard"
)
-
add_page_specific_style
'page_bundles/security_discover'
-
linkFeedback
=
'https://gitlab.com/gitlab-org/growth/ui-ux/issues/25'
-
linkUpgrade
=
@project
.
personal?
?
profile_billings_path
(
@project
.
group
)
:
group_billings_path
(
@project
.
root_ancestor
)
-
content
=
'discover-project-security'
-
linkUpgrade
=
@project
.
personal?
?
profile_billings_path
(
@project
.
group
,
source:
content
)
:
group_billings_path
(
@project
.
root_ancestor
,
source:
content
)
#js-security-discover-app
{
data:
{
project:
{
id:
@project
.
id
,
name:
@project
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
'discover-project-security'
),
secondary:
linkUpgrade
,
feedback:
linkFeedback
}
}
}
#js-security-discover-app
{
data:
{
project:
{
id:
@project
.
id
,
name:
@project
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
content
),
secondary:
linkUpgrade
,
feedback:
linkFeedback
}
}
}
ee/spec/helpers/billing_plans_helper_spec.rb
View file @
07533e37
...
...
@@ -3,6 +3,8 @@
require
'spec_helper'
RSpec
.
describe
BillingPlansHelper
do
include
Devise
::
Test
::
ControllerHelpers
describe
'#subscription_plan_data_attributes'
do
let
(
:customer_portal_url
)
{
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/subscriptions"
}
...
...
@@ -356,11 +358,36 @@ RSpec.describe BillingPlansHelper do
group
=
double
(
'Group'
,
upgradable?:
false
)
expect
(
helper
).
to
receive
(
:plan_purchase_url
)
helper
.
plan_purchase_or_upgrade_url
(
group
,
plan
)
end
end
describe
"#plan_purchase_url"
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:plan
)
{
double
(
'Plan'
,
id:
'123456789'
,
purchase_link:
double
(
'PurchaseLink'
,
href:
'987654321'
))
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
it
'builds correct url with some source'
do
allow
(
helper
).
to
receive
(
:use_new_purchase_flow?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:params
).
and_return
({
source:
'some_source'
})
expect
(
helper
).
to
receive
(
:new_subscriptions_path
).
with
(
plan_id:
plan
.
id
,
namespace_id:
group
.
id
,
source:
'some_source'
)
helper
.
plan_purchase_url
(
group
,
plan
)
end
it
'builds correct url for the old purchase flow'
do
allow
(
helper
).
to
receive
(
:use_new_purchase_flow?
).
and_return
(
false
)
expect
(
helper
.
plan_purchase_url
(
group
,
plan
)).
to
eq
(
"
#{
plan
.
purchase_link
.
href
}
&gl_namespace_id=
#{
group
.
id
}
"
)
end
end
describe
'#upgrade_button_css_classes'
do
using
RSpec
::
Parameterized
::
TableSyntax
...
...
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