refactor: fix pagination with stable resolveKey, use reactive default… (#4951)
* refactor: fix pagination with stable resolveKey, use reactive defaultRoles, and remove email permission check * Changes from call * More changes from call * WIP fixing team composite cursor * paginated items fix * minor rename * composite cursor tools improved * fe undoing debugging stuff * extra fixes * invitable collabs fix --------- Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
This commit is contained in:
committed by
GitHub
parent
794bd7c7e9
commit
c89fe339ec
@@ -250,7 +250,7 @@ describe('Workspace repositories', () => {
|
||||
})
|
||||
|
||||
it('returns all workspace members', async () => {
|
||||
const team = await getWorkspaceCollaborators({
|
||||
const { items: team } = await getWorkspaceCollaborators({
|
||||
workspaceId: testWorkspace.id,
|
||||
limit: 50
|
||||
})
|
||||
@@ -298,7 +298,7 @@ describe('Workspace repositories', () => {
|
||||
})
|
||||
|
||||
it('limits search results to specified workspace', async () => {
|
||||
const result = await getWorkspaceCollaborators({
|
||||
const { items: result } = await getWorkspaceCollaborators({
|
||||
workspaceId: testWorkspaces[2].id,
|
||||
limit: 50,
|
||||
filter: { search: 'John' }
|
||||
|
||||
@@ -86,7 +86,7 @@ describe('Workspace repositories', () => {
|
||||
})
|
||||
|
||||
it('should return all workspace collaborators not members of the project', async () => {
|
||||
const invitable = await getInvitableCollaboratorsByProjectId({
|
||||
const { items: invitable } = await getInvitableCollaboratorsByProjectId({
|
||||
filter: {
|
||||
workspaceId: testWorkspace.id,
|
||||
projectId: testProject.id
|
||||
@@ -100,7 +100,7 @@ describe('Workspace repositories', () => {
|
||||
])
|
||||
})
|
||||
it('should should filter by user name', async () => {
|
||||
const invitable = await getInvitableCollaboratorsByProjectId({
|
||||
const { items: invitable } = await getInvitableCollaboratorsByProjectId({
|
||||
filter: {
|
||||
workspaceId: testWorkspace.id,
|
||||
projectId: testProject.id,
|
||||
@@ -114,7 +114,7 @@ describe('Workspace repositories', () => {
|
||||
])
|
||||
})
|
||||
it('should should filter by user email', async () => {
|
||||
const invitable = await getInvitableCollaboratorsByProjectId({
|
||||
const { items: invitable } = await getInvitableCollaboratorsByProjectId({
|
||||
filter: {
|
||||
workspaceId: testWorkspace.id,
|
||||
projectId: testProject.id,
|
||||
@@ -128,7 +128,7 @@ describe('Workspace repositories', () => {
|
||||
])
|
||||
})
|
||||
it('should should filter by user name and email', async () => {
|
||||
const invitable = await getInvitableCollaboratorsByProjectId({
|
||||
const { items: invitable } = await getInvitableCollaboratorsByProjectId({
|
||||
filter: {
|
||||
workspaceId: testWorkspace.id,
|
||||
projectId: testProject.id,
|
||||
|
||||
@@ -133,7 +133,7 @@ const { FF_WORKSPACES_MODULE_ENABLED } = getFeatureFlags()
|
||||
getWorkspaceWithDomains: async () => null,
|
||||
getUserEmails: async () => [],
|
||||
addOrUpdateWorkspaceRole: async () => {},
|
||||
getWorkspaceTeam: async () => []
|
||||
getWorkspaceTeam: async () => ({ items: [], cursor: null })
|
||||
})({ workspaceId: createRandomString(), userId: createRandomString() })
|
||||
)
|
||||
|
||||
@@ -150,7 +150,7 @@ const { FF_WORKSPACES_MODULE_ENABLED } = getFeatureFlags()
|
||||
getWorkspaceWithDomains: async () => null,
|
||||
getUserEmails: async () => [],
|
||||
addOrUpdateWorkspaceRole: async () => {},
|
||||
getWorkspaceTeam: async () => []
|
||||
getWorkspaceTeam: async () => ({ items: [], cursor: null })
|
||||
})({ workspaceId: createRandomString(), userId: createRandomString() })
|
||||
)
|
||||
|
||||
@@ -185,7 +185,7 @@ const { FF_WORKSPACES_MODULE_ENABLED } = getFeatureFlags()
|
||||
workspace as unknown as WorkspaceWithDomains,
|
||||
getUserEmails: async () => [],
|
||||
addOrUpdateWorkspaceRole: async () => {},
|
||||
getWorkspaceTeam: async () => []
|
||||
getWorkspaceTeam: async () => ({ items: [], cursor: null })
|
||||
})({ workspaceId: createRandomString(), userId: createRandomString() })
|
||||
)
|
||||
|
||||
@@ -243,7 +243,7 @@ const { FF_WORKSPACES_MODULE_ENABLED } = getFeatureFlags()
|
||||
getUserEmails: async () =>
|
||||
[{ email: user.email, verified: true }] as unknown as UserEmail[],
|
||||
addOrUpdateWorkspaceRole: async () => {},
|
||||
getWorkspaceTeam: async () => []
|
||||
getWorkspaceTeam: async () => ({ items: [], cursor: null })
|
||||
})({ workspaceId: workspace.id, userId: user.id })
|
||||
).to.equal(true)
|
||||
|
||||
@@ -314,7 +314,7 @@ const { FF_WORKSPACES_MODULE_ENABLED } = getFeatureFlags()
|
||||
getUserEmails: async () =>
|
||||
[{ email: user.email, verified: true }] as unknown as UserEmail[],
|
||||
addOrUpdateWorkspaceRole: async () => {},
|
||||
getWorkspaceTeam: async () => []
|
||||
getWorkspaceTeam: async () => ({ items: [], cursor: null })
|
||||
})
|
||||
|
||||
expect(
|
||||
|
||||
@@ -463,6 +463,11 @@ describe('Workspaces GQL CRUD', () => {
|
||||
limit: 10,
|
||||
cursor: resA.data?.workspace.team.cursor
|
||||
})
|
||||
const resC = await largeWorkspaceApollo.execute(GetWorkspaceTeamDocument, {
|
||||
workspaceId: largeWorkspace.id,
|
||||
limit: 10,
|
||||
cursor: resB.data?.workspace.team.cursor
|
||||
})
|
||||
|
||||
expect(resA).to.not.haveGraphQLErrors()
|
||||
expect(resA.data?.workspace.team.items.length).to.equal(2)
|
||||
@@ -475,7 +480,11 @@ describe('Workspaces GQL CRUD', () => {
|
||||
|
||||
expect(resB).to.not.haveGraphQLErrors()
|
||||
expect(resB.data?.workspace.team.items.length).to.equal(4)
|
||||
expect(resB.data?.workspace.team.cursor).to.be.null
|
||||
expect(resB.data?.workspace.team.cursor).to.be.not.null
|
||||
|
||||
expect(resC).to.not.haveGraphQLErrors()
|
||||
expect(resC.data?.workspace.team.items.length).to.equal(0)
|
||||
expect(resC.data?.workspace.team.cursor).to.be.null
|
||||
})
|
||||
|
||||
it('should return correct total count', async () => {
|
||||
|
||||
Reference in New Issue
Block a user