fix: Suspended users showing in group and collection member management (#1302)
* fix: Suspended users showing in group and collection member management * test
This commit is contained in:
@ -14,6 +14,13 @@ describe('#users.list', async () => {
|
||||
it('should allow filtering by user name', async () => {
|
||||
const user = await buildUser({ name: 'Tester' });
|
||||
|
||||
// suspended user should not be returned
|
||||
await buildUser({
|
||||
name: 'Tester',
|
||||
teamId: user.teamId,
|
||||
suspendedAt: new Date(),
|
||||
});
|
||||
|
||||
const res = await server.post('/api/users.list', {
|
||||
body: {
|
||||
query: 'test',
|
||||
@ -27,6 +34,27 @@ describe('#users.list', async () => {
|
||||
expect(body.data[0].id).toEqual(user.id);
|
||||
});
|
||||
|
||||
it('should allow including suspended', async () => {
|
||||
const user = await buildUser({ name: 'Tester' });
|
||||
await buildUser({
|
||||
name: 'Tester',
|
||||
teamId: user.teamId,
|
||||
suspendedAt: new Date(),
|
||||
});
|
||||
|
||||
const res = await server.post('/api/users.list', {
|
||||
body: {
|
||||
query: 'test',
|
||||
includeSuspended: true,
|
||||
token: user.getJwtToken(),
|
||||
},
|
||||
});
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.data.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should return teams paginated user list', async () => {
|
||||
const { admin, user } = await seed();
|
||||
|
||||
|
Reference in New Issue
Block a user