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
0587322e
Commit
0587322e
authored
Apr 26, 2019
by
Hiroyuki Sato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix license app with relative url
parent
0b65725f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletion
+48
-1
ee/app/helpers/license_helper.rb
ee/app/helpers/license_helper.rb
+10
-1
ee/changelogs/unreleased/fix-license-app-with-relative-url.yml
...angelogs/unreleased/fix-license-app-with-relative-url.yml
+5
-0
ee/spec/helpers/license_helper_spec.rb
ee/spec/helpers/license_helper_spec.rb
+33
-0
No files found.
ee/app/helpers/license_helper.rb
View file @
0587322e
...
...
@@ -112,9 +112,18 @@ module LicenseHelper
def
license_app_data
{
data:
{
current_active_user_count:
current_active_user_count
,
licenses_path:
api_v4_licenses_path
,
delete_license_path:
api_v4_license_path
(
id:
':id'
),
licenses_path:
api_licenses_url
,
delete_license_path:
api_license_url
(
id:
':id'
),
new_license_path:
new_admin_license_path
,
download_license_path:
download_admin_license_path
}
}
end
def
api_licenses_url
expose_url
(
api_v4_licenses_path
)
end
def
api_license_url
(
args
)
expose_url
(
api_v4_license_path
(
args
))
end
extend
self
end
ee/changelogs/unreleased/fix-license-app-with-relative-url.yml
0 → 100644
View file @
0587322e
---
title
:
Fix error retrieving licenses when relative URL in use
merge_request
:
11717
author
:
Hiroyuki Sato
type
:
fixed
ee/spec/helpers/license_helper_spec.rb
View file @
0587322e
require
'spec_helper'
describe
LicenseHelper
do
def
stub_default_url_options
(
host:
"localhost"
,
protocol:
"http"
,
port:
nil
,
script_name:
''
)
url_options
=
{
host:
host
,
protocol:
protocol
,
port:
port
,
script_name:
script_name
}
allow
(
Rails
.
application
.
routes
).
to
receive
(
:default_url_options
).
and_return
(
url_options
)
end
describe
'#license_message'
do
context
'no license installed'
do
before
do
...
...
@@ -23,4 +28,32 @@ describe LicenseHelper do
end
end
end
describe
'#api_licenses_url'
do
it
'returns licenses API url'
do
stub_default_url_options
expect
(
api_licenses_url
).
to
eq
(
'http://localhost/api/v4/licenses'
)
end
it
'returns licenses API url with relative url'
do
stub_default_url_options
(
script_name:
'/gitlab'
)
expect
(
api_licenses_url
).
to
eq
(
'http://localhost/gitlab/api/v4/licenses'
)
end
end
describe
'#api_license_url'
do
it
'returns license API url'
do
stub_default_url_options
expect
(
api_license_url
(
id:
1
)).
to
eq
(
'http://localhost/api/v4/license/1'
)
end
it
'returns license API url with relative url'
do
stub_default_url_options
(
script_name:
'/gitlab'
)
expect
(
api_license_url
(
id:
1
)).
to
eq
(
'http://localhost/gitlab/api/v4/license/1'
)
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