Skip to content
Snippets Groups Projects
Commit ee8747e8 authored by Martin Giger's avatar Martin Giger Committed by Georg Krause
Browse files

Only suggest existing tag once

parent e38d0a37
No related branches found
No related tags found
No related merge requests found
Pipeline #14686 failed
Only suggest typed tag once if it already exists
...@@ -52,7 +52,16 @@ export default { ...@@ -52,7 +52,16 @@ export default {
...response, ...response,
} }
if (currentSearch) { if (currentSearch) {
response.results = [{name: currentSearch}, ...response.results] let existingTag = response.results.find((result) => result.name === currentSearch)
if (existingTag) {
if (response.results.indexOf(existingTag) !== 0) {
response.results = [existingTag, ...response.results]
response.results.splice(response.results.indexOf(existingTag) + 1, 1)
}
}
else {
response.results = [{name: currentSearch}, ...response.results]
}
} }
return response return response
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment