diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-22 00:09:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-22 00:09:30 +0300 |
commit | 664db1da1cd5951f09c0f54ff5e9dae16bcf1a92 (patch) | |
tree | 5e62895748848a94ed9775ffa5f017da4e83d25e /app/assets/javascripts/gfm_auto_complete.js | |
parent | c0b718a0dbd99e6c0d30e5bc55bdcf4a12946375 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/gfm_auto_complete.js')
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 49c47e9d778..18647cca0b2 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -538,7 +538,12 @@ class GfmAutoComplete { setupLabels($input) { const instance = this; const fetchData = this.fetchData.bind(this); - const LABEL_COMMAND = { LABEL: '/label', UNLABEL: '/unlabel', RELABEL: '/relabel' }; + const LABEL_COMMAND = { + LABEL: '/label', + LABELS: '/labels', + UNLABEL: '/unlabel', + RELABEL: '/relabel', + }; let command = ''; $input.atwho({ @@ -570,13 +575,9 @@ class GfmAutoComplete { matcher(flag, subtext) { const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext); - // Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands. + // Check if ~ is followed by '/label', '/labels', '/relabel' or '/unlabel' commands. command = subtextNodes.find((node) => { - if ( - node === LABEL_COMMAND.LABEL || - node === LABEL_COMMAND.RELABEL || - node === LABEL_COMMAND.UNLABEL - ) { + if (Object.values(LABEL_COMMAND).includes(node)) { return node; } return null; @@ -621,7 +622,7 @@ class GfmAutoComplete { // The `LABEL_COMMAND.RELABEL` is intentionally skipped // because we want to return all the labels (unfiltered) for that command. - if (command === LABEL_COMMAND.LABEL) { + if (command === LABEL_COMMAND.LABEL || command === LABEL_COMMAND.LABELS) { // Return labels with set: undefined. return data.filter((label) => !label.set); } else if (command === LABEL_COMMAND.UNLABEL) { |