Prevent copying assignments - #2918
Conversation
- Backend: throw InvalidRequestError when attempting to copy an assignment root - Frontend: disable "Make a copy" action bar button when any selected item is an assignment - Tests: add two tests covering attempt to copy singleDoc and sequence assignment roots https://claude.ai/code/session_019HTqQkPWkZ35RM1x1HRQ2W
|
What happens when a folder that contains an assignment is copied? Is this behavior checked by a test? |
Copying a folder is still allowed; its assignment descendants come out as plain, unassigned activities. Pin that behavior down with a test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2N6YBQjEJv7xnxnusELub
|
Copying a folder that contains an assignment still succeeds — only the ids passed directly to That matches the frontend, where the "Make a copy" button is only disabled when a selected item itself has It wasn't covered by a test, so I added one in 760eb48: I couldn't run the API tests locally (no DB reachable from this sandbox); it typechecks, and CI will exercise it. |
getContent rejects folders, so list the copied folder's children with getMyContent instead. Also pass includeAssignInfo so the assignmentInfo assertions are actually meaningful. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2N6YBQjEJv7xnxnusELub
DateTime.now() as closedOn makes the assignment "Closed" by the time the assertion runs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2N6YBQjEJv7xnxnusELub
Summary
Closes #2614
copyContentnow throwsInvalidRequestError("Cannot copy an assignment")when any of the requested content IDs is an assignment root (isAssignmentRoot = true). Previously, copying an assignment was silently allowed, producing a regular activity without assignment data.Activitiespage action bar is now disabled whenever any selected item is an assignment (hasassignmentInfoset).copy_move.test.tsverify that copying a sequence-based assignment and a singleDoc assignment both throw the expected error.Test plan
cannot copy an assignmentpasses in CIcannot copy an assignment (singleDoc)passes in CIhttps://claude.ai/code/session_019HTqQkPWkZ35RM1x1HRQ2W
Generated by Claude Code