mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 22:42:32 -05:00
new form if fields changed
This commit is contained in:
1 parent
616f7b4fd8
commit
1f149ac67a
1 file changed
+9
@@ -10,6 +10,9 @@ class StartFormSelfController < ApplicationController
|
||||
@submitter = Submitters::StartForm.build_submitters_scope(@template, exclude_completed: true, source: :self)
|
||||
.find_or_initialize_by(email: current_user.email)
|
||||
|
||||
@submitter = Submitter.new(email: current_user.email) if @submitter.persisted? &&
|
||||
outdated_template_fields?(@submitter, @template)
|
||||
|
||||
if (is_new_record = @submitter.new_record?)
|
||||
@submitter.name = current_user.full_name
|
||||
|
||||
@@ -33,6 +36,12 @@ class StartFormSelfController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def outdated_template_fields?(submitter, template)
|
||||
template_fields = submitter.submission.template_fields
|
||||
|
||||
template_fields.present? && template_fields != template.fields
|
||||
end
|
||||
|
||||
def authorize_start!
|
||||
authorize!(:read, @template)
|
||||
|
||||
|
||||
Reference in new issue
Block a user