Commit d9d138da authored by Bryce Johnson's avatar Bryce Johnson

Fixup nav and load support bot info from data attr.

parent ba89aff8
...@@ -578,7 +578,6 @@ class FilteredSearchManager { ...@@ -578,7 +578,6 @@ class FilteredSearchManager {
getUsernameParams() { getUsernameParams() {
const usernamesById = {}; const usernamesById = {};
try { try {
const attribute = this.filteredSearchInput.getAttribute('data-username-params'); const attribute = this.filteredSearchInput.getAttribute('data-username-params');
JSON.parse(attribute).forEach((user) => { JSON.parse(attribute).forEach((user) => {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
export default class FilteredSearchServiceDesk extends gl.FilteredSearchManager { export default class FilteredSearchServiceDesk extends gl.FilteredSearchManager {
constructor() { constructor() {
super('service_desk'); super('service_desk');
this.supportBotAttrs = JSON.parse(document.querySelector('.service-desk-issues').dataset.supportBot);
} }
customRemovalValidator(token) { customRemovalValidator(token) {
...@@ -16,7 +17,7 @@ export default class FilteredSearchServiceDesk extends gl.FilteredSearchManager ...@@ -16,7 +17,7 @@ export default class FilteredSearchServiceDesk extends gl.FilteredSearchManager
modifyUrlParams(paramsArray) { modifyUrlParams(paramsArray) {
const authorParamKey = 'author_username'; const authorParamKey = 'author_username';
// FIXME: Need to grab the value from a data attribute // FIXME: Need to grab the value from a data attribute
const supportBotParamPair = `${authorParamKey}=support-bot`; const supportBotParamPair = `${authorParamKey}=${this.supportBotAttrs.username}`;
const onlyValidParams = paramsArray.filter(param => param.indexOf(authorParamKey) === -1); const onlyValidParams = paramsArray.filter(param => param.indexOf(authorParamKey) === -1);
......
import FilteredSearchServiceDesk from './filtered_search'; import FilteredSearchServiceDesk from './filtered_search';
this.filteredSearchManager = new FilteredSearchServiceDesk(); document.addEventListener('DOMContentLoaded', () => {
this.filteredSearchManager = new FilteredSearchServiceDesk();
this.filteredSearchManager.setup(); this.filteredSearchManager.setup();
});
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
Labels Labels
- if EE::Gitlab::ServiceDesk.enabled?(project: @project) - if EE::Gitlab::ServiceDesk.enabled?(project: @project)
= nav_link(controller: [ :issues, :service_desk ]) do = 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_url(@project), title: 'Service Desk' do
%span Service Desk %span Service Desk
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
%span %span
Labels Labels
- 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
%span Service Desk
- if project_nav_tab? :milestones - if project_nav_tab? :milestones
= nav_link(controller: :milestones) do = nav_link(controller: :milestones) do
= link_to project_milestones_path(@project), title: 'Milestones' do = link_to project_milestones_path(@project), title: 'Milestones' do
......
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