From 8a6c26696f4cb4a02b82883fd12927c3ff1b1694 Mon Sep 17 00:00:00 2001
From: Spectralitree <72747870+Spectralitree@users.noreply.github.com>
Date: Tue, 21 Dec 2021 00:20:25 +0100
Subject: [PATCH] feat: filtering members & groups based on if they are in no
group
---
src/lib/group/List.svelte | 16 +++++++++++-----
src/lib/member/List.svelte | 14 ++++++++++----
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/lib/group/List.svelte b/src/lib/group/List.svelte
index d7a00c6e..83ac152b 100644
--- a/src/lib/group/List.svelte
+++ b/src/lib/group/List.svelte
@@ -114,14 +114,18 @@
let memberFilteredList = [];
$: memberFilteredList = sortedList.filter((item: Group) => {
+ if (memberSearchMode === "none") {
+ if (item.members && item.members.length > 0) return false;
+ }
+
if (selectedMembers.length < 1) return true;
switch (memberSearchMode) {
- case "include": if (selectedMembers.some(value => item.members.includes(value))) return true;
+ case "include": if (item.members && selectedMembers.some(value => item.members.includes(value))) return true;
break;
- case "exclude": if (selectedMembers.every(value => !item.members.includes(value))) return true;
+ case "exclude": if (item.members && selectedMembers.every(value => !item.members.includes(value))) return true;
break;
- case "match": if (selectedMembers.every(value => item.members.includes(value))) return true;
+ case "match": if (item.members && selectedMembers.every(value => item.members.includes(value))) return true;
break;
default: return true;
}
@@ -231,9 +235,11 @@
memberSearchMode = "include"}>{@html memberSearchMode === "include" ? "include" : "include"}
| memberSearchMode = "exclude"}>{@html memberSearchMode === "exclude" ? "exclude" : "exclude"}
| memberSearchMode = "match"}>{@html memberSearchMode === "match" ? "exact match" : "exact match"}
+ | memberSearchMode = "none"}>{@html memberSearchMode === "none" ? "none" : "none"}