Skip to content

Commit

Permalink
Merge from docusealco/wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexBTurchyn authored Dec 18, 2024
2 parents 780f551 + bc4c21f commit bb3b38e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
2 changes: 2 additions & 0 deletions lib/docuseal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def active_storage_public?
end

def default_pkcs
return if Docuseal::CERTS['enabled'] == false

@default_pkcs ||= GenerateCertificate.load_pkcs(Docuseal::CERTS)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/submissions/create_from_submitters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def maybe_set_template_fields(submission, submitters_attrs, default_submitter_uu
if template_fields != (submission.template_fields || submission.template.fields) ||
submitters_attrs.any? { |e| e[:completed].present? }
submission.template_fields = template_fields
submission.template_schema = submission.template.schema
submission.template_schema = submission.template.schema if submission.template_schema.blank?
end

submission
Expand Down
14 changes: 9 additions & 5 deletions lib/submissions/generate_audit_trail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ def call(submission)

last_submitter = submission.submitters.select(&:completed_at).max_by(&:completed_at)

sign_params = {
reason: sign_reason,
**Submissions::GenerateResultAttachments.build_signing_params(last_submitter, pkcs, tsa_url)
}
if pkcs
sign_params = {
reason: sign_reason,
**Submissions::GenerateResultAttachments.build_signing_params(last_submitter, pkcs, tsa_url)
}

document.sign(io, **sign_params)
document.sign(io, **sign_params)
else
document.write(io)
end

Submissions::GenerateResultAttachments.maybe_enable_ltv(io, sign_params)

Expand Down
16 changes: 10 additions & 6 deletions lib/submissions/generate_combined_attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ def call(submitter)

pdf.trailer.info[:Creator] = "#{Docuseal.product_name} (#{Docuseal::PRODUCT_URL})"

sign_params = {
reason: Submissions::GenerateResultAttachments.single_sign_reason(submitter),
**Submissions::GenerateResultAttachments.build_signing_params(submitter, pkcs, tsa_url)
}

pdf.sign(io, **sign_params)
if pkcs
sign_params = {
reason: Submissions::GenerateResultAttachments.single_sign_reason(submitter),
**Submissions::GenerateResultAttachments.build_signing_params(submitter, pkcs, tsa_url)
}

pdf.sign(io, **sign_params)
else
pdf.write(io)
end

Submissions::GenerateResultAttachments.maybe_enable_ltv(io, sign_params)

Expand Down
2 changes: 1 addition & 1 deletion lib/submissions/generate_result_attachments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def build_pdf_attachment(pdf:, submitter:, pkcs:, tsa_url:, uuid:, name:)

sign_reason = fetch_sign_reason(submitter)

if sign_reason
if sign_reason && pkcs
sign_params = {
reason: sign_reason,
**build_signing_params(submitter, pkcs, tsa_url)
Expand Down
6 changes: 4 additions & 2 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@
Capybara::Cuprite::Driver.new(app, window_size: [1200, 800],
process_timeout: 20,
timeout: 20,
js_errors: true)
js_errors: true,
browser_options: { 'no-sandbox' => nil })
end

Capybara.register_driver(:headful_cuprite) do |app|
Capybara::Cuprite::Driver.new(app, window_size: [1200, 800],
headless: false,
process_timeout: 20,
timeout: 20,
js_errors: true)
js_errors: true,
browser_options: { 'no-sandbox' => nil })
end

Rails.root.glob('spec/support/**/*.rb').each { |f| require f }
Expand Down

0 comments on commit bb3b38e

Please sign in to comment.