feat(marketplace): duplicate listings into current course - #8479
Conversation
LWS49
commented
Jul 8, 2026
- add DuplicationJob: copies listings into a course tab, writes adoption
- add bulk duplicate endpoint enqueuing the job for selected listings
- add DuplicateConfirmation modal with row + bulk triggers, job polling
- add MarketplaceAPI.duplicate and duplicateListings poll operation
- serialize and assert live distinct-course adoption count in index
0b7f44e to
d84d375
Compare
052b93c to
9169fa1
Compare
d84d375 to
284c2bb
Compare
9169fa1 to
e532cc2
Compare
284c2bb to
0ac76f3
Compare
e532cc2 to
97c5401
Compare
0ac76f3 to
56b15aa
Compare
97c5401 to
2e480cd
Compare
| destination_course, third_course, copy, current_user: user | ||
| ) | ||
| end.not_to change(Course::Assessment::Marketplace::Adoption, :count) | ||
| end |
There was a problem hiding this comment.
Let's also add tests confirming the following logic:
-
once duplication of a marketplace-listed-assessment is done, the listing itself does not get duplicated (so the total number of listings should not change as adoptions take place)
-
if marketplace-listed-assessment is duplicated manually (e.g. as part of full / partial course duplication), it should follow the same logic steps (listing should not duplicate, adoption should be tracked)
9eccba7 to
c1588e3
Compare
56b15aa to
f25dc28
Compare
There was a problem hiding this comment.
Pull request overview
Adds end-to-end “duplicate from marketplace into the current course” functionality: a backend job + endpoint to duplicate selected marketplace listings into a destination course/tab while recording marketplace adoptions, and a frontend confirmation modal that triggers duplication and polls job completion.
Changes:
- Introduces
Course::Assessment::Marketplace::DuplicationJoband aPOST #duplicateendpoint to enqueue duplication for selected published listings. - Records marketplace adoptions during object/course duplication flows and reports distinct-course adoption counts in marketplace listing index responses.
- Adds a frontend confirmation modal + row-level trigger, API method, and operation to start duplication and poll job status.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/jobs/course/assessment/marketplace/duplication_job_spec.rb | Adds job specs covering duplication behavior, tab placement, and adoption recording. |
| spec/controllers/course/assessment/marketplace/listings_controller_spec.rb | Adds controller specs for live adoption counts and duplicate endpoint enqueue/authorization. |
| lib/autoload/duplicator.rb | Documents and exposes duplicated_objects for duplication bookkeeping. |
| client/locales/zh.json | Adds i18n strings for duplication confirmation and status toasts. |
| client/locales/ko.json | Adds i18n strings for duplication confirmation and status toasts. |
| client/locales/en.json | Adds i18n strings for duplication confirmation and status toasts. |
| client/app/bundles/course/marketplace/translations.ts | Registers new duplication-related message IDs/default messages. |
| client/app/bundles/course/marketplace/pages/MarketplaceIndex/MarketplaceTable.tsx | Adds a row-level Duplicate button to open the confirmation flow. |
| client/app/bundles/course/marketplace/pages/MarketplaceIndex/index.tsx | Wires the duplicate confirmation modal and reads from_tab from URL params. |
| client/app/bundles/course/marketplace/operations.ts | Adds duplicateListings operation (enqueue + job polling). |
| client/app/bundles/course/marketplace/components/DuplicateConfirmation.tsx | Adds confirmation modal that submits duplication and shows toast feedback. |
| client/app/bundles/course/marketplace/components/test/DuplicationConfirmation.test.tsx | Adds frontend test coverage for posting duplication request payload. |
| client/app/api/course/Marketplace.ts | Adds MarketplaceAPI.duplicate POST method. |
| app/services/course/duplication/object_duplication_service.rb | Records marketplace adoptions after object duplication completes. |
| app/services/course/duplication/course_duplication_service.rb | Records marketplace adoptions after course duplication completes. |
| app/services/course/duplication/base_service.rb | Implements record_marketplace_adoptions based on duplicator.duplicated_objects. |
| app/jobs/course/assessment/marketplace/duplication_job.rb | Implements duplication job and redirect behavior after duplication. |
| app/controllers/course/assessment/marketplace/listings_controller.rb | Adds duplicate action with authorization and job submission. |
Comments suppressed due to low confidence (1)
client/app/bundles/course/marketplace/components/DuplicateConfirmation.tsx:52
duplicateTitleis a pluralized message that references{n}, but it is formatted without providingn, which can cause runtime formatting errors / fallback output.
open={open}
primaryLabel={t(translations.duplicateConfirm)}
title={t(translations.duplicateTitle)}
>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- add DuplicationJob: copies listings into a course tab, writes adoption - add bulk duplicate endpoint enqueuing the job for selected listings - add DuplicateConfirmation modal with row + bulk triggers, job polling - add MarketplaceAPI.duplicate and duplicateListings poll operation - serialize and assert live distinct-course adoption count in index
0b85578 to
b218c92
Compare