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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
e369323d
Commit
e369323d
authored
Jan 30, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix filtered search user autocomplete for gitlab instances that are hosted on a subdirectory
parent
96baf2bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
11 deletions
+61
-11
app/assets/javascripts/filtered_search/dropdown_user.js.es6
app/assets/javascripts/filtered_search/dropdown_user.js.es6
+1
-1
changelogs/unreleased/27343-autocomplete-post-to-wrong-url-when-not-hosting-in-root.yml
...tocomplete-post-to-wrong-url-when-not-hosting-in-root.yml
+5
-0
spec/javascripts/filtered_search/dropdown_user_spec.js.es6
spec/javascripts/filtered_search/dropdown_user_spec.js.es6
+35
-0
spec/javascripts/project_title_spec.js
spec/javascripts/project_title_spec.js
+10
-5
spec/javascripts/search_autocomplete_spec.js
spec/javascripts/search_autocomplete_spec.js
+10
-5
No files found.
app/assets/javascripts/filtered_search/dropdown_user.js.es6
View file @
e369323d
...
...
@@ -8,7 +8,7 @@ require('./filtered_search_dropdown');
super(droplab, dropdown, input, filter);
this.config = {
droplabAjaxFilter: {
endpoint:
'/autocomplete/users.json'
,
endpoint:
`${gon.relative_url_root || ''}/autocomplete/users.json`
,
searchKey: 'search',
params: {
per_page: 20,
...
...
changelogs/unreleased/27343-autocomplete-post-to-wrong-url-when-not-hosting-in-root.yml
0 → 100644
View file @
e369323d
---
title
:
Fix filtered search user autocomplete for gitlab instances that are hosted
on a subdirectory
merge_request
:
8891
author
:
spec/javascripts/filtered_search/dropdown_user_spec.js.es6
View file @
e369323d
...
...
@@ -36,5 +36,40 @@ require('~/filtered_search/dropdown_user');
expect(dropdownUser.getSearchInput()).toBe('larry boy');
});
});
describe('config droplabAjaxFilter\'s endpoint', () => {
beforeEach(() => {
spyOn(gl.FilteredSearchDropdown.prototype, 'constructor').and.callFake(() => {});
spyOn(gl.DropdownUser.prototype, 'getProjectId').and.callFake(() => {});
});
it('should return endpoint', () => {
window.gon = {
relative_url_root: '',
};
const dropdown = new gl.DropdownUser();
expect(dropdown.config.droplabAjaxFilter.endpoint).toBe('/autocomplete/users.json');
});
it('should return endpoint when relative_url_root is undefined', () => {
const dropdown = new gl.DropdownUser();
expect(dropdown.config.droplabAjaxFilter.endpoint).toBe('/autocomplete/users.json');
});
it('should return endpoint with relative url when available', () => {
window.gon = {
relative_url_root: '/gitlab_directory',
};
const dropdown = new gl.DropdownUser();
expect(dropdown.config.droplabAjaxFilter.endpoint).toBe('/gitlab_directory/autocomplete/users.json');
});
afterEach(() => {
window.gon = {};
});
});
});
})();
spec/javascripts/project_title_spec.js
View file @
e369323d
...
...
@@ -9,19 +9,20 @@ require('~/project_select');
require
(
'
~/project
'
);
(
function
()
{
window
.
gon
||
(
window
.
gon
=
{});
window
.
gon
.
api_version
=
'
v3
'
;
describe
(
'
Project Title
'
,
function
()
{
preloadFixtures
(
'
static/project_title.html.raw
'
);
loadJSONFixtures
(
'
projects.json
'
);
beforeEach
(
function
()
{
loadFixtures
(
'
static/project_title.html.raw
'
);
window
.
gon
=
{};
window
.
gon
.
api_version
=
'
v3
'
;
return
this
.
project
=
new
Project
();
});
return
describe
(
'
project list
'
,
function
()
{
describe
(
'
project list
'
,
function
()
{
var
fakeAjaxResponse
=
function
fakeAjaxResponse
(
req
)
{
var
d
;
expect
(
req
.
url
).
toBe
(
'
/api/v3/projects.json?simple=true
'
);
...
...
@@ -48,5 +49,9 @@ require('~/project');
return
expect
(
$
(
'
.header-content
'
).
hasClass
(
'
open
'
)).
toBe
(
false
);
});
});
afterEach
(()
=>
{
window
.
gon
=
{};
});
});
}).
call
(
this
);
spec/javascripts/search_autocomplete_spec.js
View file @
e369323d
...
...
@@ -14,11 +14,6 @@ require('vendor/fuzzaldrin-plus');
userId
=
1
;
window
.
gon
||
(
window
.
gon
=
{});
window
.
gon
.
current_user_id
=
userId
;
window
.
gon
.
current_username
=
userName
;
dashboardIssuesPath
=
'
/dashboard/issues
'
;
dashboardMRsPath
=
'
/dashboard/merge_requests
'
;
...
...
@@ -117,6 +112,16 @@ require('vendor/fuzzaldrin-plus');
widget
=
new
gl
.
SearchAutocomplete
;
// Prevent turbolinks from triggering within gl_dropdown
spyOn
(
window
.
gl
.
utils
,
'
visitUrl
'
).
and
.
returnValue
(
true
);
window
.
gon
=
{};
window
.
gon
.
current_user_id
=
userId
;
window
.
gon
.
current_username
=
userName
;
return
widget
=
new
gl
.
SearchAutocomplete
;
});
afterEach
(
function
()
{
window
.
gon
=
{};
});
it
(
'
should show Dashboard specific dropdown menu
'
,
function
()
{
var
list
;
...
...
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