diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-01-08 01:09:42 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-01-08 01:09:42 +0000 |
commit | 710f2ec50c49d1e773acc20058ed584f1402de33 (patch) | |
tree | 32315f3a4c92d2ea6debacb6406a1aa650f9fe3e /app/assets/javascripts | |
parent | 1924a13ee27a442124009b8aae8a46c606a94acd (diff) | |
parent | 12b3a203228cef5946f1c8dc740ba739b1aed797 (diff) | |
download | gitlab-ce-710f2ec50c49d1e773acc20058ed584f1402de33.tar.gz |
Merge branch 'ce-5606-issues-and-mr-autocomplete-in-epics' into 'master'
CE backport of gitlab-ee!8936
See merge request gitlab-org/gitlab-ce!23976
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 8178821be3d..570d3b712e0 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -221,13 +221,13 @@ class GfmAutoComplete { displayTpl(value) { let tmpl = GfmAutoComplete.Loading.template; if (value.title != null) { - tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title); + tmpl = GfmAutoComplete.Issues.templateFunction(value); } return tmpl; }, data: GfmAutoComplete.defaultLoadingData, - // eslint-disable-next-line no-template-curly-in-string - insertTpl: '${atwho-at}${id}', + insertTpl: GfmAutoComplete.Issues.insertTemplateFunction, + skipSpecialCharacterTest: true, callbacks: { ...this.getDefaultCallbacks(), beforeSave(issues) { @@ -238,6 +238,7 @@ class GfmAutoComplete { return { id: i.iid, title: sanitize(i.title), + reference: i.reference, search: `${i.iid} ${i.title}`, }; }); @@ -287,13 +288,13 @@ class GfmAutoComplete { displayTpl(value) { let tmpl = GfmAutoComplete.Loading.template; if (value.title != null) { - tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title); + tmpl = GfmAutoComplete.Issues.templateFunction(value); } return tmpl; }, data: GfmAutoComplete.defaultLoadingData, - // eslint-disable-next-line no-template-curly-in-string - insertTpl: '${atwho-at}${id}', + insertTpl: GfmAutoComplete.Issues.insertTemplateFunction, + skipSpecialCharacterTest: true, callbacks: { ...this.getDefaultCallbacks(), beforeSave(merges) { @@ -304,6 +305,7 @@ class GfmAutoComplete { return { id: m.iid, title: sanitize(m.title), + reference: m.reference, search: `${m.iid} ${m.title}`, }; }); @@ -397,7 +399,7 @@ class GfmAutoComplete { displayTpl(value) { let tmpl = GfmAutoComplete.Loading.template; if (value.title != null) { - tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title); + tmpl = GfmAutoComplete.Issues.templateFunction(value); } return tmpl; }, @@ -596,8 +598,12 @@ GfmAutoComplete.Labels = { }; // Issues, MergeRequests and Snippets GfmAutoComplete.Issues = { - templateFunction(id, title) { - return `<li><small>${id}</small> ${_.escape(title)}</li>`; + insertTemplateFunction(value) { + // eslint-disable-next-line no-template-curly-in-string + return value.reference || '${atwho-at}${id}'; + }, + templateFunction({ id, title, reference }) { + return `<li><small>${reference || id}</small> ${_.escape(title)}</li>`; }, }; // Milestones |