From 422e5d2ebd38a44145dab78dc3afec113eeb3809 Mon Sep 17 00:00:00 2001 From: BlankParticle Date: Thu, 29 Aug 2024 23:22:49 +0530 Subject: [PATCH] fix: disallow slecting contacts (ref #711) --- .../convo/_components/create-convo-form.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx b/apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx index ce1fd519..320ccc85 100644 --- a/apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx +++ b/apps/web/src/app/[orgShortcode]/convo/_components/create-convo-form.tsx @@ -927,6 +927,16 @@ function ParticipantsComboboxPopover({ keywords={participant.keywords} onSelect={(value) => { if (participant.own) return; + if ( + disabled && + // Allow un-selecting if already selected somehow + !selectedParticipants.find( + (_) => _.publicId === participant.publicId + ) && + (participant.type === 'contact' || + participant.type === 'email') + ) + return showDisabledMessage(); setSelectedParticipants((prev) => prev.find((p) => p.publicId === value) ? prev.filter((p) => p.publicId !== value)