Repository navigation
feat(admin): Copy Mission — deep-copy action + LR button (#2300) - #2303
Merged
Merged
Conversation
Add AdminService.copyMission(ID) action that deep-copies a Mission into a new unpublished Mission: the mission row, every CompletionPath and its CompletionPathItems, and the MissionTags/MissionCategories link rows. Referenced Tutorials/Groups/Tags/Prizes are linked (via *_ID), never duplicated. Slug becomes <slug>-copy (disambiguated on collision against the @assert.unique.slug index). published/legacyId/community identity are reset. All writes run in the request tx. Wire a 'Copy Mission' List Report action (requiresSelection, single) in app/admin/missions that POSTs the action with CSRF and deep-links the admin-shell into the new mission's Object Page. Tests: 2 new unit tests (deep-copy graph + slug disambiguation), 30 green.
check-slug-lookups flagged the uniqueSlug SELECT: the CompletionPaths path probed by raw p.slug. Lowercase the base once in the helper (slugs are lowercase-canonical repo-wide) so both the uniqueness probe and the inserted slug are canonical; mark the probe pre-canonicalized.
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.
Closes #2300.
What
Adds a Copy Mission feature to the Admin UI. Select a mission in the Missions List Report, press Copy Mission, and the backend deep-copies it into a new unpublished mission; the shell then navigates into the new mission's Object Page.
Backend —
AdminService.copyMission(ID) returns MissionsDeep-copies the full entity graph in the request transaction:
CompletionPath+ itsCompletionPathItemsMissionTags/MissionCategorieslink rowsReferenced Tutorials/Groups/Tags/Prizes are linked (via
*_ID), not duplicated. Slug becomes<slug>-copy(→-copy-2,-3… on collision against the@assert.unique.slugindex; path slugs rebased the same way).published/legacyId/community identity are reset so copies start clean. Admin-gated via the service-level@requires:'Admin'.Frontend —
app/admin/missionsext/CopyMission.js: reads the selected context (recovers selection off themdc.Tablefor the headless admin-shell host, mirroringshelf-definitions/ext/ActionsController.js), POSTscopyMissionwith a CSRF token, then deep-links the shell tomissions&/Missions(ID=…,IsActiveEntity=true)(same pattern asShell.controller.js). The copy opens in display mode — press Edit for further changes.manifest.json:Copy MissionLineItem action,requiresSelection: true.Tests
2 new unit tests (deep-copy graph correctness + slug disambiguation). Full
admin-service.test.jssuite: 30 passing. UI5 linter clean on the new file.Note on "edit mode"
The issue asks the copy to "enter edit mode". The copy reliably lands on its Object Page; auto-entering the draft-edit state across the headless admin-shell boundary from a plain manifest handler is fragile and only verifiable post-deploy, so this ships display-mode navigation (one click from Edit). Happy to layer auto-edit if wanted.
Deploy
Admin-UI change → full deploy required (no
--skip-build, no-mscoping; Step 3.5 bundle gate applies).