diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2024-02-16 12:33:05 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-02-16 11:56:16 +0000 |
commit | a24a02deaf854dd916f81bb0ca5d37c1e8104402 (patch) | |
tree | dc64d681ed5654c270c45b7d4a99fcee69879559 | |
parent | d1785459e5b544fe008165647a7367bec1c5d005 (diff) |
fix(circles): sort fallback if not member of circle
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
-rw-r--r-- | src/components/AppNavigation/RootNavigation.vue | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/components/AppNavigation/RootNavigation.vue b/src/components/AppNavigation/RootNavigation.vue index 24fc14b8..1dabe82f 100644 --- a/src/components/AppNavigation/RootNavigation.vue +++ b/src/components/AppNavigation/RootNavigation.vue @@ -349,9 +349,22 @@ export default { circlesMenu() { const menu = this.circles || [] menu.sort((a, b) => { + // If user is member of a and b, sort by level if (a?.initiator?.level !== b?.initiator?.level && a?.initiator?.level && b?.initiator?.level) { return b.initiator.level - a.initiator.level } + + // If user is member of a and not b, sort a first + if (a.initiator && !b.initiator) { + return -1 + } + + // If user is member of b and not a, sort b first + if (!a.initiator && b.initiator) { + return 1 + } + + // Else we sort by name return naturalCompare(a.toString(), b.toString(), { caseInsensitive: true }) }) |