fix: search for assignees by username (#2264)

Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2264
This commit is contained in:
konrad 2022-08-16 21:26:54 +00:00
parent a84fb8b5df
commit c6e7390f13

View file

@ -500,6 +500,14 @@ export default defineComponent({
return return
} }
// Don't load things if we already have something loaded.
// This is not the most ideal solution because it prevents a re-population when filters are changed
// from the outside. It is still fine because we're not changing them from the outside, other than
// loading them initially.
if(this[kind].length > 0) {
return
}
this[kind] = await this[`${servicePrefix}Service`].getAll({}, {s: this.filters[filterName]}) this[kind] = await this[`${servicePrefix}Service`].getAll({}, {s: this.filters[filterName]})
}, },
setDoneFilter() { setDoneFilter() {
@ -532,6 +540,7 @@ export default defineComponent({
if (query === '') { if (query === '') {
this.clear(kind) this.clear(kind)
return
} }
const response = await this[`${kind}Service`].getAll({}, {s: query}) const response = await this[`${kind}Service`].getAll({}, {s: query})
@ -558,7 +567,7 @@ export default defineComponent({
let ids = [] let ids = []
this[kind].forEach(u => { this[kind].forEach(u => {
ids.push(u.id) ids.push(kind === 'users' ? u.username : u.id)
}) })
this.filters[filterName] = ids.join(',') this.filters[filterName] = ids.join(',')