Add "Copy form" button to duplicate a form with its fields and options - #2258
Merged
Conversation
Admins rebuild near-identical forms by hand today. A one-click copy
seeds a new editable form ("COPY of [Name]") from an existing one so
they can tweak rather than start over.
The copy leaves slug nil and published false (a published form requires
a unique slug); event links, submissions, and reports are intentionally
not carried over. AnswerOptions are shared records, so the join rows are
re-pointed at them rather than duplicated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale
marked this pull request as ready for review
August 18, 2026 14:44
Surfaces the new copy-form capability on /features so facilitators and admins can discover it. Co-Authored-By: Claude Opus 4.8 (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.
🤖 suggested review level: 3 Read 📖 small additive feature — one service, one action, two view links; core risk is what the deep-copy includes/omits
Why
Admins rebuild near-identical forms by hand. A one-click Copy seeds a new editable form (
COPY of [Name]) from an existing one so they can tweak rather than start from scratch.What
FormCopyService— transactional deep-copy of aForm.form_field(order preserved) and each field'sform_field_answer_options, re-pointed at the sharedAnswerOptionrecords (not duplicated).slugnil andpublishedfalse — a published form requires a unique slug.user_forms, or reports.role— nothing selects a standalone form by role expecting uniqueness (event-level lookups go throughevent_forms), and role stays editable in the form editor.POST /forms/:id/copy→FormsController#copy(admin-gated), redirects to the new form's editor.Copy a formentry inconfig/features.yml.Tests
FormCopyServicespec — naming, field/option copy, shared AnswerOption reuse, slug/published reset, submissions/event links excluded, original untouched.POST /forms/:id/copyrequest spec — admin success + redirect, non-admin denied.