From 329b5ba5ff1b35ef3109945598adcdd3c515784e Mon Sep 17 00:00:00 2001 From: valentinkolb Date: Fri, 21 Jun 2024 16:03:45 +0200 Subject: [PATCH] feat(MessageEntriesModal): your can only put lists in BSS that have enabled chat --- .../events/e/:eventId/EventLists/ListSelect.tsx | 17 ++++++++++++----- .../EventLists/Search/MessageEntriesModal.tsx | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/pages/events/e/:eventId/EventLists/ListSelect.tsx b/src/pages/events/e/:eventId/EventLists/ListSelect.tsx index 7b609e8..a024d26 100644 --- a/src/pages/events/e/:eventId/EventLists/ListSelect.tsx +++ b/src/pages/events/e/:eventId/EventLists/ListSelect.tsx @@ -5,7 +5,10 @@ import {EventListModel, EventModel} from "@/models/EventTypes.ts"; import RecordSearchInput, {GenericRecordSearchInputProps} from "@/components/input/RecordSearchInput.tsx"; -export default function ListSelect(props: GenericRecordSearchInputProps & { event?: EventModel }) { +export default function ListSelect(props: GenericRecordSearchInputProps & { + event?: EventModel, + filter?: string +}) { const {pb} = usePB() @@ -19,18 +22,22 @@ export default function ListSelect(props: GenericRecordSearchInputProps { - const filter: string[] = [] + const f: string[] = [] if (search) { - filter.push(`name ~ "${search}"`) + f.push(`name ~ "${search}"`) } if (props.event) { - filter.push(`event='${props.event.id}'`) + f.push(`event='${props.event.id}'`) + } + + if (props.filter) { + f.push(props.filter) } return (await pb.collection('eventLists').getList(1, 5, { - filter: filter.join(" && "), + filter: f.join(" && "), })).items } }) diff --git a/src/pages/events/e/:eventId/EventLists/Search/MessageEntriesModal.tsx b/src/pages/events/e/:eventId/EventLists/Search/MessageEntriesModal.tsx index 004da76..7d19e2e 100644 --- a/src/pages/events/e/:eventId/EventLists/Search/MessageEntriesModal.tsx +++ b/src/pages/events/e/:eventId/EventLists/Search/MessageEntriesModal.tsx @@ -107,6 +107,7 @@ export default function MessageEntriesModal({opened, event, onClose, query}: { formValues.setFieldValue("selectedLists", ls)} placeholder={"BCC"}