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:
Tom Moor
2020-06-11 08:48:47 -07:00
committed by GitHub
parent d7766280a9
commit 1d8c3f3faf
4 changed files with 62 additions and 6 deletions

View File

@ -21,13 +21,22 @@ const { authorize } = policy;
const router = new Router();
router.post('users.list', auth(), pagination(), async ctx => {
const { query } = ctx.body;
const { query, includeSuspended = false } = ctx.body;
const user = ctx.state.user;
let where = {
teamId: user.teamId,
};
if (!includeSuspended) {
where = {
...where,
suspendedAt: {
[Op.eq]: null,
},
};
}
if (query) {
where = {
...where,