Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(circles): sort fallback if not member of circle #3809

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/components/AppNavigation/RootNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,22 @@
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

Check warning on line 357 in src/components/AppNavigation/RootNavigation.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/RootNavigation.vue#L357

Added line #L357 was not covered by tests
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

Check warning on line 364 in src/components/AppNavigation/RootNavigation.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/RootNavigation.vue#L364

Added line #L364 was not covered by tests
}

// Else we sort by name
return naturalCompare(a.toString(), b.toString(), { caseInsensitive: true })
})

Expand Down
Loading