feat(server+fe): Implement LimitedWorkspace for PendingWorkspaceCollaborator (#4984)
This commit is contained in:
committed by
GitHub
parent
e12f050d83
commit
2fddcd78b7
@@ -139,7 +139,7 @@ import {
|
||||
import { deleteOldAndInsertNewVerificationFactory } from '@/modules/emails/repositories'
|
||||
import { renderEmail } from '@/modules/emails/services/emailRendering'
|
||||
import { sendEmail } from '@/modules/emails/services/sending'
|
||||
import { isWorkspaceRole } from '@/modules/workspaces/domain/logic'
|
||||
import { isWorkspaceRole, toLimitedWorkspace } from '@/modules/workspaces/domain/logic'
|
||||
import {
|
||||
addOrUpdateStreamCollaboratorFactory,
|
||||
isStreamCollaboratorFactory,
|
||||
@@ -1864,17 +1864,11 @@ export = FF_WORKSPACES_MODULE_ENABLED
|
||||
}
|
||||
},
|
||||
PendingWorkspaceCollaborator: {
|
||||
workspaceName: async (parent, _args, ctx) => {
|
||||
workspace: async (parent, _args, ctx) => {
|
||||
const workspace = await ctx.loaders.workspaces!.getWorkspace.load(
|
||||
parent.workspaceId
|
||||
)
|
||||
return workspace!.name
|
||||
},
|
||||
workspaceSlug: async (parent, _args, ctx) => {
|
||||
const workspace = await ctx.loaders.workspaces!.getWorkspace.load(
|
||||
parent.workspaceId
|
||||
)
|
||||
return workspace!.slug
|
||||
return toLimitedWorkspace(workspace!)
|
||||
},
|
||||
invitedBy: async (parent, _args, ctx) => {
|
||||
const { invitedById } = parent
|
||||
|
||||
@@ -17,8 +17,10 @@ export const basicPendingWorkspaceCollaboratorFragment = gql`
|
||||
fragment BasicPendingWorkspaceCollaborator on PendingWorkspaceCollaborator {
|
||||
id
|
||||
inviteId
|
||||
workspaceId
|
||||
workspaceName
|
||||
workspace {
|
||||
id
|
||||
name
|
||||
}
|
||||
title
|
||||
role
|
||||
invitedBy {
|
||||
|
||||
@@ -997,7 +997,7 @@ describe('Workspaces Invites GQL', () => {
|
||||
expect(res).to.not.haveGraphQLErrors()
|
||||
|
||||
const unrelatedInvite = res.data?.workspace.invitedTeam?.find(
|
||||
(t) => t.workspaceId === unrelatedWorkspace.id
|
||||
(t) => t.workspace.id === unrelatedWorkspace.id
|
||||
)
|
||||
expect(unrelatedInvite).to.be.not.ok
|
||||
})
|
||||
@@ -1359,7 +1359,7 @@ describe('Workspaces Invites GQL', () => {
|
||||
expect(res2.data?.activeUser?.workspaceInvites).to.be.ok
|
||||
expect(
|
||||
res2.data!.activeUser!.workspaceInvites.find(
|
||||
(i) => i.workspaceId === brokenWorkspace.id
|
||||
(i) => i.workspace.id === brokenWorkspace.id
|
||||
)
|
||||
).to.not.be.ok
|
||||
})
|
||||
@@ -1388,7 +1388,7 @@ describe('Workspaces Invites GQL', () => {
|
||||
expect(res.data!.workspaceInvite!.inviteId).to.equal(
|
||||
processableWorkspaceInvite.inviteId
|
||||
)
|
||||
expect(res.data!.workspaceInvite!.workspaceId).to.equal(
|
||||
expect(res.data!.workspaceInvite!.workspace.id).to.equal(
|
||||
myInviteTargetWorkspace.id
|
||||
)
|
||||
expect(res.data!.workspaceInvite!.token).to.equal(
|
||||
@@ -1418,7 +1418,7 @@ describe('Workspaces Invites GQL', () => {
|
||||
expect(res.data?.activeUser?.workspaceInvites![0].inviteId).to.equal(
|
||||
processableWorkspaceInvite.inviteId
|
||||
)
|
||||
expect(res.data?.activeUser?.workspaceInvites![0].workspaceId).to.equal(
|
||||
expect(res.data?.activeUser?.workspaceInvites![0].workspace.id).to.equal(
|
||||
myInviteTargetWorkspace.id
|
||||
)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user