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
66e84693
Commit
66e84693
authored
Aug 29, 2017
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fully freeze author token.
parent
b6b46f2e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+14
-2
app/assets/javascripts/service_desk_issues/filtered_search.js
...assets/javascripts/service_desk_issues/filtered_search.js
+28
-0
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
66e84693
...
...
@@ -338,9 +338,10 @@ class FilteredSearchManager {
this
.
filteredSearchInput
.
value
=
''
;
const
removeElements
=
[];
const
customValidator
=
this
.
customRemovalValidator
||
function
(
t
)
{
return
true
};
[].
forEach
.
call
(
this
.
tokensContainer
.
children
,
(
t
)
=>
{
if
(
t
.
classList
.
contains
(
'
js-visual-token
'
))
{
if
(
t
.
classList
.
contains
(
'
js-visual-token
'
)
&&
customValidator
(
t
)
)
{
removeElements
.
push
(
t
);
}
});
...
...
@@ -419,8 +420,18 @@ class FilteredSearchManager {
});
}
getAllParams
()
{
let
params
=
gl
.
utils
.
getUrlParamsArray
();
if
(
this
.
modifyUrlParams
)
{
params
=
this
.
modifyUrlParams
(
params
);
}
return
params
;
}
loadSearchParamsFromURL
()
{
const
params
=
gl
.
utils
.
getUrlParamsArray
();
const
params
=
this
.
getAllParams
();
const
usernameParams
=
this
.
getUsernameParams
();
let
hasFilteredSearch
=
false
;
...
...
@@ -566,6 +577,7 @@ class FilteredSearchManager {
getUsernameParams
()
{
const
usernamesById
=
{};
try
{
const
attribute
=
this
.
filteredSearchInput
.
getAttribute
(
'
data-username-params
'
);
JSON
.
parse
(
attribute
).
forEach
((
user
)
=>
{
...
...
app/assets/javascripts/service_desk_issues/filtered_search.js
View file @
66e84693
...
...
@@ -3,10 +3,38 @@ export default class FilteredSearchServiceDesk extends gl.FilteredSearchManager
super
(
'
service_desk
'
);
this
.
cantEdit
=
[
'
author
'
];
this
.
bindCustomCondition
();
}
bindCustomCondition
()
{
this
.
customRemovalValidator
=
function
(
token
)
{
const
originalValue
=
token
.
querySelector
(
'
.value-container
'
).
getAttribute
(
'
data-original-value
'
);
return
originalValue
!==
'
@support-bot
'
;
};
}
canEdit
(
tokenName
)
{
return
this
.
cantEdit
.
indexOf
(
tokenName
)
===
-
1
;
}
modifyUrlParams
(
paramsArray
)
{
const
support_bot_param
=
'
author_username=support-bot
'
;
let
replaced
=
false
;
const
modified
=
paramsArray
.
map
((
param
)
=>
{
const
author_index
=
param
.
indexOf
(
'
author_username
'
);
if
(
author_index
!==
-
1
)
{
replaced
=
true
;
return
support_bot_param
;
}
return
param
;
});
if
(
!
replaced
)
{
modified
.
push
(
support_bot_param
);
}
return
modified
;
}
}
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