mirror of
https://github.com/outline/outline.git
synced 2026-12-04 02:20:17 +03:00
fix: Allow users to revoke a collection share (#9870)
This commit is contained in:
1 parent
5b19f7c711
commit
d5510f4454
2 files changed
+21
-1
No files matched your search
@@ -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({
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user