Commit c525ec9b authored by Robert Speicher's avatar Robert Speicher Committed by Ruben Davila

Merge branch 'slash-commands-load-fix' into 'master'

Fixed slash commands not loading

## What does this MR do?

Fixes an issue with slash commands not working when the autocomplete source is loading & then the new issue button is clicked. This also fixes an issue where the autocomplete source is loaded on pages where it isn't actually needed.

## What are the relevant issue numbers?

Closes #21774, #21807

See merge request !6207
parent 01b896f3
......@@ -83,6 +83,8 @@ v 8.12.0 (unreleased)
- Require confirmation when not logged in for unsubscribe links !6223 (Maximiliano Perez Coto)
- Add `wiki_page_events` to project hook APIs (Ben Boeckel)
- Remove Gitorious import
- Loads GFM autocomplete source only when required
- Fix issue with slash commands not loading on new issue page
- Fix inconsistent background color for filter input field (ClemMakesApps)
- Remove prefixes from transition CSS property (ClemMakesApps)
- Add Sentry logging to API calls
......
......@@ -14,9 +14,6 @@
window.project_uploads_path = "#{namespace_project_uploads_path project.namespace,project}";
window.preview_markdown_path = "#{preview_markdown_path}";
- content_for :scripts_body do
= render "layouts/init_auto_complete" if current_user
- content_for :header_content do
.js-dropdown-menu-projects
.dropdown-menu.dropdown-select.dropdown-menu-projects
......
......@@ -7,3 +7,6 @@
= text_area_tag attr, nil, class: classes, placeholder: placeholder
%a.zen-control.zen-control-leave.js-zen-leave{ href: "#" }
= icon('compress')
- content_for :scripts_body do
= render "layouts/init_auto_complete" if current_user && (@target_project || @project)
require 'spec_helper'
describe 'GFM autocomplete loading', feature: true, js: true do
let(:project) { create(:project) }
before do
login_as :admin
visit namespace_project_path(project.namespace, project)
end
it 'does not load on project#show' do
expect(evaluate_script('GitLab.GfmAutoComplete.dataSource')).to eq('')
end
it 'loads on new issue page' do
visit new_namespace_project_issue_path(project.namespace, project)
expect(evaluate_script('GitLab.GfmAutoComplete.dataSource')).not_to eq('')
end
end
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