Fix: Various project invite fixes (#4505)
This commit is contained in:
@@ -23,6 +23,16 @@
|
||||
</FormButton>
|
||||
</div>
|
||||
</form>
|
||||
<p v-if="!isAdmin && isInWorkspace" class="text-foreground-2 text-body-2xs py-3">
|
||||
Project owners without admin rights can only add existing workspace members.
|
||||
</p>
|
||||
<p v-else-if="isInWorkspace" class="text-foreground-2 text-body-2xs py-3">
|
||||
Users not currently in the workspace will be added with a free viewer seat. Read
|
||||
more about
|
||||
<NuxtLink :to="LearnMoreRolesSeatsUrl" class="underline" target="_blank">
|
||||
Speckle roles and seats.
|
||||
</NuxtLink>
|
||||
</p>
|
||||
</LayoutDialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -40,6 +50,7 @@ import type {
|
||||
import { useInviteUserToProject } from '~~/lib/projects/composables/projectManagement'
|
||||
import { useMixpanel } from '~~/lib/core/composables/mp'
|
||||
import { Roles } from '@speckle/shared'
|
||||
import { LearnMoreRolesSeatsUrl } from '~~/lib/common/helpers/route'
|
||||
|
||||
graphql(`
|
||||
fragment InviteDialogProject_Project on Project {
|
||||
@@ -116,7 +127,11 @@ const onSubmit = handleSubmit(async () => {
|
||||
const inputs: ProjectInviteCreateInput[] | WorkspaceProjectInviteCreateInput[] =
|
||||
invites.map((u) => ({
|
||||
role: u.projectRole,
|
||||
...(isAdmin.value ? { email: u.email } : { userId: u.userId }),
|
||||
...(isInWorkspace.value
|
||||
? isAdmin.value
|
||||
? { email: u.email }
|
||||
: { userId: u.userId }
|
||||
: { email: u.email }),
|
||||
...(props.project?.workspace?.id
|
||||
? {
|
||||
workspaceRole: u.project?.id
|
||||
@@ -126,7 +141,10 @@ const onSubmit = handleSubmit(async () => {
|
||||
: {})
|
||||
}))
|
||||
|
||||
if (!inputs.length) return
|
||||
if (!inputs.length) {
|
||||
isOpen.value = false
|
||||
return
|
||||
}
|
||||
|
||||
await createInvite(props.project.id, inputs)
|
||||
|
||||
|
||||
@@ -100,11 +100,12 @@ const loading = ref(false)
|
||||
|
||||
const canUpdate = computed(() => pageResult.value?.project?.permissions?.canUpdate)
|
||||
const canInvite = computed(() =>
|
||||
workspace?.value?.id ? projectRole.value !== Roles.Stream.Reviewer : isOwner.value
|
||||
project.value?.workspaceId
|
||||
? isOwner.value || workspace.value?.role === Roles.Workspace.Admin
|
||||
: isOwner.value
|
||||
)
|
||||
const project = computed(() => pageResult.value?.project)
|
||||
const workspace = computed(() => project.value?.workspace)
|
||||
const projectRole = computed(() => project.value?.role)
|
||||
const updateRole = useUpdateUserRole(project)
|
||||
const { collaboratorListItems, isOwner } = useTeamInternals(project, workspace)
|
||||
|
||||
|
||||
@@ -13,8 +13,9 @@ export const emptyInviteServerItem: InviteServerItem = {
|
||||
|
||||
export const emptyInviteProjectItem: InviteProjectItem = {
|
||||
email: '',
|
||||
userId: undefined,
|
||||
serverRole: Roles.Server.User,
|
||||
projectRole: Roles.Stream.Contributor,
|
||||
projectRole: Roles.Stream.Reviewer,
|
||||
project: undefined
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user