mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 23:49:16 +02:00
Only suggest existing tag once
This commit is contained in:
parent
e11f7edf07
commit
263e29df7d
2 changed files with 11 additions and 1 deletions
1
changes/changelog.d/1427.bugfix
Normal file
1
changes/changelog.d/1427.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Only suggest typed tag once if it already exists
|
|
@ -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
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue