Skip to content

Commit f206f24

Browse files
committed
fix(DialogChooseFolder): Sort folders according to sort order setting
fixes #1269 Signed-off-by: Marcel Klehr <[email protected]>
1 parent cc17f9b commit f206f24

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/ui/components/native/DialogChooseFolder.vue

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,26 @@ export default {
6666
selectedFolder: this.value,
6767
}
6868
},
69+
computed: {
70+
accountId() {
71+
return this.$route.params.accountId
72+
},
73+
sortBy() {
74+
return this.accountId && this.$store.state.accounts[this.accountId].data.sortBy
75+
}
76+
},
6977
methods: {
7078
filterOutBookmarks(item) {
79+
let children = item.children
80+
.filter(child => !child.url)
81+
.map(child => this.filterOutBookmarks(child))
82+
if (this.sortBy === 'title') {
83+
children = children.toSorted((a, b) =>
84+
a.title < b.title ? -1 : a.title > b.title ? 1 : 0)
85+
}
7186
return {
7287
...item,
73-
children: item.children
74-
.filter(child => !child.url)
75-
.map(child => this.filterOutBookmarks(child))
88+
children,
7689
}
7790
},
7891
onUpdateSelection(active) {
@@ -89,4 +102,4 @@ export default {
89102

90103
<style scoped>
91104
92-
</style>
105+
</style>

0 commit comments

Comments
 (0)