fix: Incorrect policy returned after document create/import
This commit is contained in:
parent
c0325fcaf3
commit
5a478ec127
|
@ -1205,6 +1205,7 @@ router.post("documents.import", auth(), async (ctx) => {
|
|||
user,
|
||||
ip: ctx.request.ip,
|
||||
});
|
||||
document.collection = collection;
|
||||
|
||||
return (ctx.body = {
|
||||
data: await presentDocument(document),
|
||||
|
@ -1275,6 +1276,7 @@ router.post("documents.create", auth(), async (ctx) => {
|
|||
editorVersion,
|
||||
ip: ctx.request.ip,
|
||||
});
|
||||
document.collection = collection;
|
||||
|
||||
return (ctx.body = {
|
||||
data: await presentDocument(document),
|
||||
|
|
|
@ -1656,6 +1656,7 @@ describe("#documents.create", () => {
|
|||
expect(res.status).toEqual(200);
|
||||
expect(newDocument.parentDocumentId).toBe(null);
|
||||
expect(newDocument.collectionId).toBe(collection.id);
|
||||
expect(body.policies[0].abilities.update).toEqual(true);
|
||||
});
|
||||
|
||||
it("should not allow very long titles", async () => {
|
||||
|
@ -1688,6 +1689,7 @@ describe("#documents.create", () => {
|
|||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.data.title).toBe("new document");
|
||||
expect(body.policies[0].abilities.update).toEqual(true);
|
||||
});
|
||||
|
||||
it("should error with invalid parentDocument", async () => {
|
||||
|
@ -1722,6 +1724,7 @@ describe("#documents.create", () => {
|
|||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.data.title).toBe("new document");
|
||||
expect(body.policies[0].abilities.update).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Reference in New Issue