Commit 69b585fa authored by Bryce Johnson's avatar Bryce Johnson

Clean filtered_search.js.

parent e9be9d5d
......@@ -3,11 +3,16 @@
export default class FilteredSearchServiceDesk extends gl.FilteredSearchManager {
constructor() {
super('service_desk');
this.supportBotAttrs = JSON.parse(document.querySelector('.service-desk-issues').dataset.supportBot);
this.supportBotAttrs = JSON.parse(
document.querySelector('.service-desk-issues').dataset.supportBot,
);
}
customRemovalValidator(token) {
return token.querySelector('.value-container').getAttribute('data-original-value') !== '@support-bot';
const tokenValue = token.querySelector('.value-container');
return tokenValue ? tokenValue.getAttribute('data-original-value') !== `@${this.supportBotAttrs.username}` : true;
}
canEdit(tokenName) {
......@@ -16,9 +21,7 @@ export default class FilteredSearchServiceDesk extends gl.FilteredSearchManager
modifyUrlParams(paramsArray) {
const authorParamKey = 'author_username';
// FIXME: Need to grab the value from a data attribute
const supportBotParamPair = `${authorParamKey}=${this.supportBotAttrs.username}`;
const onlyValidParams = paramsArray.filter(param => param.indexOf(authorParamKey) === -1);
// unshift ensures author param is always first token element
......
......@@ -29,7 +29,7 @@
- if EE::Gitlab::ServiceDesk.enabled?(project: @project)
= nav_link(controller: :issues, action: :service_desk ) do
= link_to service_desk_project_issues_url(@project), title: 'Service Desk' do
= link_to service_desk_project_issues_path(@project), title: 'Service Desk' do
%span Service Desk
- if project_nav_tab? :milestones
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment