fix: Allow users to revoke a collection share (#9870)

This commit is contained in:
Hemachandar authored and GitHub committed 2025-08-08 00:07:04 +05:30
1 parent 5b19f7c711
commit d5510f4454
2 files changed
+21 -1

No files matched your search

+20
View File
@@ -1035,6 +1035,26 @@ describe("#shares.revoke", () => {
expect(res.status).toEqual(200);
});
it("should allow author to revoke collection share", async () => {
const user = await buildUser();
const collection = await buildCollection({
userId: user.id,
teamId: user.teamId,
});
const share = await buildShare({
collectionId: collection.id,
teamId: user.teamId,
userId: user.id,
});
const res = await server.post("/api/shares.revoke", {
body: {
token: user.getJwtToken(),
id: share.id,
},
});
expect(res.status).toEqual(200);
});
it("should 404 if shares document is deleted", async () => {
const user = await buildUser();
const document = await buildDocument({
+1 -1
View File
@@ -357,7 +357,7 @@ router.post(
const { user } = ctx.state.auth;
const share = await Share.findByPk(id);
if (!share?.document) {
if (!share?.collection && !share?.document) {
throw NotFoundError();
}