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
7b9aa79d
Commit
7b9aa79d
authored
Jan 20, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pass username and id associations needed in the frontend
parent
41b6cfcf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
19 deletions
+37
-19
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
...avascripts/filtered_search/filtered_search_manager.js.es6
+24
-0
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+12
-18
app/views/shared/issuable/_search_bar.html.haml
app/views/shared/issuable/_search_bar.html.haml
+1
-1
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
View file @
7b9aa79d
...
@@ -85,6 +85,7 @@
...
@@ -85,6 +85,7 @@
loadSearchParamsFromURL() {
loadSearchParamsFromURL() {
const params = gl.utils.getUrlParamsArray();
const params = gl.utils.getUrlParamsArray();
const usernameParams = this.getUsernameParams();
const inputValues = [];
const inputValues = [];
params.forEach((p) => {
params.forEach((p) => {
...
@@ -115,6 +116,16 @@
...
@@ -115,6 +116,16 @@
}
}
inputValues.push(`${sanitizedKey}:${symbol}${quotationsToUse}${sanitizedValue}${quotationsToUse}`);
inputValues.push(`${sanitizedKey}:${symbol}${quotationsToUse}${sanitizedValue}${quotationsToUse}`);
} else if (!match && keyParam === 'assignee_id') {
const id = parseInt(value, 10);
if (usernameParams[id]) {
inputValues.push(`assignee:@${usernameParams[id]}`);
}
} else if (!match && keyParam === 'author_id') {
const id = parseInt(value, 10);
if (usernameParams[id]) {
inputValues.push(`author:@${usernameParams[id]}`);
}
} else if (!match && keyParam === 'search') {
} else if (!match && keyParam === 'search') {
inputValues.push(sanitizedValue);
inputValues.push(sanitizedValue);
}
}
...
@@ -164,6 +175,19 @@
...
@@ -164,6 +175,19 @@
Turbolinks.visit(`?scope=all&utf8=✓&${paths.join('&')}`);
Turbolinks.visit(`?scope=all&utf8=✓&${paths.join('&')}`);
}
}
getUsernameParams() {
const usernamesById = {};
try {
const attribute = this.filteredSearchInput.getAttribute('data-username-params');
JSON.parse(attribute).forEach((user) => {
usernamesById[user.id] = user.username;
});
} catch (e) {
// do nothing
}
return usernamesById;
}
}
}
window.gl = window.gl || {};
window.gl = window.gl || {};
...
...
app/controllers/projects/issues_controller.rb
View file @
7b9aa79d
...
@@ -23,8 +23,6 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -23,8 +23,6 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to
:html
respond_to
:html
def
index
def
index
return
redirect_to_fixed_params
if
params
[
:assignee_id
].
present?
||
params
[
:author_id
].
present?
@issues
=
issues_collection
@issues
=
issues_collection
@issues
=
@issues
.
page
(
params
[
:page
])
@issues
=
@issues
.
page
(
params
[
:page
])
if
@issues
.
out_of_range?
&&
@issues
.
total_pages
!=
0
if
@issues
.
out_of_range?
&&
@issues
.
total_pages
!=
0
...
@@ -35,6 +33,18 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -35,6 +33,18 @@ class Projects::IssuesController < Projects::ApplicationController
@labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
@project
.
id
,
title:
params
[
:label_name
]).
execute
@labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
@project
.
id
,
title:
params
[
:label_name
]).
execute
end
end
@users
=
[]
if
params
[
:assignee_id
].
present?
assignee
=
User
.
find_by_id
(
params
[
:assignee_id
])
@users
.
push
(
assignee
)
if
assignee
end
if
params
[
:author_id
].
present?
author
=
User
.
find_by_id
(
params
[
:author_id
])
@users
.
push
(
author
)
if
author
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
atom
{
render
layout:
false
}
format
.
atom
{
render
layout:
false
}
...
@@ -213,22 +223,6 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -213,22 +223,6 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
end
end
def
redirect_to_fixed_params
fixed_params
=
params
.
except
(
:assignee_id
,
:author_id
)
if
params
[
:assignee_id
].
present?
assignee
=
User
.
find_by_id
(
params
[
:assignee_id
])
fixed_params
.
merge!
(
assignee_username:
assignee
.
username
)
if
assignee
end
if
params
[
:author_id
].
present?
author
=
User
.
find_by_id
(
params
[
:author_id
])
fixed_params
.
merge!
(
author_username:
author
.
username
)
if
author
end
redirect_to
url_for
(
fixed_params
)
end
# Since iids are implemented only in 6.1
# Since iids are implemented only in 6.1
# user may navigate to issue page using old global ids.
# user may navigate to issue page using old global ids.
#
#
...
...
app/views/shared/issuable/_search_bar.html.haml
View file @
7b9aa79d
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
class:
"check_all_issues left"
class:
"check_all_issues left"
.issues-other-filters.filtered-search-container
.issues-other-filters.filtered-search-container
.filtered-search-input-container
.filtered-search-input-container
%input
.form-control.filtered-search
{
placeholder:
'Search or filter results...'
,
'data-id'
=>
'filtered-search'
,
'data-project-id'
=>
@project
.
id
}
%input
.form-control.filtered-search
{
placeholder:
'Search or filter results...'
,
'data-id'
=>
'filtered-search'
,
'data-project-id'
=>
@project
.
id
,
'data-username-params'
=>
@users
.
to_json
(
only:
[
:id
,
:username
])
}
=
icon
(
'filter'
)
=
icon
(
'filter'
)
%button
.clear-search.hidden
{
type:
'button'
}
%button
.clear-search.hidden
{
type:
'button'
}
=
icon
(
'times'
)
=
icon
(
'times'
)
...
...
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