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
3ce7f23a
Commit
3ce7f23a
authored
Nov 08, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where search terms would not work after switching to another state tab
parent
53b4d1b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
...avascripts/filtered_search/filtered_search_manager.js.es6
+15
-7
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
View file @
3ce7f23a
...
@@ -55,12 +55,13 @@
...
@@ -55,12 +55,13 @@
loadSearchParamsFromURL() {
loadSearchParamsFromURL() {
// We can trust that each param has one & since values containing & will be encoded
// We can trust that each param has one & since values containing & will be encoded
const params = window.location.search.split('&');
// Remove the first character of search as it is always ?
const params = window.location.search.slice(1).split('&');
let inputValue = '';
let inputValue = '';
params.forEach((p) => {
params.forEach((p) => {
const split = p.split('=');
const split = p.split('=');
const key =
split[0]
;
const key =
decodeURIComponent(split[0])
;
const value = decodeURIComponent(split[1]);
const value = decodeURIComponent(split[1]);
const match = validTokenKeys.find((t) => {
const match = validTokenKeys.find((t) => {
...
@@ -69,17 +70,24 @@
...
@@ -69,17 +70,24 @@
if (match) {
if (match) {
const sanitizedKey = key.slice(0, key.indexOf('_'));
const sanitizedKey = key.slice(0, key.indexOf('_'));
let sanitizedValue = value
;
const valueHasSpace = value.indexOf(' ') !== -1
;
if (match && sanitizedKey === 'label') {
const preferredQuotations = '"';
sanitizedValue = sanitizedValue.replace(/%20/g, ' ');
let quotationsToUse = preferredQuotations;
if (valueHasSpace) {
// Prefer ", but use ' if required
quotationsToUse = value.indexOf(preferredQuotations) === -1 ? preferredQuotations : '\'';
}
}
inputValue += `${sanitizedKey}:${sanitizedValue} `;
inputValue += valueHasSpace ? `${sanitizedKey}:${quotationsToUse}${value}${quotationsToUse}` : `${sanitizedKey}:${value}`;
inputValue += ' ';
} else if (!match && key === 'search') {
} else if (!match && key === 'search') {
// Sanitize value as URL converts spaces into +
// Sanitize value as URL converts spaces into +
const sanitizedValue = value.replace(/[+]/g, ' ');
const sanitizedValue = value.replace(/[+]/g, ' ');
inputValue += `${sanitizedValue} `;
inputValue += sanitizedValue;
inputValue += ' ';
}
}
});
});
...
...
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