mirror of
https://github.com/docusealco/docuseal
synced 2026-11-06 23:12:33 -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)
|
@submitter = Submitters::StartForm.build_submitters_scope(@template, exclude_completed: true, source: :self)
|
||||||
.find_or_initialize_by(email: current_user.email)
|
.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?)
|
if (is_new_record = @submitter.new_record?)
|
||||||
@submitter.name = current_user.full_name
|
@submitter.name = current_user.full_name
|
||||||
|
|
||||||
@@ -33,6 +36,12 @@ class StartFormSelfController < ApplicationController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def outdated_template_fields?(submitter, template)
|
||||||
|
template_fields = submitter.submission.template_fields
|
||||||
|
|
||||||
|
template_fields.present? && template_fields != template.fields
|
||||||
|
end
|
||||||
|
|
||||||
def authorize_start!
|
def authorize_start!
|
||||||
authorize!(:read, @template)
|
authorize!(:read, @template)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user