mirror of
https://github.com/docusealco/docuseal.git
synced 2026-06-23 04:10:11 +00:00
fix rubocop
This commit is contained in:
@@ -51,6 +51,15 @@ Style/NumericPredicate:
|
||||
Style/MinMaxComparison:
|
||||
Enabled: false
|
||||
|
||||
Style/EmptyClassDefinition:
|
||||
Enabled: false
|
||||
|
||||
Style/OneClassPerFile:
|
||||
Enabled: false
|
||||
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
Enabled: false
|
||||
|
||||
Naming/PredicateMethod:
|
||||
Enabled: false
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ module Api
|
||||
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [@template],
|
||||
associations: [schema_documents: :preview_images_attachments]
|
||||
associations: [{ schema_documents: :preview_images_attachments }]
|
||||
).call
|
||||
|
||||
cloned_template = Templates::Clone.call(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class EsignSettingsController < ApplicationController
|
||||
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
|
||||
|
||||
def to_key
|
||||
|
||||
@@ -26,7 +26,7 @@ class SubmissionsController < ApplicationController
|
||||
unless @submission.submitters.all?(&:completed_at?)
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [@submission],
|
||||
associations: [submitters: :start_form_submission_events]
|
||||
associations: [{ submitters: :start_form_submission_events }]
|
||||
).call
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class TemplatesCloneAndReplaceController < ApplicationController
|
||||
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [@template],
|
||||
associations: [schema_documents: :preview_images_attachments]
|
||||
associations: [{ schema_documents: :preview_images_attachments }]
|
||||
).call
|
||||
|
||||
cloned_template = Templates::Clone.call(@template, author: current_user)
|
||||
|
||||
@@ -12,7 +12,7 @@ class TemplatesCloneController < ApplicationController
|
||||
def create
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [@base_template],
|
||||
associations: [schema_documents: :preview_images_attachments]
|
||||
associations: [{ schema_documents: :preview_images_attachments }]
|
||||
).call
|
||||
|
||||
@template = Templates::Clone.call(@base_template, author: current_user,
|
||||
|
||||
@@ -29,7 +29,7 @@ class TemplatesController < ApplicationController
|
||||
def edit
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [@template],
|
||||
associations: [schema_documents: [:blob, { preview_images_attachments: :blob }]]
|
||||
associations: [{ schema_documents: [:blob, { preview_images_attachments: :blob }] }]
|
||||
).call
|
||||
|
||||
@template_data =
|
||||
|
||||
@@ -30,7 +30,7 @@ class TemplatesDebugController < ApplicationController
|
||||
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [@template],
|
||||
associations: [schema_documents: { preview_images_attachments: :blob }]
|
||||
associations: [{ schema_documents: { preview_images_attachments: :blob } }]
|
||||
).call
|
||||
|
||||
@template_data =
|
||||
|
||||
@@ -58,8 +58,8 @@ class TemplatesPreferencesController < ApplicationController
|
||||
default_expire_at_duration shared_link_2fa default_expire_at request_email_enabled
|
||||
completed_notification_email_subject completed_notification_email_body
|
||||
completed_notification_email_enabled completed_notification_email_attach_audit] +
|
||||
[completed_message: %i[title body],
|
||||
submitters: [%i[uuid request_email_subject request_email_body]], link_form_fields: []]
|
||||
[{ completed_message: %i[title body],
|
||||
submitters: [%i[uuid request_email_subject request_email_body]], link_form_fields: [] }]
|
||||
).tap do |attrs|
|
||||
attrs[:preferences].delete(:submitters) if params[:request_email_per_submitter] != '1'
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class TemplatesPreviewController < ApplicationController
|
||||
def show
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [@template],
|
||||
associations: [schema_documents: { preview_images_attachments: :blob }]
|
||||
associations: [{ schema_documents: { preview_images_attachments: :blob } }]
|
||||
).call
|
||||
|
||||
@template_data =
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<% end %>
|
||||
</p>
|
||||
</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| %>
|
||||
<% submitter = @submission.submitters.find { |e| e.id == event.submitter_id } %>
|
||||
<% 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')) %>
|
||||
<%= 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' %>
|
||||
<% 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']) %>
|
||||
<% elsif event.event_type.include?('send_') %>
|
||||
<%= t("submission_event_names.#{event.event_type}_to_html", submitter_name:) %>
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<% submitters_index = @submission.submitters.index_by(&:uuid) %>
|
||||
<% submitters_order_index = nil %>
|
||||
<% 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] %>
|
||||
<% schema.each do |item| %>
|
||||
<% 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) %>
|
||||
<% values = @submitter.submission.submitters.reduce({}) { |acc, sub| acc.merge(sub.values) } %>
|
||||
<% 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) %>
|
||||
<% font_scale = 1000.0 / PdfUtils::US_LETTER_W %>
|
||||
<% decline_modal_checkbox_uuid = nil %>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
module GenerateCertificate
|
||||
SIZE = 2**11
|
||||
|
||||
Pkcs12Struct = Struct.new(:certificate, :ca_certs, keyword_init: true)
|
||||
Pkcs12Struct = Struct.new(:certificate, :ca_certs)
|
||||
|
||||
module_function
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ module Params
|
||||
def in_path(params, path = [], skip_blank: false)
|
||||
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 = nil if skip_blank && param.blank?
|
||||
@@ -106,7 +106,7 @@ module Params
|
||||
old_path = @current_path
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
@@ -438,8 +438,8 @@ module Submissions
|
||||
|
||||
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|
|
||||
h[s.id] = s.submitter_versions.to_a.sort_by(&:created_at)
|
||||
submitter_versions_index = submission.submitters.preload(:submitter_versions).to_h do |s|
|
||||
[s.id, s.submitter_versions.to_a.sort_by(&:created_at)]
|
||||
end
|
||||
|
||||
events_data = submission.submission_events.sort_by(&:event_timestamp).filter_map do |event|
|
||||
@@ -475,7 +475,7 @@ module Submissions
|
||||
].join("\n")
|
||||
elsif event.event_type == 'delegate_form'
|
||||
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'])
|
||||
elsif event.event_type.include?('send_')
|
||||
I18n.t("submission_event_names.#{event.event_type}_to_html", submitter_name:)
|
||||
|
||||
@@ -58,7 +58,7 @@ module Submissions
|
||||
end
|
||||
|
||||
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|
|
||||
submission_data = []
|
||||
submitters_count = submission.submitters.size
|
||||
|
||||
@@ -15,9 +15,9 @@ module Submitters
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [submitter],
|
||||
associations: if with_documents
|
||||
[documents_attachments: :blob, attachments_attachments: :blob]
|
||||
[{ documents_attachments: :blob, attachments_attachments: :blob }]
|
||||
elsif with_values
|
||||
[attachments_attachments: :blob]
|
||||
[{ attachments_attachments: :blob }]
|
||||
end
|
||||
).call
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ module Submitters
|
||||
|
||||
def call(submitter, expires_at: Accounts.link_expires_at(Account.new(id: submitter.account_id)))
|
||||
ActiveRecord::Associations::Preloader.new(
|
||||
records: [submitter], associations: [documents_attachments: :blob, attachments_attachments: :blob]
|
||||
records: [submitter], associations: [{ documents_attachments: :blob, attachments_attachments: :blob }]
|
||||
).call
|
||||
|
||||
values = build_values_array(submitter, expires_at:)
|
||||
|
||||
@@ -4,7 +4,7 @@ module Templates
|
||||
module DetectFields
|
||||
module_function
|
||||
|
||||
TextFieldBox = Struct.new(:x, :y, :w, :h, keyword_init: true) do
|
||||
TextFieldBox = Struct.new(:x, :y, :w, :h) do
|
||||
def endy
|
||||
@endy ||= y + h
|
||||
end
|
||||
@@ -14,7 +14,7 @@ module Templates
|
||||
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 = /
|
||||
(?:
|
||||
|
||||
@@ -4,7 +4,7 @@ module Templates
|
||||
module ImageToFields
|
||||
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
|
||||
@endy ||= y + h
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ module Templates
|
||||
|
||||
if index.positive? && pdf_fields.present?
|
||||
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|
|
||||
a['attachment_uuid'] == preview_document[:attachment_uuid]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user