Compare commits

...

2 Commits

Author SHA1 Message Date
Tom Moor f81638d0e0 0.58.1 2021-08-03 21:48:56 -07:00
Tom Moor dd811ca787 fix: Policies missing on documents.viewed endpoint 2021-08-03 21:48:40 -07:00
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -211,5 +211,5 @@
"dot-prop": "^5.2.0",
"js-yaml": "^3.13.1"
},
"version": "0.58.0"
"version": "0.58.1"
}
+10 -2
View File
@@ -310,9 +310,10 @@ router.post("documents.viewed", auth(), pagination(), async (ctx) => {
const user = ctx.state.user;
const collectionIds = await user.collectionIds();
const userId = user.id;
const views = await View.findAll({
where: { userId: user.id },
where: { userId },
order: [[sort, direction]],
include: [
{
@@ -325,9 +326,16 @@ router.post("documents.viewed", auth(), pagination(), async (ctx) => {
{
model: Star,
as: "starred",
where: { userId: user.id },
where: { userId },
separate: true,
required: false,
},
{
model: Collection.scope({
method: ["withMembership", userId],
}),
as: "collection",
},
],
},
],
+1
View File
@@ -1349,6 +1349,7 @@ describe("#documents.viewed", () => {
expect(res.status).toEqual(200);
expect(body.data.length).toEqual(1);
expect(body.data[0].id).toEqual(document.id);
expect(body.policies[0].abilities.update).toEqual(true);
});
it("should not return recently viewed but deleted documents", async () => {