Set case-insensitive sorting as default & Add a user pref to restore legacy behavior - Closes #347

This commit is contained in:
Bubka
2024-06-19 14:31:17 +02:00
parent 98ef297dc7
commit 2f05f4993c
4 changed files with 17 additions and 4 deletions

View File

@ -181,7 +181,10 @@ export const useTwofaccounts = defineStore({
* Sorts accounts ascending
*/
sortAsc() {
this.items.sort((a, b) => a.service > b.service ? 1 : -1)
if (useUserStore().preferences.sortCaseSensitive) {
this.items.sort((a, b) => a.service > b.service ? 1 : -1)
}
else this.items.sort((a, b) => a.service.toLowerCase() > b.service.toLowerCase() ? 1 : -1)
this.saveOrder()
},
@ -189,7 +192,10 @@ export const useTwofaccounts = defineStore({
* Sorts accounts descending
*/
sortDesc() {
this.items.sort((a, b) => a.service < b.service ? 1 : -1)
if (useUserStore().preferences.sortCaseSensitive) {
this.items.sort((a, b) => a.service < b.service ? 1 : -1)
}
else this.items.sort((a, b) => a.service.toLowerCase() < b.service.toLowerCase() ? 1 : -1)
this.saveOrder()
},