fix rubocop
This commit is contained in:
@@ -51,6 +51,15 @@ Style/NumericPredicate:
|
|||||||
Style/MinMaxComparison:
|
Style/MinMaxComparison:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EmptyClassDefinition:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/OneClassPerFile:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/MultilineMethodCallIndentation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Naming/PredicateMethod:
|
Naming/PredicateMethod:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ module Api
|
|||||||
|
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [@template],
|
records: [@template],
|
||||||
associations: [schema_documents: :preview_images_attachments]
|
associations: [{ schema_documents: :preview_images_attachments }]
|
||||||
).call
|
).call
|
||||||
|
|
||||||
cloned_template = Templates::Clone.call(
|
cloned_template = Templates::Clone.call(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
class EsignSettingsController < ApplicationController
|
class EsignSettingsController < ApplicationController
|
||||||
DEFAULT_CERT_NAME = 'DocuSeal Self-Host Autogenerated'
|
DEFAULT_CERT_NAME = 'DocuSeal Self-Host Autogenerated'
|
||||||
|
|
||||||
CertFormRecord = Struct.new(:name, :file, :password, keyword_init: true) do
|
CertFormRecord = Struct.new(:name, :file, :password) do
|
||||||
include ActiveModel::Validations
|
include ActiveModel::Validations
|
||||||
|
|
||||||
def to_key
|
def to_key
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class SubmissionsController < ApplicationController
|
|||||||
unless @submission.submitters.all?(&:completed_at?)
|
unless @submission.submitters.all?(&:completed_at?)
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [@submission],
|
records: [@submission],
|
||||||
associations: [submitters: :start_form_submission_events]
|
associations: [{ submitters: :start_form_submission_events }]
|
||||||
).call
|
).call
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class TemplatesCloneAndReplaceController < ApplicationController
|
|||||||
|
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [@template],
|
records: [@template],
|
||||||
associations: [schema_documents: :preview_images_attachments]
|
associations: [{ schema_documents: :preview_images_attachments }]
|
||||||
).call
|
).call
|
||||||
|
|
||||||
cloned_template = Templates::Clone.call(@template, author: current_user)
|
cloned_template = Templates::Clone.call(@template, author: current_user)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class TemplatesCloneController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [@base_template],
|
records: [@base_template],
|
||||||
associations: [schema_documents: :preview_images_attachments]
|
associations: [{ schema_documents: :preview_images_attachments }]
|
||||||
).call
|
).call
|
||||||
|
|
||||||
@template = Templates::Clone.call(@base_template, author: current_user,
|
@template = Templates::Clone.call(@base_template, author: current_user,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class TemplatesController < ApplicationController
|
|||||||
def edit
|
def edit
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [@template],
|
records: [@template],
|
||||||
associations: [schema_documents: [:blob, { preview_images_attachments: :blob }]]
|
associations: [{ schema_documents: [:blob, { preview_images_attachments: :blob }] }]
|
||||||
).call
|
).call
|
||||||
|
|
||||||
@template_data =
|
@template_data =
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class TemplatesDebugController < ApplicationController
|
|||||||
|
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [@template],
|
records: [@template],
|
||||||
associations: [schema_documents: { preview_images_attachments: :blob }]
|
associations: [{ schema_documents: { preview_images_attachments: :blob } }]
|
||||||
).call
|
).call
|
||||||
|
|
||||||
@template_data =
|
@template_data =
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ class TemplatesPreferencesController < ApplicationController
|
|||||||
default_expire_at_duration shared_link_2fa default_expire_at request_email_enabled
|
default_expire_at_duration shared_link_2fa default_expire_at request_email_enabled
|
||||||
completed_notification_email_subject completed_notification_email_body
|
completed_notification_email_subject completed_notification_email_body
|
||||||
completed_notification_email_enabled completed_notification_email_attach_audit] +
|
completed_notification_email_enabled completed_notification_email_attach_audit] +
|
||||||
[completed_message: %i[title body],
|
[{ completed_message: %i[title body],
|
||||||
submitters: [%i[uuid request_email_subject request_email_body]], link_form_fields: []]
|
submitters: [%i[uuid request_email_subject request_email_body]], link_form_fields: [] }]
|
||||||
).tap do |attrs|
|
).tap do |attrs|
|
||||||
attrs[:preferences].delete(:submitters) if params[:request_email_per_submitter] != '1'
|
attrs[:preferences].delete(:submitters) if params[:request_email_per_submitter] != '1'
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class TemplatesPreviewController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [@template],
|
records: [@template],
|
||||||
associations: [schema_documents: { preview_images_attachments: :blob }]
|
associations: [{ schema_documents: { preview_images_attachments: :blob } }]
|
||||||
).call
|
).call
|
||||||
|
|
||||||
@template_data =
|
@template_data =
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<% submitter_versions_index = @submission.submitters.preload(:submitter_versions).each_with_object({}) { |s, h| h[s.id] = s.submitter_versions.to_a.sort_by(&:created_at) } %>
|
<% submitter_versions_index = @submission.submitters.preload(:submitter_versions).to_h { |s| [s.id, s.submitter_versions.to_a.sort_by(&:created_at)] } %>
|
||||||
<% @submission.submission_events.order(:event_timestamp).each do |event| %>
|
<% @submission.submission_events.order(:event_timestamp).each do |event| %>
|
||||||
<% submitter = @submission.submitters.find { |e| e.id == event.submitter_id } %>
|
<% submitter = @submission.submitters.find { |e| e.id == event.submitter_id } %>
|
||||||
<% bg_class = event_colors[submitters_uuids.index(submitter.uuid) % event_colors.length] %>
|
<% bg_class = event_colors[submitters_uuids.index(submitter.uuid) % event_colors.length] %>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
<% elsif event.event_type == 'invite_party' && (invited_submitter = @submission.submitters.find { |e| e.uuid == event.data['uuid'] }) && (name = @submission.template_submitters.find { |e| e['uuid'] == event.data['uuid'] }&.dig('name')) %>
|
<% elsif event.event_type == 'invite_party' && (invited_submitter = @submission.submitters.find { |e| e.uuid == event.data['uuid'] }) && (name = @submission.template_submitters.find { |e| e['uuid'] == event.data['uuid'] }&.dig('name')) %>
|
||||||
<%= t('submission_event_names.invite_party_by_html', invited_submitter_name: [invited_submitter.name || invited_submitter.email || invited_submitter.phone, name].join(' '), submitter_name:) %>
|
<%= t('submission_event_names.invite_party_by_html', invited_submitter_name: [invited_submitter.name || invited_submitter.email || invited_submitter.phone, name].join(' '), submitter_name:) %>
|
||||||
<% elsif event.event_type == 'delegate_form' %>
|
<% elsif event.event_type == 'delegate_form' %>
|
||||||
<% delegate_from = event.data['old_email'].presence || versions.reverse.find { |v| v.created_at <= event.event_timestamp }&.then { |v| v.name || v.phone } %>
|
<% delegate_from = event.data['old_email'].presence || versions.rfind { |v| v.created_at <= event.event_timestamp }&.then { |v| v.name || v.phone } %>
|
||||||
<%= t('submission_event_names.delegate_form_by_html', from: delegate_from, to: event.data['email']) %>
|
<%= t('submission_event_names.delegate_form_by_html', from: delegate_from, to: event.data['email']) %>
|
||||||
<% elsif event.event_type.include?('send_') %>
|
<% elsif event.event_type.include?('send_') %>
|
||||||
<%= t("submission_event_names.#{event.event_type}_to_html", submitter_name:) %>
|
<%= t("submission_event_names.#{event.event_type}_to_html", submitter_name:) %>
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
<% submitters_index = @submission.submitters.index_by(&:uuid) %>
|
<% submitters_index = @submission.submitters.index_by(&:uuid) %>
|
||||||
<% submitters_order_index = nil %>
|
<% submitters_order_index = nil %>
|
||||||
<% attachments_index = ActiveStorage::Attachment.where(record: @submission.submitters, name: :attachments).preload(:blob).index_by(&:uuid) %>
|
<% attachments_index = ActiveStorage::Attachment.where(record: @submission.submitters, name: :attachments).preload(:blob).index_by(&:uuid) %>
|
||||||
<% page_blob_struct = Struct.new(:url, :metadata, keyword_init: true) %>
|
<% page_blob_struct = Struct.new(:url, :metadata) %>
|
||||||
<% bg_classes = %w[bg-red-100 bg-sky-100 bg-emerald-100 bg-yellow-100 bg-purple-100 bg-pink-100 bg-cyan-100 bg-orange-100 bg-lime-100 bg-indigo-100] %>
|
<% bg_classes = %w[bg-red-100 bg-sky-100 bg-emerald-100 bg-yellow-100 bg-purple-100 bg-pink-100 bg-cyan-100 bg-orange-100 bg-lime-100 bg-indigo-100] %>
|
||||||
<% schema.each do |item| %>
|
<% schema.each do |item| %>
|
||||||
<% document = @submission.schema_documents.find { |e| e.uuid == item['attachment_uuid'] } %>
|
<% document = @submission.schema_documents.find { |e| e.uuid == item['attachment_uuid'] } %>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<% fields_index = Templates.build_field_areas_index(@submitter.submission.template_fields || @submitter.submission.template.fields) %>
|
<% fields_index = Templates.build_field_areas_index(@submitter.submission.template_fields || @submitter.submission.template.fields) %>
|
||||||
<% values = @submitter.submission.submitters.reduce({}) { |acc, sub| acc.merge(sub.values) } %>
|
<% values = @submitter.submission.submitters.reduce({}) { |acc, sub| acc.merge(sub.values) } %>
|
||||||
<% submitters_index = @submitter.submission.submitters.index_by(&:uuid) %>
|
<% submitters_index = @submitter.submission.submitters.index_by(&:uuid) %>
|
||||||
<% page_blob_struct = Struct.new(:url, :metadata, keyword_init: true) %>
|
<% page_blob_struct = Struct.new(:url, :metadata) %>
|
||||||
<% schema = Submissions.filtered_conditions_schema(@submitter.submission, values:, include_submitter_uuid: @submitter.uuid) %>
|
<% schema = Submissions.filtered_conditions_schema(@submitter.submission, values:, include_submitter_uuid: @submitter.uuid) %>
|
||||||
<% font_scale = 1000.0 / PdfUtils::US_LETTER_W %>
|
<% font_scale = 1000.0 / PdfUtils::US_LETTER_W %>
|
||||||
<% decline_modal_checkbox_uuid = nil %>
|
<% decline_modal_checkbox_uuid = nil %>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
module GenerateCertificate
|
module GenerateCertificate
|
||||||
SIZE = 2**11
|
SIZE = 2**11
|
||||||
|
|
||||||
Pkcs12Struct = Struct.new(:certificate, :ca_certs, keyword_init: true)
|
Pkcs12Struct = Struct.new(:certificate, :ca_certs)
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ module Params
|
|||||||
def in_path(params, path = [], skip_blank: false)
|
def in_path(params, path = [], skip_blank: false)
|
||||||
old_path = @current_path
|
old_path = @current_path
|
||||||
|
|
||||||
@current_path = [old_path, *path].compact_blank.map(&:to_s).join('.')
|
@current_path = [old_path, *path].compact_blank.join('.')
|
||||||
|
|
||||||
param = params.dig(*path)
|
param = params.dig(*path)
|
||||||
param = nil if skip_blank && param.blank?
|
param = nil if skip_blank && param.blank?
|
||||||
@@ -106,7 +106,7 @@ module Params
|
|||||||
old_path = @current_path
|
old_path = @current_path
|
||||||
|
|
||||||
params.dig(*path)&.each_with_index do |item, index|
|
params.dig(*path)&.each_with_index do |item, index|
|
||||||
@current_path = [old_path, [*path].map(&:to_s).join('.') + "[#{index}]"].compact_blank.join('.')
|
@current_path = [old_path, [*path].join('.') + "[#{index}]"].compact_blank.join('.')
|
||||||
|
|
||||||
yield item if item
|
yield item if item
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -438,8 +438,8 @@ module Submissions
|
|||||||
|
|
||||||
composer.text(I18n.t('event_log'), font_size: 12, padding: [10, 0, 20, 0])
|
composer.text(I18n.t('event_log'), font_size: 12, padding: [10, 0, 20, 0])
|
||||||
|
|
||||||
submitter_versions_index = submission.submitters.preload(:submitter_versions).each_with_object({}) do |s, h|
|
submitter_versions_index = submission.submitters.preload(:submitter_versions).to_h do |s|
|
||||||
h[s.id] = s.submitter_versions.to_a.sort_by(&:created_at)
|
[s.id, s.submitter_versions.to_a.sort_by(&:created_at)]
|
||||||
end
|
end
|
||||||
|
|
||||||
events_data = submission.submission_events.sort_by(&:event_timestamp).filter_map do |event|
|
events_data = submission.submission_events.sort_by(&:event_timestamp).filter_map do |event|
|
||||||
@@ -475,7 +475,7 @@ module Submissions
|
|||||||
].join("\n")
|
].join("\n")
|
||||||
elsif event.event_type == 'delegate_form'
|
elsif event.event_type == 'delegate_form'
|
||||||
from = event.data['old_email'].presence ||
|
from = event.data['old_email'].presence ||
|
||||||
versions.reverse.find { |v| v.created_at <= event.event_timestamp }&.then { |v| v.name || v.phone }
|
versions.rfind { |v| v.created_at <= event.event_timestamp }&.then { |v| v.name || v.phone }
|
||||||
I18n.t('submission_event_names.delegate_form_by_html', from:, to: event.data['email'])
|
I18n.t('submission_event_names.delegate_form_by_html', from:, to: event.data['email'])
|
||||||
elsif event.event_type.include?('send_')
|
elsif event.event_type.include?('send_')
|
||||||
I18n.t("submission_event_names.#{event.event_type}_to_html", submitter_name:)
|
I18n.t("submission_event_names.#{event.event_type}_to_html", submitter_name:)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ module Submissions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build_table_rows(submissions, expires_at: nil)
|
def build_table_rows(submissions, expires_at: nil)
|
||||||
submissions.preload(submitters: [attachments_attachments: :blob, documents_attachments: :blob])
|
submissions.preload(submitters: [{ attachments_attachments: :blob, documents_attachments: :blob }])
|
||||||
.find_each.map do |submission|
|
.find_each.map do |submission|
|
||||||
submission_data = []
|
submission_data = []
|
||||||
submitters_count = submission.submitters.size
|
submitters_count = submission.submitters.size
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ module Submitters
|
|||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [submitter],
|
records: [submitter],
|
||||||
associations: if with_documents
|
associations: if with_documents
|
||||||
[documents_attachments: :blob, attachments_attachments: :blob]
|
[{ documents_attachments: :blob, attachments_attachments: :blob }]
|
||||||
elsif with_values
|
elsif with_values
|
||||||
[attachments_attachments: :blob]
|
[{ attachments_attachments: :blob }]
|
||||||
end
|
end
|
||||||
).call
|
).call
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ module Submitters
|
|||||||
|
|
||||||
def call(submitter, expires_at: Accounts.link_expires_at(Account.new(id: submitter.account_id)))
|
def call(submitter, expires_at: Accounts.link_expires_at(Account.new(id: submitter.account_id)))
|
||||||
ActiveRecord::Associations::Preloader.new(
|
ActiveRecord::Associations::Preloader.new(
|
||||||
records: [submitter], associations: [documents_attachments: :blob, attachments_attachments: :blob]
|
records: [submitter], associations: [{ documents_attachments: :blob, attachments_attachments: :blob }]
|
||||||
).call
|
).call
|
||||||
|
|
||||||
values = build_values_array(submitter, expires_at:)
|
values = build_values_array(submitter, expires_at:)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Templates
|
|||||||
module DetectFields
|
module DetectFields
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
TextFieldBox = Struct.new(:x, :y, :w, :h, keyword_init: true) do
|
TextFieldBox = Struct.new(:x, :y, :w, :h) do
|
||||||
def endy
|
def endy
|
||||||
@endy ||= y + h
|
@endy ||= y + h
|
||||||
end
|
end
|
||||||
@@ -14,7 +14,7 @@ module Templates
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
PageNode = Struct.new(:prev, :next, :elem, :page, :attachment_uuid, keyword_init: true)
|
PageNode = Struct.new(:prev, :next, :elem, :page, :attachment_uuid)
|
||||||
|
|
||||||
DATE_REGEXP = /
|
DATE_REGEXP = /
|
||||||
(?:
|
(?:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Templates
|
|||||||
module ImageToFields
|
module ImageToFields
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
Field = Struct.new(:type, :x, :y, :w, :h, :confidence, keyword_init: true) do
|
Field = Struct.new(:type, :x, :y, :w, :h, :confidence) do
|
||||||
def endy
|
def endy
|
||||||
@endy ||= y + h
|
@endy ||= y + h
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ module Templates
|
|||||||
|
|
||||||
if index.positive? && pdf_fields.present?
|
if index.positive? && pdf_fields.present?
|
||||||
preview_document = template.schema[index - 1]
|
preview_document = template.schema[index - 1]
|
||||||
preview_document_last_field = template.fields.reverse.find do |f|
|
preview_document_last_field = template.fields.rfind do |f|
|
||||||
f['areas']&.any? do |a|
|
f['areas']&.any? do |a|
|
||||||
a['attachment_uuid'] == preview_document[:attachment_uuid]
|
a['attachment_uuid'] == preview_document[:attachment_uuid]
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user