feat(MessageEntriesModal): your can only put lists in BSS that have enabled chat
Build and Push Docker image / build-and-push (push) Successful in 4m42s Details

This commit is contained in:
Valentin Kolb 2024-06-21 16:03:45 +02:00
parent 886cf8278e
commit 329b5ba5ff
2 changed files with 13 additions and 5 deletions

View File

@ -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<EventListModel> & { event?: EventModel }) {
export default function ListSelect(props: GenericRecordSearchInputProps<EventListModel> & {
event?: EventModel,
filter?: string
}) {
const {pb} = usePB()
@ -19,18 +22,22 @@ export default function ListSelect(props: GenericRecordSearchInputProps<EventLis
recordSearchMutation={
useMutation({
mutationFn: async (search: string) => {
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
}
})

View File

@ -107,6 +107,7 @@ export default function MessageEntriesModal({opened, event, onClose, query}: {
<ListSelect
event={event}
filter={`enableChat=true`}
selectedRecords={formValues.values.selectedLists}
setSelectedRecords={(ls) => formValues.setFieldValue("selectedLists", ls)}
placeholder={"BCC"}