mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 06:42:32 -05:00
fix rubocop
This commit is contained in:
1 parent
f9c12b9d78
commit
9bfa6f7f4a
25 files changed
+27
-52
No files matched your search
@@ -54,14 +54,13 @@ class AccountsController < ApplicationController
|
|||||||
email: true_user.email.sub('@', '+removed@'))
|
email: true_user.email.sub('@', '+removed@'))
|
||||||
true_user.account.update!(archived_at: Time.current)
|
true_user.account.update!(archived_at: Time.current)
|
||||||
|
|
||||||
# rubocop:disable Layout/LineLength
|
# rubocop:disable-next Layout/LineLength
|
||||||
render turbo_stream: turbo_stream.replace(
|
render turbo_stream: turbo_stream.replace(
|
||||||
:account_delete_button,
|
:account_delete_button,
|
||||||
html: helpers.tag.p(I18n.t('your_account_will_be_permanently_deleted_within_2_months_please_contact_us_if_you_want_to_keep_your_account')) +
|
html: helpers.tag.p(I18n.t('your_account_will_be_permanently_deleted_within_2_months_please_contact_us_if_you_want_to_keep_your_account')) +
|
||||||
helpers.tag.br +
|
helpers.tag.br +
|
||||||
helpers.tag.p(I18n.t('your_email_address_has_been_released_immediately_you_can_now_be_added_to_your_company_team_without_waiting_for_the_deletion_period_to_end'))
|
helpers.tag.p(I18n.t('your_email_address_has_been_released_immediately_you_can_now_be_added_to_your_company_team_without_waiting_for_the_deletion_period_to_end'))
|
||||||
)
|
)
|
||||||
# rubocop:enable Layout/LineLength
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ module Api
|
|||||||
before_action :set_noindex_headers
|
before_action :set_noindex_headers
|
||||||
before_action :set_security_headers
|
before_action :set_security_headers
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def show
|
def show
|
||||||
blob_uuid, purp, exp = ApplicationRecord.signed_id_verifier.verified(params[:signed_uuid])
|
blob_uuid, purp, exp = ApplicationRecord.signed_id_verifier.verified(params[:signed_uuid])
|
||||||
|
|
||||||
@@ -53,7 +53,6 @@ module Api
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ module Api
|
|||||||
render json: Submitters::SerializeForApi.call(@submitter, with_template: true, with_events: true, params:)
|
render json: Submitters::SerializeForApi.call(@submitter, with_template: true, with_events: true, params:)
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
# rubocop:disable-next Metrics/MethodLength
|
||||||
def update
|
def update
|
||||||
submission = @submitter.submission
|
submission = @submitter.submission
|
||||||
role = submission.template_submitters.find { |e| e['uuid'] == @submitter.uuid }['name']
|
role = submission.template_submitters.find { |e| e['uuid'] == @submitter.uuid }['name']
|
||||||
@@ -84,7 +84,6 @@ module Api
|
|||||||
|
|
||||||
render json: { error: e.message }, status: :unprocessable_content
|
render json: { error: e.message }, status: :unprocessable_content
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/MethodLength
|
|
||||||
|
|
||||||
def submitter_params
|
def submitter_params
|
||||||
submitter_params = params.key?(:submitter) ? params.require(:submitter) : params
|
submitter_params = params.key?(:submitter) ? params.require(:submitter) : params
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ module Mcp
|
|||||||
}
|
}
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
# rubocop:disable-next Metrics/AbcSize, Metrics/MethodLength
|
||||||
def call
|
def call
|
||||||
account = current_user.account
|
account = current_user.account
|
||||||
|
|
||||||
@@ -87,6 +87,5 @@ module Mcp
|
|||||||
edit_url: edit_template_url(@template)
|
edit_url: edit_template_url(@template)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -66,7 +66,7 @@ module Mcp
|
|||||||
}
|
}
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def call
|
def call
|
||||||
@template = Template.accessible_by(current_ability).find(mcp_params['template_id'])
|
@template = Template.accessible_by(current_ability).find(mcp_params['template_id'])
|
||||||
|
|
||||||
@@ -115,6 +115,5 @@ module Mcp
|
|||||||
rescue Submissions::CreateFromSubmitters::BaseError => e
|
rescue Submissions::CreateFromSubmitters::BaseError => e
|
||||||
render_tool_error(e.message)
|
render_tool_error(e.message)
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PasswordsController < Devise::PasswordsController
|
class PasswordsController < Devise::PasswordsController
|
||||||
# rubocop:disable Rails/LexicallyScopedActionFilter
|
# rubocop:disable-next Rails/LexicallyScopedActionFilter
|
||||||
skip_before_action :require_no_authentication, only: %i[edit update]
|
skip_before_action :require_no_authentication, only: %i[edit update]
|
||||||
# rubocop:enable Rails/LexicallyScopedActionFilter
|
|
||||||
|
|
||||||
around_action :with_browser_locale
|
around_action :with_browser_locale
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class PreviewDocumentPageController < ActionController::API
|
|||||||
File.open(file_path, File::RDWR | File::CREAT, 0o644) do |file|
|
File.open(file_path, File::RDWR | File::CREAT, 0o644) do |file|
|
||||||
file.flock(File::LOCK_EX)
|
file.flock(File::LOCK_EX)
|
||||||
|
|
||||||
# rubocop:disable Style/ZeroLengthPredicate
|
# rubocop:disable-next Style/ZeroLengthPredicate
|
||||||
if file.size.zero?
|
if file.size.zero?
|
||||||
cleanup_stale_tempfiles
|
cleanup_stale_tempfiles
|
||||||
|
|
||||||
@@ -63,7 +63,6 @@ class PreviewDocumentPageController < ActionController::API
|
|||||||
else
|
else
|
||||||
FileUtils.touch(file_path)
|
FileUtils.touch(file_path)
|
||||||
end
|
end
|
||||||
# rubocop:enable Style/ZeroLengthPredicate
|
|
||||||
|
|
||||||
file.flock(File::LOCK_UN)
|
file.flock(File::LOCK_UN)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ ActiveSupport.on_load(:active_storage_attachment) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/BlockLength
|
# rubocop:disable-next Metrics/BlockLength
|
||||||
ActiveSupport.on_load(:active_storage_blob) do
|
ActiveSupport.on_load(:active_storage_blob) do
|
||||||
attribute :uuid, :string, default: -> { SecureRandom.uuid }
|
attribute :uuid, :string, default: -> { SecureRandom.uuid }
|
||||||
attribute :io_data, :string, default: ''
|
attribute :io_data, :string, default: ''
|
||||||
@@ -59,7 +59,6 @@ ActiveSupport.on_load(:active_storage_blob) do
|
|||||||
service.delete(key)
|
service.delete(key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/BlockLength
|
|
||||||
|
|
||||||
ActiveStorage::LogSubscriber.detach_from(:active_storage) if Rails.env.production?
|
ActiveStorage::LogSubscriber.detach_from(:active_storage) if Rails.env.production?
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ end
|
|||||||
#
|
#
|
||||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||||
# Many of these configuration options can be set straight in your model.
|
# Many of these configuration options can be set straight in your model.
|
||||||
# rubocop:disable Metrics/BlockLength
|
# rubocop:disable-next Metrics/BlockLength
|
||||||
Devise.setup do |config|
|
Devise.setup do |config|
|
||||||
config.warden do |manager|
|
config.warden do |manager|
|
||||||
manager.default_strategies(scope: :user).unshift(:two_factor_authenticatable)
|
manager.default_strategies(scope: :user).unshift(:two_factor_authenticatable)
|
||||||
@@ -336,4 +336,3 @@ Devise.setup do |config|
|
|||||||
|
|
||||||
ActiveSupport.run_load_hooks(:devise_config, config)
|
ActiveSupport.run_load_hooks(:devise_config, config)
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/BlockLength
|
|
||||||
@@ -10,9 +10,8 @@ ActionView::Base.field_error_proc = proc do |html_tag, instance|
|
|||||||
|
|
||||||
parsed_html_tag = Nokogiri::HTML::DocumentFragment.parse(html_tag)
|
parsed_html_tag = Nokogiri::HTML::DocumentFragment.parse(html_tag)
|
||||||
parsed_html_tag.children.add_class 'input-error'
|
parsed_html_tag.children.add_class 'input-error'
|
||||||
# rubocop:disable Rails/OutputSafety
|
# rubocop:disable-next Rails/OutputSafety
|
||||||
html_tag = parsed_html_tag.to_s.html_safe
|
html_tag = parsed_html_tag.to_s.html_safe
|
||||||
# rubocop:enable Rails/OutputSafety
|
|
||||||
|
|
||||||
result = html_tag
|
result = html_tag
|
||||||
|
|
||||||
|
|||||||
@@ -72,9 +72,8 @@ module HexaPDF
|
|||||||
def terminal_field?
|
def terminal_field?
|
||||||
kids = self[:Kids]
|
kids = self[:Kids]
|
||||||
|
|
||||||
# rubocop:disable Rails/Blank
|
# rubocop:disable-next Rails/Blank
|
||||||
kids.nil? || kids.empty? || kids.none? { |kid| kid&.key?(:T) }
|
kids.nil? || kids.empty? || kids.none? { |kid| kid&.key?(:T) }
|
||||||
# rubocop:enable Rails/Blank
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
class AddIsFirstToCompletedSubmitters < ActiveRecord::Migration[8.0]
|
class AddIsFirstToCompletedSubmitters < ActiveRecord::Migration[8.0]
|
||||||
def change
|
def change
|
||||||
# rubocop:disable Rails/ThreeStateBooleanColumn
|
# rubocop:disable-next Rails/ThreeStateBooleanColumn
|
||||||
add_column :completed_submitters, :is_first, :boolean
|
add_column :completed_submitters, :is_first, :boolean
|
||||||
# rubocop:enable Rails/ThreeStateBooleanColumn
|
|
||||||
|
|
||||||
add_index :completed_submitters, %i[account_id completed_at],
|
add_index :completed_submitters, %i[account_id completed_at],
|
||||||
where: 'is_first = TRUE',
|
where: 'is_first = TRUE',
|
||||||
|
|||||||
+2
-2
@@ -111,7 +111,7 @@ module LoadIco
|
|||||||
and_scanline_stride = 0
|
and_scanline_stride = 0
|
||||||
if has_and_mask
|
if has_and_mask
|
||||||
and_mask_data_offset = xor_mask_data_offset + (image_pixel_height * xor_scanline_stride)
|
and_mask_data_offset = xor_mask_data_offset + (image_pixel_height * xor_scanline_stride)
|
||||||
and_scanline_stride = (((dib_width * 1) + 31) / 32) * 4
|
and_scanline_stride = ((dib_width + 31) / 32) * 4
|
||||||
end
|
end
|
||||||
|
|
||||||
flat_rgba_pixels = []
|
flat_rgba_pixels = []
|
||||||
@@ -128,7 +128,7 @@ module LoadIco
|
|||||||
if has_and_mask
|
if has_and_mask
|
||||||
dib_io.seek(and_mask_data_offset + (y_dib_row * and_scanline_stride))
|
dib_io.seek(and_mask_data_offset + (y_dib_row * and_scanline_stride))
|
||||||
and_mask_scanline_bytes = dib_io.read(and_scanline_stride)
|
and_mask_scanline_bytes = dib_io.read(and_scanline_stride)
|
||||||
min_and_bytes_needed = ((dib_width * 1) + 7) / 8
|
min_and_bytes_needed = (dib_width + 7) / 8
|
||||||
return nil unless and_mask_scanline_bytes && and_mask_scanline_bytes.bytesize >= min_and_bytes_needed
|
return nil unless and_mask_scanline_bytes && and_mask_scanline_bytes.bytesize >= min_and_bytes_needed
|
||||||
|
|
||||||
(0...dib_width).each do |x_pixel|
|
(0...dib_width).each do |x_pixel|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ module MarkdownToHtml
|
|||||||
html.presence || '<p></p>'
|
html.presence || '<p></p>'
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def parse_inline(text)
|
def parse_inline(text)
|
||||||
context = []
|
context = []
|
||||||
out = ''
|
out = ''
|
||||||
@@ -128,5 +128,4 @@ module MarkdownToHtml
|
|||||||
|
|
||||||
(out + text[last..].to_s + flush.call).gsub('<a>', '[')
|
(out + text[last..].to_s + flush.call).gsub('<a>', '[')
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
end
|
end
|
||||||
+2
-4
@@ -86,7 +86,7 @@ class Pdfium
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Naming/ClassAndModuleCamelCase
|
# rubocop:disable-next Naming/ClassAndModuleCamelCase
|
||||||
class FPDF_LIBRARY_CONFIG < FFI::Struct
|
class FPDF_LIBRARY_CONFIG < FFI::Struct
|
||||||
layout :version, :int,
|
layout :version, :int,
|
||||||
:m_pUserFontPaths, :pointer,
|
:m_pUserFontPaths, :pointer,
|
||||||
@@ -95,7 +95,6 @@ class Pdfium
|
|||||||
:m_pPlatform, :pointer,
|
:m_pPlatform, :pointer,
|
||||||
:m_RendererType, :int
|
:m_RendererType, :int
|
||||||
end
|
end
|
||||||
# rubocop:enable Naming/ClassAndModuleCamelCase
|
|
||||||
|
|
||||||
attach_function :FPDF_InitLibraryWithConfig, [:pointer], :void
|
attach_function :FPDF_InitLibraryWithConfig, [:pointer], :void
|
||||||
attach_function :FPDF_DestroyLibrary, [], :void
|
attach_function :FPDF_DestroyLibrary, [], :void
|
||||||
@@ -234,7 +233,7 @@ class Pdfium
|
|||||||
typedef :int, :FPDF_BOOL
|
typedef :int, :FPDF_BOOL
|
||||||
typedef :pointer, :IPDF_JSPLATFORM
|
typedef :pointer, :IPDF_JSPLATFORM
|
||||||
|
|
||||||
# rubocop:disable Naming/ClassAndModuleCamelCase
|
# rubocop:disable-next Naming/ClassAndModuleCamelCase
|
||||||
class FPDF_FORMFILLINFO_V2 < FFI::Struct
|
class FPDF_FORMFILLINFO_V2 < FFI::Struct
|
||||||
layout :version, :int,
|
layout :version, :int,
|
||||||
:Release, :pointer,
|
:Release, :pointer,
|
||||||
@@ -272,7 +271,6 @@ class Pdfium
|
|||||||
:FFI_OnFocusChange, :pointer,
|
:FFI_OnFocusChange, :pointer,
|
||||||
:FFI_DoURIActionWithKeyboardModifier, :pointer
|
:FFI_DoURIActionWithKeyboardModifier, :pointer
|
||||||
end
|
end
|
||||||
# rubocop:enable Naming/ClassAndModuleCamelCase
|
|
||||||
|
|
||||||
attach_function :FPDFDOC_InitFormFillEnvironment, %i[FPDF_DOCUMENT pointer], :FPDF_FORMHANDLE
|
attach_function :FPDFDOC_InitFormFillEnvironment, %i[FPDF_DOCUMENT pointer], :FPDF_FORMHANDLE
|
||||||
attach_function :FPDFDOC_ExitFormFillEnvironment, [:FPDF_FORMHANDLE], :void
|
attach_function :FPDFDOC_ExitFormFillEnvironment, [:FPDF_FORMHANDLE], :void
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
require 'puma/plugin'
|
require 'puma/plugin'
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
Puma::Plugin.create do
|
Puma::Plugin.create do
|
||||||
def start(launcher)
|
def start(launcher)
|
||||||
return if ENV['LOCAL_REDIS_URL'].to_s.empty?
|
return if ENV['LOCAL_REDIS_URL'].to_s.empty?
|
||||||
@@ -68,4 +68,3 @@ Puma::Plugin.create do
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
require 'puma/plugin'
|
require 'puma/plugin'
|
||||||
require 'redis_client'
|
require 'redis_client'
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
Puma::Plugin.create do
|
Puma::Plugin.create do
|
||||||
def config(cfg)
|
def config(cfg)
|
||||||
return if cfg.instance_variable_get(:@options)[:workers] <= 0
|
return if cfg.instance_variable_get(:@options)[:workers] <= 0
|
||||||
@@ -73,4 +73,3 @@ Puma::Plugin.create do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
@@ -32,7 +32,7 @@ module ReplaceEmailVariables
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def call(text, submitter:, tracking_event_type: 'click_email', html_escape: false, sig: nil)
|
def call(text, submitter:, tracking_event_type: 'click_email', html_escape: false, sig: nil)
|
||||||
text = replace(text, TEMPLATE_NAME, html_escape:) do
|
text = replace(text, TEMPLATE_NAME, html_escape:) do
|
||||||
(submitter.template || submitter.submission.template || submitter.submission).name
|
(submitter.template || submitter.submission.template || submitter.submission).name
|
||||||
@@ -94,7 +94,6 @@ module ReplaceEmailVariables
|
|||||||
|
|
||||||
text.tr(ESCAPED_BRACES, '{}')
|
text.tr(ESCAPED_BRACES, '{}')
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
|
|
||||||
def build_documents_links_text(submitter, sig = nil)
|
def build_documents_links_text(submitter, sig = nil)
|
||||||
url_options = build_url_options_for(submitter)
|
url_options = build_url_options_for(submitter)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module SendWebhookRequest
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
# rubocop:disable Metrics/AbcSize
|
# rubocop:disable-next Metrics/AbcSize
|
||||||
def call(webhook_url, event_uuid:, event_type:, record:, data:, attempt: 0)
|
def call(webhook_url, event_uuid:, event_type:, record:, data:, attempt: 0)
|
||||||
uri = parse_uri(webhook_url.url)
|
uri = parse_uri(webhook_url.url)
|
||||||
|
|
||||||
@@ -53,7 +53,6 @@ module SendWebhookRequest
|
|||||||
rescue Faraday::Error => e
|
rescue Faraday::Error => e
|
||||||
handle_error(webhook_event, attempt:, error_message: e.message&.truncate(100))
|
handle_error(webhook_event, attempt:, error_message: e.message&.truncate(100))
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/AbcSize
|
|
||||||
|
|
||||||
def parse_uri(url)
|
def parse_uri(url)
|
||||||
URI(url)
|
URI(url)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module Submissions
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def call(submission, submitters = nil, params = {}, with_events: true, with_documents: true, with_values: true,
|
def call(submission, submitters = nil, params = {}, with_events: true, with_documents: true, with_values: true,
|
||||||
expires_at: Accounts.link_expires_at(Account.new(id: submission.account_id)))
|
expires_at: Accounts.link_expires_at(Account.new(id: submission.account_id)))
|
||||||
submitters ||= submission.submitters.preload(documents_attachments: :blob, attachments_attachments: :blob)
|
submitters ||= submission.submitters.preload(documents_attachments: :blob, attachments_attachments: :blob)
|
||||||
@@ -62,7 +62,6 @@ module Submissions
|
|||||||
|
|
||||||
json
|
json
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
|
|
||||||
def build_status(submission, submitters)
|
def build_status(submission, submitters)
|
||||||
if submitters.any?(&:declined_at?)
|
if submitters.any?(&:declined_at?)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module Submissions
|
|||||||
signature[:SubFilter] = :'ETSI.RFC3161'
|
signature[:SubFilter] = :'ETSI.RFC3161'
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def sign(io, byte_range)
|
def sign(io, byte_range)
|
||||||
digest = OpenSSL::Digest.new(HASH_ALGORITHM)
|
digest = OpenSSL::Digest.new(HASH_ALGORITHM)
|
||||||
|
|
||||||
@@ -59,7 +59,6 @@ module Submissions
|
|||||||
|
|
||||||
OpenSSL::ASN1::GeneralizedTime.new(Time.now.utc).to_der
|
OpenSSL::ASN1::GeneralizedTime.new(Time.now.utc).to_der
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
|
|
||||||
def build_payload(digest)
|
def build_payload(digest)
|
||||||
req = OpenSSL::Timestamp::Request.new
|
req = OpenSSL::Timestamp::Request.new
|
||||||
|
|||||||
+1
-2
@@ -197,7 +197,7 @@ module Submitters
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def current_submitter_order?(submitter)
|
def current_submitter_order?(submitter)
|
||||||
submission = submitter.submission
|
submission = submitter.submission
|
||||||
|
|
||||||
@@ -228,7 +228,6 @@ module Submitters
|
|||||||
submitter.nil? || submitter.viewer? || submitter.completed_at?
|
submitter.nil? || submitter.viewer? || submitter.completed_at?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
|
|
||||||
def build_document_filename(submitter, blob, filename_format)
|
def build_document_filename(submitter, blob, filename_format)
|
||||||
return blob.filename.to_s if filename_format.blank?
|
return blob.filename.to_s if filename_format.blank?
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module Submitters
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def call(template, values, submitter_name: nil, role_names: nil, for_submitter: nil, throw_errors: false,
|
def call(template, values, submitter_name: nil, role_names: nil, for_submitter: nil, throw_errors: false,
|
||||||
add_fields: false, purpose: nil)
|
add_fields: false, purpose: nil)
|
||||||
fields =
|
fields =
|
||||||
@@ -85,7 +85,6 @@ module Submitters
|
|||||||
|
|
||||||
[normalized_values, attachments, new_fields]
|
[normalized_values, attachments, new_fields]
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
|
|
||||||
def normalize_value(field, value)
|
def normalize_value(field, value)
|
||||||
if field['type'] == 'checkbox'
|
if field['type'] == 'checkbox'
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ module Submitters
|
|||||||
end.exclude?(false)
|
end.exclude?(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def check_field_condition(condition, submitter_values, fields_uuid_index)
|
def check_field_condition(condition, submitter_values, fields_uuid_index)
|
||||||
value = submitter_values[condition['field_uuid']]
|
value = submitter_values[condition['field_uuid']]
|
||||||
field = fields_uuid_index[condition['field_uuid']]
|
field = fields_uuid_index[condition['field_uuid']]
|
||||||
@@ -437,7 +437,6 @@ module Submitters
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
|
|
||||||
def replace_default_variables(value, attrs, submission, with_time: false, field: nil)
|
def replace_default_variables(value, attrs, submission, with_time: false, field: nil)
|
||||||
return value if value.in?([true, false]) || value.is_a?(Numeric) || value.is_a?(Array)
|
return value if value.in?([true, false]) || value.is_a?(Numeric) || value.is_a?(Array)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Templates
|
|||||||
module ReplaceAttachments
|
module ReplaceAttachments
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
# rubocop:disable Metrics
|
# rubocop:disable-next Metrics
|
||||||
def call(template, params = {}, extract_fields: false)
|
def call(template, params = {}, extract_fields: false)
|
||||||
documents, = Templates::CreateAttachments.call(template, params, extract_fields:)
|
documents, = Templates::CreateAttachments.call(template, params, extract_fields:)
|
||||||
submitter = template.submitters.first
|
submitter = template.submitters.first
|
||||||
@@ -60,6 +60,5 @@ module Templates
|
|||||||
|
|
||||||
documents
|
documents
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user