Skip to content

feat(admin): Copy Mission — deep-copy action + LR button (#2300) - #2303

Merged
jung-thomas merged 2 commits into
DEVfrom
feat/copy-mission-2300
Sep 14, 2026
Merged

jung-thomas merged 2 commits into
DEVfrom
feat/copy-mission-2300

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

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 Missions

Deep-copies the full entity graph in the request transaction:

  • Mission row
  • every CompletionPath + its CompletionPathItems
  • MissionTags / MissionCategories link rows

Referenced Tutorials/Groups/Tags/Prizes are linked (via *_ID), not duplicated. Slug becomes <slug>-copy (→ -copy-2, -3… on collision against the @assert.unique.slug index; 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/missions

  • ext/CopyMission.js: reads the selected context (recovers selection off the mdc.Table for the headless admin-shell host, mirroring shelf-definitions/ext/ActionsController.js), POSTs copyMission with a CSRF token, then deep-links the shell to missions&/Missions(ID=…,IsActiveEntity=true) (same pattern as Shell.controller.js). The copy opens in display mode — press Edit for further changes.
  • manifest.json: Copy Mission LineItem action, requiresSelection: true.

Tests

2 new unit tests (deep-copy graph correctness + slug disambiguation). Full admin-service.test.js suite: 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 -m scoping; Step 3.5 bundle gate applies).

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.
@jung-thomas
jung-thomas merged commit 6c24d3e into DEV Sep 14, 2026
7 checks passed
@jung-thomas
jung-thomas deleted the feat/copy-mission-2300 branch September 14, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant