mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
fix: Allow reordering subdocuments with document-only access (#12493)
* fix: Allow reordering subdocuments with document-only access When a user has "Manage" (or any move-eligible) permission on a parent document but no access to its collection, the sidebar drop cursors were hidden because they gated on collection.isManualSort, and the move handler bailed out because it built the payload from collection.id. Fall back to the document's own collectionId and the move policy so the reorder UX works for sourced document memberships. * fix: Structure not refetched parentDocumentId not provided
This commit is contained in:
@@ -2672,6 +2672,50 @@ describe("#documents.move", () => {
|
||||
});
|
||||
expect(res.status).toEqual(403);
|
||||
});
|
||||
|
||||
it("should allow reordering subdocuments with document-only admin access", async () => {
|
||||
const owner = await buildUser();
|
||||
const collection = await buildCollection({
|
||||
teamId: owner.teamId,
|
||||
userId: owner.id,
|
||||
permission: null,
|
||||
});
|
||||
const parent = await buildDocument({
|
||||
teamId: owner.teamId,
|
||||
userId: owner.id,
|
||||
collectionId: collection.id,
|
||||
});
|
||||
const childA = await buildDocument({
|
||||
teamId: owner.teamId,
|
||||
userId: owner.id,
|
||||
collectionId: collection.id,
|
||||
parentDocumentId: parent.id,
|
||||
});
|
||||
const childB = await buildDocument({
|
||||
teamId: owner.teamId,
|
||||
userId: owner.id,
|
||||
collectionId: collection.id,
|
||||
parentDocumentId: parent.id,
|
||||
});
|
||||
|
||||
const user = await buildUser({ teamId: owner.teamId });
|
||||
await UserMembership.create({
|
||||
documentId: parent.id,
|
||||
userId: user.id,
|
||||
createdById: owner.id,
|
||||
permission: DocumentPermission.Admin,
|
||||
});
|
||||
|
||||
const res = await server.post("/api/documents.move", user, {
|
||||
body: {
|
||||
id: childB.id,
|
||||
parentDocumentId: parent.id,
|
||||
index: 0,
|
||||
},
|
||||
});
|
||||
expect(res.status).toEqual(200);
|
||||
expect(childA).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("#documents.restore", () => {
|
||||
|
||||
Reference in New Issue
Block a user