mirror of https://github.com/nextcloud/bookmarks
enh(BookmarksList): Search for folders
fixes #2076 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
9db199a989
commit
74d214907e
|
@ -125,9 +125,21 @@ export default {
|
|||
},
|
||||
subFolders() {
|
||||
if (this.$route.name === this.routes.SHARED_FOLDERS) {
|
||||
// Show shared folders
|
||||
return Object.keys(this.$store.state.sharedFoldersById)
|
||||
.map(folderId => this.$store.getters.getFolder(folderId)[0])
|
||||
}
|
||||
if (this.$route.name === this.routes.SEARCH) {
|
||||
// Search folders
|
||||
const searchFolder = (folder) => {
|
||||
const results = folder.children.flatMap(searchFolder)
|
||||
if (this.$store.state.fetchState.query.search.some(term => term.trim() && folder.title.toLowerCase().includes(term.toLowerCase()))) {
|
||||
results.push(folder)
|
||||
}
|
||||
return results
|
||||
}
|
||||
return this.$store.getters.getFolder(-1)[0].children.flatMap(searchFolder)
|
||||
}
|
||||
if (this.$route.name !== this.routes.HOME && this.$route.name !== this.routes.FOLDER) {
|
||||
return []
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue