fix: Incorrect policy returned for parent share
This commit is contained in:
@@ -62,7 +62,9 @@ router.post("shares.info", auth(), async (ctx) => {
|
||||
const parentIds = document?.collection?.getDocumentParents(documentId);
|
||||
|
||||
const parentShare = parentIds
|
||||
? await Share.findOne({
|
||||
? await Share.scope({
|
||||
method: ["withCollection", user.id],
|
||||
}).findOne({
|
||||
where: {
|
||||
documentId: parentIds,
|
||||
teamId: user.teamId,
|
||||
|
||||
@@ -424,6 +424,8 @@ describe("#shares.info", () => {
|
||||
expect(body.data.shares[0].documentId).toBe(document.id);
|
||||
expect(body.data.shares[0].published).toBe(true);
|
||||
expect(body.data.shares[0].includeChildDocuments).toBe(true);
|
||||
expect(body.policies.length).toBe(1);
|
||||
expect(body.policies[0].abilities.update).toBe(true);
|
||||
});
|
||||
|
||||
it("should not return share for parent document with includeChildDocuments=false", async () => {
|
||||
|
||||
Reference in New Issue
Block a user