Repository navigation
Update in Canvas moves an item to its file's module - #21
Merged
Merged
Conversation
Creating an item put it in the module named after its folder, but updating never looked at modules, so moving a file to another module changed nothing in Canvas. After updating an assignment, quiz or page, Update in Canvas now finds the item's module items (module_item_sequence) and moves one into the right module, or adds it when it is in none. The module list is loaded first so a missing module isn't created twice. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…dule # Conflicts: # docs/getting-started.html
One addModuleItem replaces createModuleItem and createPageModuleItem, and useCanvasModuleIdByName replaces the find-or-create copied into each add hook. Adding a quiz or page before the module list loaded used to do nothing; now it loads the list first. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The editor footer, compare page and calendar compare the file's module folder with the Canvas modules that hold the item (one request for the course's modules with their items), so a moved file is a difference instead of In sync. Add to Canvas refreshes that list, so a new item doesn't show as in no module. getStatus was a pass-through to getSyncStatus and is gone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Modules are compared as a set: an item also in another Canvas module is a difference, and Update in Canvas removes it from the others. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moving a file to another module folder and clicking Update in Canvas left the item in its old Canvas module: create put items in a module, update never looked.
canvasModuleService.placeInModulefinds the item's module items withmodule_item_sequence(works for assignments, quizzes and pages; checked read-only against a real course). It makes the file's module the only one holding the item: keeps or moves (PUT …/items/:idwithmodule_id) one copy into it, adds one if the item is in no module, and deletes any other copies.usePlaceInCanvasModulelooks the module up by folder name (loading the module list first, so a missing module isn't created twice) and toasts when it moved, added or removed something.moduleName(pages also pass their Canvas url, for the add case).useCanvasModuleIdByName, oneaddModuleItem), which removes three copies of find-or-create-module. Adding a quiz or page before the module list had loaded used to do nothing.useCanvasModuleNames, one request for the course's modules with their items). Modules are compared as a set: a moved file, or an item also in another Canvas module, is a difference, so Update in Canvas is the footer's main button.getStatus.tsxwas a pass-through togetSyncStatusand is gone.Test plan
vitest(401),tsc,eslint(0 errors); service tests for already / moved / added / extra copies removed and for pages; sync-report tests for the module row🤖 Generated with Claude Code