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
29a657fd
Commit
29a657fd
authored
Jan 21, 2021
by
Michael Lunøe
Committed by
James Lopez
Jan 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix(subscirbable banner): handle self managed
Ensure that the expirence remains for self managed licenses
parent
24590717
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
4 deletions
+105
-4
ee/app/helpers/ee/subscribable_banner_helper.rb
ee/app/helpers/ee/subscribable_banner_helper.rb
+15
-2
ee/app/views/layouts/header/_ee_subscribable_banner.html.haml
...pp/views/layouts/header/_ee_subscribable_banner.html.haml
+2
-2
ee/changelogs/unreleased/customers-2499-mlunoe-update-renew-subscription-link-in-banner.yml
...-2499-mlunoe-update-renew-subscription-link-in-banner.yml
+5
-0
ee/spec/views/layouts/header/_ee_subscribable_banner.html.haml_spec.rb
.../layouts/header/_ee_subscribable_banner.html.haml_spec.rb
+83
-0
No files found.
ee/app/helpers/ee/subscribable_banner_helper.rb
View file @
29a657fd
...
...
@@ -21,8 +21,22 @@ module EE
@display_subscription_banner
=
true
end
def
renew_subscription_path
return
plan_renew_url
(
current_namespace
)
if
decorated_subscription
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/subscriptions"
end
def
upgrade_subscription_path
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/subscriptions"
end
private
def
current_namespace
@project
&
.
namespace
||
@group
end
def
license_message
(
signed_in:
signed_in?
,
is_admin:
current_user
&
.
admin?
,
license:
License
.
current
)
::
Gitlab
::
ExpiringSubscriptionMessage
.
new
(
subscribable:
license
,
...
...
@@ -33,13 +47,12 @@ module EE
def
subscription_message
entity
=
@project
||
@group
namespace
=
@project
&
.
namespace
||
@group
::
Gitlab
::
ExpiringSubscriptionMessage
.
new
(
subscribable:
decorated_subscription
,
signed_in:
signed_in?
,
is_admin:
can?
(
current_user
,
:owner_access
,
entity
),
namespace:
namespace
namespace:
current_
namespace
).
message
end
...
...
ee/app/views/layouts/header/_ee_subscribable_banner.html.haml
View file @
29a657fd
...
...
@@ -19,7 +19,7 @@
=
message
-
if
subscribable
.
block_changes?
=
link_to
_
(
'Upgrade your plan'
),
'https://customers.gitlab.com/subscriptions/my_renewal'
,
class:
'btn gl-button btn-primary'
,
data:
{
track_event:
'click_text'
,
track_label:
'subscribable_action'
,
track_property:
'upgrade'
}
=
link_to
_
(
'Upgrade your plan'
),
upgrade_subscription_path
,
class:
'btn gl-button btn-primary'
,
data:
{
track_event:
'click_text'
,
track_label:
'subscribable_action'
,
track_property:
'upgrade'
}
-
else
=
link_to
_
(
'Renew subscription'
),
'https://customers.gitlab.com/subscriptions/my_renewal'
,
class:
'btn gl-button btn-primary gl-mr-3 gl-mb-2'
,
data:
{
track_event:
'click_text'
,
track_label:
'subscribable_action'
,
track_property:
'renew'
}
=
link_to
_
(
'Renew subscription'
),
renew_subscription_path
,
class:
'btn gl-button btn-primary gl-mr-3 gl-mb-2'
,
data:
{
track_event:
'click_text'
,
track_label:
'subscribable_action'
,
track_property:
'renew'
}
=
link_to
_
(
'That is ok, I do not want to renew'
),
'#'
,
data:
{
track_event:
'click_text'
,
track_label:
'subscribable_action'
,
track_property:
'thats_ok'
},
'aria-label'
=>
'Dismiss'
,
class:
'btn gl-button btn-info btn-info-secondary js-close gl-mb-2'
ee/changelogs/unreleased/customers-2499-mlunoe-update-renew-subscription-link-in-banner.yml
0 → 100644
View file @
29a657fd
---
title
:
Update renew/upgrade banner with actionable links
merge_request
:
51705
author
:
type
:
added
ee/spec/views/layouts/header/_ee_subscribable_banner.html.haml_spec.rb
0 → 100644
View file @
29a657fd
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'layouts/header/_ee_subscribable_banner'
do
let
(
:group
)
{
build
(
:group
)
}
let
(
:project_namespace
)
{
build
(
:group
)
}
let
(
:project
)
{
build
(
:project
,
namespace:
project_namespace
)
}
let
(
:message
)
{
double
(
:message
)
}
before
do
allow
(
view
).
to
receive
(
:gitlab_subscription_or_license
).
and_return
(
license
)
allow
(
view
).
to
receive
(
:gitlab_subscription_message_or_license_message
).
and_return
(
message
)
end
shared_examples
'displays the correct link'
do
context
"when license will soon expire"
do
let
(
:license
)
{
build
(
:gitlab_license
,
expires_at:
Date
.
current
+
5
.
days
)
}
it
'shows the renew plan link'
do
expect
(
rendered
).
to
have_link
'Renew subscription'
,
href:
view
.
renew_subscription_path
end
context
"when license blocks changes"
do
let
(
:license
)
{
build
(
:gitlab_license
,
expires_at:
Date
.
current
+
5
.
days
,
block_changes_at:
Date
.
today
)
}
it
'shows the upgrade plan link'
do
expect
(
rendered
).
to
have_link
'Upgrade your plan'
,
href:
view
.
upgrade_subscription_path
end
end
end
context
"when license expired"
do
let
(
:license
)
{
build
(
:gitlab_license
,
expires_at:
Date
.
yesterday
)
}
it
'shows the renew plan link'
do
expect
(
rendered
).
to
have_link
'Renew subscription'
,
href:
view
.
renew_subscription_path
end
context
"when license blocks changes"
do
let
(
:license
)
{
build
(
:gitlab_license
,
expires_at:
Date
.
yesterday
,
block_changes_at:
Date
.
today
)
}
it
'shows the upgrade plan link'
do
expect
(
rendered
).
to
have_link
'Upgrade your plan'
,
href:
view
.
upgrade_subscription_path
end
end
end
end
context
'with a group'
do
before
do
assign
(
:group
,
group
)
render
end
it_behaves_like
'displays the correct link'
do
let
(
:namespace
)
{
group
}
end
end
context
'with a project'
do
before
do
assign
(
:project
,
project
)
render
end
it_behaves_like
'displays the correct link'
do
let
(
:namespace
)
{
project
.
namespace
}
end
end
context
'with both a group and a project'
do
before
do
assign
(
:group
,
group
)
assign
(
:project
,
project
)
render
end
it_behaves_like
'displays the correct link'
do
let
(
:namespace
)
{
project
.
namespace
}
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