Skip to content

Commit a698118

Browse files
authored
Merge from docusealco/wip
2 parents c1123fe + 0361fab commit a698118

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+8690
-471
lines changed

app/controllers/api/submissions_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def show
4343
end
4444

4545
if @submission.audit_trail_attachment.blank? && submitters.all?(&:completed_at?)
46-
@submission.audit_trail_attachment = Submissions::GenerateAuditTrail.call(@submission)
46+
@submission.audit_trail_attachment = Submissions::EnsureAuditGenerated.call(@submission)
4747
end
4848

4949
render json: Submissions::SerializeForApi.call(@submission, submitters, params)
@@ -184,6 +184,7 @@ def submissions_params
184184
:send_email, :send_sms, :bcc_completed, :completed_redirect_url, :reply_to, :go_to_last,
185185
:require_phone_2fa, :expire_at, :name,
186186
{
187+
variables: {},
187188
message: %i[subject body],
188189
submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role,
189190
:completed, :phone, :application_key, :external_id, :reply_to, :go_to_last,

app/controllers/submissions_download_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def build_combined_url(submitter)
7070
return if submitter.submission.submitters.order(:completed_at).last != submitter
7171

7272
attachment = submitter.submission.combined_document_attachment
73-
attachment ||= Submissions::GenerateCombinedAttachment.call(submitter)
73+
attachment ||= Submissions::EnsureCombinedGenerated.call(submitter)
7474

7575
filename_format = AccountConfig.find_or_initialize_by(account_id: submitter.account_id,
7676
key: AccountConfig::DOCUMENT_FILENAME_FORMAT_KEY)&.value

app/jobs/process_submitter_completion_job.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ def perform(params = {})
1414

1515
if is_all_completed && submitter.completed_at == submitter.submission.submitters.maximum(:completed_at)
1616
if submitter.submission.account.account_configs.exists?(key: AccountConfig::COMBINE_PDF_RESULT_KEY, value: true)
17-
Submissions::GenerateCombinedAttachment.call(submitter)
17+
Submissions::EnsureCombinedGenerated.call(submitter)
1818
end
1919

20-
Submissions::GenerateAuditTrail.call(submitter.submission)
20+
Submissions::EnsureAuditGenerated.call(submitter.submission)
2121

2222
enqueue_completed_emails(submitter)
2323
end

app/models/account_config.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class AccountConfig < ApplicationRecord
4242
FORCE_SSO_AUTH_KEY = 'force_sso_auth'
4343
FLATTEN_RESULT_PDF_KEY = 'flatten_result_pdf'
4444
WITH_SIGNATURE_ID = 'with_signature_id'
45+
WITH_FILE_LINKS_KEY = 'with_file_links'
4546
WITH_SIGNATURE_ID_REASON_KEY = 'with_signature_id_reason'
4647
WITH_AUDIT_VALUES_KEY = 'with_audit_values'
4748
WITH_SUBMITTER_TIMEZONE_KEY = 'with_submitter_timezone'

app/models/lock_event.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# frozen_string_literal: true
2+
3+
# == Schema Information
4+
#
5+
# Table name: lock_events
6+
#
7+
# id :bigint not null, primary key
8+
# event_name :string not null
9+
# key :string not null
10+
# created_at :datetime not null
11+
# updated_at :datetime not null
12+
#
13+
# Indexes
14+
#
15+
# index_lock_events_on_event_name_and_key (event_name,key) UNIQUE WHERE ((event_name)::text = ANY ((ARRAY['start'::character varying, 'complete'::character varying])::text[]))
16+
# index_lock_events_on_key (key)
17+
#
18+
class LockEvent < ApplicationRecord
19+
enum :event_name, {
20+
complete: 'complete',
21+
fail: 'fail',
22+
start: 'start',
23+
retry: 'retry'
24+
}, scope: false
25+
end

app/models/submission.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# template_fields :text
1616
# template_schema :text
1717
# template_submitters :text
18+
# variables :text
19+
# variables_schema :text
1820
# created_at :datetime not null
1921
# updated_at :datetime not null
2022
# account_id :bigint not null
@@ -50,6 +52,8 @@ class Submission < ApplicationRecord
5052
serialize :template_fields, coder: JSON
5153
serialize :template_schema, coder: JSON
5254
serialize :template_submitters, coder: JSON
55+
serialize :variables_schema, coder: JSON
56+
serialize :variables, coder: JSON
5357
serialize :preferences, coder: JSON
5458

5559
attribute :source, :string, default: 'link'

app/models/template.rb

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@
44
#
55
# Table name: templates
66
#
7-
# id :bigint not null, primary key
8-
# archived_at :datetime
9-
# fields :text not null
10-
# name :string not null
11-
# preferences :text not null
12-
# schema :text not null
13-
# shared_link :boolean default(FALSE), not null
14-
# slug :string not null
15-
# source :text not null
16-
# submitters :text not null
17-
# created_at :datetime not null
18-
# updated_at :datetime not null
19-
# account_id :bigint not null
20-
# author_id :bigint not null
21-
# external_id :string
22-
# folder_id :bigint not null
7+
# id :bigint not null, primary key
8+
# archived_at :datetime
9+
# fields :text not null
10+
# name :string not null
11+
# preferences :text not null
12+
# schema :text not null
13+
# shared_link :boolean default(FALSE), not null
14+
# slug :string not null
15+
# source :text not null
16+
# submitters :text not null
17+
# variables_schema :text
18+
# created_at :datetime not null
19+
# updated_at :datetime not null
20+
# account_id :bigint not null
21+
# author_id :bigint not null
22+
# external_id :string
23+
# folder_id :bigint not null
2324
#
2425
# Indexes
2526
#
@@ -57,6 +58,7 @@ class Template < ApplicationRecord
5758

5859
serialize :preferences, coder: JSON
5960
serialize :fields, coder: JSON
61+
serialize :variables_schema, coder: JSON
6062
serialize :schema, coder: JSON
6163
serialize :submitters, coder: JSON
6264

app/views/devise/sessions/otp.html.erb

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22
<h1 class="text-4xl font-bold text-center mt-8">
33
<%= t('sign_in') %>
44
</h1>
5-
<%= form_for(resource, as: resource_name, html: { class: 'space-y-6' }, data: { turbo: params[:redir].blank? }, url: session_path(resource_name)) do |f| %>
6-
<%= f.hidden_field :email %>
7-
<%= f.hidden_field :password %>
8-
<% if params[:redir].present? %>
9-
<%= hidden_field_tag :redir, params[:redir] %>
10-
<% end %>
11-
<%= render 'otp_form', **local_assigns %>
12-
<div class="form-control">
13-
<%= f.button button_title(title: t('sign_in'), disabled_with: t('signing_in')), class: 'base-button' %>
5+
<% if local_assigns[:access_error].present? %>
6+
<div class="alert mt-6">
7+
<%= svg_icon('x_circle', class: 'w-6 h-6 text-red-500') %>
8+
<span><%= local_assigns[:access_error] %></span>
149
</div>
10+
<% else %>
11+
<%= form_for(resource, as: resource_name, html: { class: 'space-y-6' }, data: { turbo: params[:redir].blank? }, url: session_path(resource_name)) do |f| %>
12+
<%= f.hidden_field :email %>
13+
<%= f.hidden_field :password %>
14+
<% if params[:redir].present? %>
15+
<%= hidden_field_tag :redir, params[:redir] %>
16+
<% end %>
17+
<%= render 'otp_form', **local_assigns %>
18+
<div class="form-control">
19+
<%= f.button button_title(title: t('sign_in'), disabled_with: t('signing_in')), class: 'base-button' %>
20+
</div>
21+
<% end %>
1522
<% end %>
1623
</div>

app/views/start_form/email_verification.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
</div>
2626
<%= form_for '', url: start_form_path(@template.slug), method: :put, html: { class: 'space-y-4', id: 'code_form' } do |f| %>
2727
<div dir="auto" class="form-control !mt-0">
28+
<%= f.hidden_field 'resubmit', value: params[:resubmit] %>
2829
<%= f.hidden_field 'submitter[name]', value: params[:name] || @submitter&.name %>
2930
<%= f.hidden_field 'submitter[email]', value: params[:email] || @submitter&.email %>
3031
<%= f.hidden_field 'submitter[phone]', value: params[:phone] || @submitter&.phone %>

app/views/webhook_settings/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<h2 id="log" class="text-3xl font-bold"><%= t('events_log') %></h2>
8585
<div class="tabs border-b mt-4">
8686
<%= link_to t('all'), url_for(params.to_unsafe_h.except(:status)), style: 'margin-bottom: -1px', class: "tab h-10 text-base #{params[:status].blank? ? 'tab-active tab-bordered' : 'pb-[3px]'}" %>
87-
<%= link_to t('successed'), url_for(params.to_unsafe_h.merge(status: 'success')), style: 'margin-bottom: -1px', class: "tab h-10 text-base #{params[:status] == 'success' ? 'tab-active tab-bordered' : 'pb-[3px]'}" %>
87+
<%= link_to t('succeeded'), url_for(params.to_unsafe_h.merge(status: 'success')), style: 'margin-bottom: -1px', class: "tab h-10 text-base #{params[:status] == 'success' ? 'tab-active tab-bordered' : 'pb-[3px]'}" %>
8888
<%= link_to t('failed'), url_for(params.to_unsafe_h.merge(status: 'error')), style: 'margin-bottom: -1px', class: "tab h-10 text-base #{params[:status] == 'error' ? 'tab-active tab-bordered' : 'pb-[3px]'}" %>
8989
</div>
9090
<% if @webhook_events.present? %>

0 commit comments

Comments
 (0)