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