From 40de82b463b43464989fe1aa32b2115ee0cefcd2 Mon Sep 17 00:00:00 2001
From: Malte Finsterwalder <malte@holi.team>
Date: Fri, 21 Feb 2025 18:04:47 +0100
Subject: [PATCH] HOLI-11064 fix: correctly pre-fill appointment inviteOnly for
 non-admins

---
 .../components/AppointmentCreateEditForm.tsx             | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/core/screens/spaces/appointments/components/AppointmentCreateEditForm.tsx b/core/screens/spaces/appointments/components/AppointmentCreateEditForm.tsx
index dd087d66f3..9ed985098e 100644
--- a/core/screens/spaces/appointments/components/AppointmentCreateEditForm.tsx
+++ b/core/screens/spaces/appointments/components/AppointmentCreateEditForm.tsx
@@ -61,7 +61,14 @@ const AppointmentCreateEditForm = ({ space, initialAppointment, headerTitle, onS
     >
       <AppointmentInputForm
         space={space}
-        initialAppointment={initialAppointment ?? getAppointmentDefaultInitialState({ spaceId: space.id })}
+        initialAppointment={
+          initialAppointment ??
+          getAppointmentDefaultInitialState({
+            spaceId: space.id,
+            // only admins can create spaces that are not inviteOnly, so for non-admins inviteOnly needs to be set to true
+            inviteOnly: !space?.connectionStatusToMyself?.includes(SpaceConnectionType.ADMINISTRATOR),
+          })
+        }
         onSubmit={onSubmit}
         onBackButtonPress={() => showConfirmationModal(true)}
       />
-- 
GitLab