feat: use task parsing to search for lists

This commit is contained in:
kolaente 2021-11-03 21:08:06 +01:00
parent a404e42b2b
commit 912746ac08
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 6 additions and 9 deletions

View File

@ -109,11 +109,6 @@ export default {
results() {
let lists = []
if (this.searchMode === SEARCH_MODE_ALL || this.searchMode === SEARCH_MODE_LISTS) {
let query = this.query
if (this.searchMode === SEARCH_MODE_LISTS) {
query = query.substr(1)
}
const ncache = {}
const history = getHistory()
@ -124,7 +119,9 @@ export default {
}),
...Object.values(this.$store.state.lists)])]
lists = (allLists.filter(l => {
const {list} = this.parsedQuery
lists = list === null ? [] : (allLists.filter(l => {
if (typeof l === 'undefined' || l === null) {
return false
}
@ -141,7 +138,7 @@ export default {
return false
}
return l.title.toLowerCase().includes(query.toLowerCase())
return l.title.toLowerCase().includes(list.toLowerCase())
}) ?? [])
}
@ -249,10 +246,10 @@ export default {
if (this.query.startsWith('#')) {
return SEARCH_MODE_TASKS
}
if (this.query.startsWith('*')) {
if (assignees.length === 0 && list !== null && text === '' && labels.length === 0) {
return SEARCH_MODE_LISTS
}
if (assignees.length > 0 && list === '' && text === '' && labels.length === 0) {
if (assignees.length > 0 && list === null && text === '' && labels.length === 0) {
return SEARCH_MODE_TEAMS
}