Skip to content
Snippets Groups Projects
Commit 815fbc81 authored by Georg Krause's avatar Georg Krause
Browse files

Merge branch '1427-duplicate-tag' into 'develop'

Only suggest existing tag once

See merge request !1301
parents e11f7edf 263e29df
Branches
No related tags found
No related merge requests found
Only suggest typed tag once if it already exists
...@@ -52,8 +52,17 @@ export default { ...@@ -52,8 +52,17 @@ export default {
...response, ...response,
} }
if (currentSearch) { if (currentSearch) {
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] 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