fix: Don't show suspended users in document facepile or list of viewers (#3497)

This commit is contained in:
Tom Moor
2022-05-15 06:05:40 -07:00
committed by GitHub
parent bca66f7415
commit 36a3ae4b01
4 changed files with 33 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ import { assertUuid } from "@server/validation";
const router = new Router();
router.post("views.list", auth(), async (ctx) => {
const { documentId } = ctx.body;
const { documentId, includeSuspended = false } = ctx.body;
assertUuid(documentId, "documentId is required");
const { user } = ctx.state;
@@ -16,7 +16,7 @@ router.post("views.list", auth(), async (ctx) => {
userId: user.id,
});
authorize(user, "read", document);
const views = await View.findByDocument(documentId);
const views = await View.findByDocument(documentId, { includeSuspended });
ctx.body = {
data: views.map(presentView),