mirror of https://github.com/buster-so/buster.git
invite people restriction
This commit is contained in:
parent
aeaf7dbb57
commit
daf193088f
|
@ -16,6 +16,8 @@ export default function Page() {
|
||||||
const userOrganization = useUserConfigContextSelector((x) => x.userOrganizations);
|
const userOrganization = useUserConfigContextSelector((x) => x.userOrganizations);
|
||||||
const onToggleInviteModal = useInviteModalStore((s) => s.onToggleInviteModal);
|
const onToggleInviteModal = useInviteModalStore((s) => s.onToggleInviteModal);
|
||||||
const openInviteModal = useInviteModalStore((s) => s.openInviteModal);
|
const openInviteModal = useInviteModalStore((s) => s.openInviteModal);
|
||||||
|
const restrictNewUserInvitations =
|
||||||
|
useUserConfigContextSelector((x) => x.userOrganizations?.restrictNewUserInvitations) ?? true;
|
||||||
const firstOrganizationId = userOrganization?.id || '';
|
const firstOrganizationId = userOrganization?.id || '';
|
||||||
const { data: users, isFetched } = useGetOrganizationUsers(firstOrganizationId);
|
const { data: users, isFetched } = useGetOrganizationUsers(firstOrganizationId);
|
||||||
|
|
||||||
|
@ -43,9 +45,11 @@ export default function Page() {
|
||||||
setSearchText={handleSearchChange}
|
setSearchText={handleSearchChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button prefix={<Plus />} onClick={() => onToggleInviteModal(true)}>
|
{!restrictNewUserInvitations && (
|
||||||
Invite people
|
<Button prefix={<Plus />} onClick={() => onToggleInviteModal(true)}>
|
||||||
</Button>
|
Invite people
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -155,9 +155,10 @@ const tryGroup = (
|
||||||
|
|
||||||
export const SidebarPrimary = React.memo(() => {
|
export const SidebarPrimary = React.memo(() => {
|
||||||
const isAdmin = useUserConfigContextSelector((x) => x.isAdmin);
|
const isAdmin = useUserConfigContextSelector((x) => x.isAdmin);
|
||||||
|
const restrictNewUserInvitations =
|
||||||
|
useUserConfigContextSelector((x) => x.userOrganizations?.restrictNewUserInvitations) ?? true;
|
||||||
const isUserRegistered = useUserConfigContextSelector((x) => x.isUserRegistered);
|
const isUserRegistered = useUserConfigContextSelector((x) => x.isUserRegistered);
|
||||||
const currentParentRoute = useAppLayoutContextSelector((x) => x.currentParentRoute);
|
const currentParentRoute = useAppLayoutContextSelector((x) => x.currentParentRoute);
|
||||||
const isAnonymousUser = useUserConfigContextSelector((state) => state.userOrganizations);
|
|
||||||
const onToggleInviteModal = useInviteModalStore((s) => s.onToggleInviteModal);
|
const onToggleInviteModal = useInviteModalStore((s) => s.onToggleInviteModal);
|
||||||
const onOpenContactSupportModal = useContactSupportModalStore((s) => s.onOpenContactSupportModal);
|
const onOpenContactSupportModal = useContactSupportModalStore((s) => s.onOpenContactSupportModal);
|
||||||
|
|
||||||
|
@ -193,12 +194,19 @@ export const SidebarPrimary = React.memo(() => {
|
||||||
items.push(favoritesDropdownItems);
|
items.push(favoritesDropdownItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
items.push(tryGroup(onToggleInviteModal, () => onOpenContactSupportModal('feedback'), isAdmin));
|
items.push(
|
||||||
|
tryGroup(
|
||||||
|
onToggleInviteModal,
|
||||||
|
() => onOpenContactSupportModal('feedback'),
|
||||||
|
!restrictNewUserInvitations
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}, [
|
}, [
|
||||||
isUserRegistered,
|
isUserRegistered,
|
||||||
adminToolsItems,
|
adminToolsItems,
|
||||||
|
restrictNewUserInvitations,
|
||||||
yourStuffItems,
|
yourStuffItems,
|
||||||
favoritesDropdownItems,
|
favoritesDropdownItems,
|
||||||
onToggleInviteModal,
|
onToggleInviteModal,
|
||||||
|
|
Loading…
Reference in New Issue