Merged
Conversation
- requires_approval gates submission.completed - approved_at tracks when the submission was explicitly approved - approved_at is cleared on request_changes to allow re-approval
- Sets approved_at on the submission - Does not fire webhooks, updates itself from the 200 OK response - Resets approved_at so re-approve is needed after submitter re-completes
- form.completed fires when submitter finishes, but submission.completed is not fired in order to wait for approval call - submission.completed fires normally when requires_approval is false
- Replaces form.viewed/form.declined with submission.completed and form.changes_requested - Adds backfill rake task to update existing webhook URLs to the new event set
- moving to webhooks
- this was throwing an error through translation files in the audit service calls, so form.completed and submission.completed were not firing correctly.
* not sure why this wasn't auto generated previously, but it's here now
* comment out soon to be unused message * fix failing specs
bernardodsanderson
approved these changes
Mar 19, 2026
Collaborator
bernardodsanderson
left a comment
There was a problem hiding this comment.
Awesome work! Just one small though, totally optional.
| class AddRequiresApprovalToSubmissions < ActiveRecord::Migration[7.2] | ||
| def change | ||
| add_column :submissions, :requires_approval, :boolean, default: false, null: false | ||
| add_column :submissions, :approved_at, :datetime |
Collaborator
There was a problem hiding this comment.
[optional] Might be good to add an index to fetch the approved_at
add_index :submissions, :approved_at* add index to submissions.approved_at * add translations back, error was throwing when trying to find translation
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
Implements the manager approval gate for single-sided Docuseal forms. When a submission is created with
requires_approval: true, Docuseal suppresses the submission.completed webhook until explicitly approved via the new API endpoint. Dual-sided forms are treated as alwaysrequires_approval: false.Changes
New API Endpoints
approved_aton the submission.approved_atso the re-approval cycle works correctly after a submitter re-completes.Webhook Behavior
requires_approval: true-form.completedfires only when the submitter finishes.submission.completedis suppressed until approval endpoint is calledrequires_approval: false- existing behavior unchanged.submission.completedfires immediately when all submitters completeform.viewed/form.declinedwithsubmission.completedandform.changes_requestedsubmission_idtosubmission.completedpayload to route to correct taskBug Fixes
I18n::MissingTranslationData) caused byform_updateevent type having no translation keyExportSubmissionServicedirect POST to ATS (CP-12761) — submission sync now fully handled by webhooksCleanup