Commit 5f803f0f authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'autocomplete-comment-fix' into 'master'

Checks for undefined when inserting autocomplete into textarea

## What does this MR do?

Correctly checks for undefined before inserting anything into the textarea when using autocomplete. This happens because the loading indicator tries to insert `@undefined` which we dont want to insert.

See merge request !4561
parents 4fbb284c ef48dd01
......@@ -3,6 +3,7 @@
window.GitLab ?= {}
GitLab.GfmAutoComplete =
dataLoading: false
dataLoaded: false
dataSource: ''
......@@ -35,7 +36,7 @@ GitLab.GfmAutoComplete =
$.fn.atwho.default.callbacks.filter(query, data, searchKey)
beforeInsert: (value) ->
if value.indexOf('undefined')
if not GitLab.GfmAutoComplete.dataLoaded
@at
else
value
......@@ -182,6 +183,8 @@ GitLab.GfmAutoComplete =
$.getJSON(dataSource)
loadData: (data) ->
@dataLoaded = true
# load members
@input.atwho 'load', '@', data.members
# load issues
......
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