From daf193088fe1593fef7088d62f89726170fe937a Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Sat, 12 Jul 2025 16:24:14 -0600 Subject: [PATCH] invite people restriction --- .../settings/(permissions)/users/page.tsx | 10 +++++++--- .../components/features/sidebars/SidebarPrimary.tsx | 12 ++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/web/src/app/app/(settings_layout)/settings/(permissions)/users/page.tsx b/apps/web/src/app/app/(settings_layout)/settings/(permissions)/users/page.tsx index 69975334f..43ccf48f5 100644 --- a/apps/web/src/app/app/(settings_layout)/settings/(permissions)/users/page.tsx +++ b/apps/web/src/app/app/(settings_layout)/settings/(permissions)/users/page.tsx @@ -16,6 +16,8 @@ export default function Page() { const userOrganization = useUserConfigContextSelector((x) => x.userOrganizations); const onToggleInviteModal = useInviteModalStore((s) => s.onToggleInviteModal); const openInviteModal = useInviteModalStore((s) => s.openInviteModal); + const restrictNewUserInvitations = + useUserConfigContextSelector((x) => x.userOrganizations?.restrictNewUserInvitations) ?? true; const firstOrganizationId = userOrganization?.id || ''; const { data: users, isFetched } = useGetOrganizationUsers(firstOrganizationId); @@ -43,9 +45,11 @@ export default function Page() { setSearchText={handleSearchChange} /> - + {!restrictNewUserInvitations && ( + + )} diff --git a/apps/web/src/components/features/sidebars/SidebarPrimary.tsx b/apps/web/src/components/features/sidebars/SidebarPrimary.tsx index a6c6dfee8..d553d2334 100644 --- a/apps/web/src/components/features/sidebars/SidebarPrimary.tsx +++ b/apps/web/src/components/features/sidebars/SidebarPrimary.tsx @@ -155,9 +155,10 @@ const tryGroup = ( export const SidebarPrimary = React.memo(() => { const isAdmin = useUserConfigContextSelector((x) => x.isAdmin); + const restrictNewUserInvitations = + useUserConfigContextSelector((x) => x.userOrganizations?.restrictNewUserInvitations) ?? true; const isUserRegistered = useUserConfigContextSelector((x) => x.isUserRegistered); const currentParentRoute = useAppLayoutContextSelector((x) => x.currentParentRoute); - const isAnonymousUser = useUserConfigContextSelector((state) => state.userOrganizations); const onToggleInviteModal = useInviteModalStore((s) => s.onToggleInviteModal); const onOpenContactSupportModal = useContactSupportModalStore((s) => s.onOpenContactSupportModal); @@ -193,12 +194,19 @@ export const SidebarPrimary = React.memo(() => { items.push(favoritesDropdownItems); } - items.push(tryGroup(onToggleInviteModal, () => onOpenContactSupportModal('feedback'), isAdmin)); + items.push( + tryGroup( + onToggleInviteModal, + () => onOpenContactSupportModal('feedback'), + !restrictNewUserInvitations + ) + ); return items; }, [ isUserRegistered, adminToolsItems, + restrictNewUserInvitations, yourStuffItems, favoritesDropdownItems, onToggleInviteModal,