Skip to content

Commit eea44bd

Browse files
authored
Merge from docusealco/wip
2 parents 911e55c + 7cdf263 commit eea44bd

73 files changed

Lines changed: 1843 additions & 296 deletions

File tree

Some content is hidden

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

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Lint/MissingSuper:
2828
Enabled: false
2929

3030
Metrics/ParameterLists:
31-
Max: 10
31+
Max: 12
3232

3333
Metrics/MethodLength:
3434
Max: 30

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ENV OPENSSL_CONF=/etc/openssl_legacy.cnf
4848

4949
WORKDIR /app
5050

51-
RUN apk add --no-cache libpq vips redis vips-heif fontconfig onnxruntime
51+
RUN apk add --no-cache libpq vips redis vips-heif onnxruntime
5252

5353
RUN addgroup -g 2000 docuseal && adduser -u 2000 -G docuseal -s /bin/sh -D -h /home/docuseal docuseal
5454

app/controllers/submit_form_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def update
7979

8080
render json: { field_uuid: e.message }, status: :unprocessable_content
8181
rescue Submitters::SubmitValues::ValidationError => e
82+
Rollbar.warning("Validation error #{@submitter.id}: #{e.message}") if defined?(Rollbar)
83+
8284
render json: { error: e.message }, status: :unprocessable_content
8385
end
8486

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# frozen_string_literal: true
2+
3+
class SubmitFormMetadataController < ApplicationController
4+
skip_before_action :authenticate_user!
5+
skip_authorization_check
6+
7+
def index
8+
submitter = Submitter.find_by!(slug: params[:submit_form_slug])
9+
10+
return head :not_found if submitter.declined_at? ||
11+
submitter.completed_at? ||
12+
submitter.submission.archived_at? ||
13+
submitter.submission.expired? ||
14+
submitter.submission.template&.archived_at? ||
15+
submitter.account.archived_at? ||
16+
!Submitters::AuthorizedForForm.call(submitter, current_user, request)
17+
18+
submission = submitter.submission
19+
values = submission.submitters.reduce({}) { |acc, sub| acc.merge(sub.values) }
20+
schema = Submissions.filtered_conditions_schema(submission, values:, include_submitter_uuid: submitter.uuid)
21+
22+
documents = schema.filter_map do |item|
23+
submission.schema_documents.find { |a| a.uuid == item['attachment_uuid'] }
24+
end
25+
26+
ActiveRecord::Associations::Preloader.new(records: documents, associations: %i[blob record]).call
27+
28+
text_runs = documents.to_h do |document|
29+
[
30+
document.uuid,
31+
DocumentMetadatas.find_or_create_for_document(document, account_id: document.record.account_id).text_runs
32+
]
33+
end
34+
35+
render json: { text_runs: }
36+
end
37+
end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
class TemplatesShareLinkQrController < ApplicationController
4+
load_and_authorize_resource :template
5+
6+
def show
7+
return render :disabled, layout: 'plain' unless @template.shared_link?
8+
9+
shared_link_url = start_form_url(slug: @template.slug, host: form_link_host)
10+
11+
@qr_svg_code = RQRCode::QRCode.new(shared_link_url, level: :m).as_svg(viewbox: true)
12+
13+
@page_size =
14+
if TimeUtils.timezone_abbr(current_account.timezone, Time.current.beginning_of_year).in?(TimeUtils::US_TIMEZONES)
15+
'Letter'
16+
else
17+
'A4'
18+
end
19+
20+
render :show, layout: false
21+
end
22+
end

app/controllers/webhook_settings_controller.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ def show
3232
def new; end
3333

3434
def create
35-
@webhook_url.save!
35+
if @webhook_url.url.present?
36+
@webhook_url.save!
3637

37-
redirect_to settings_webhooks_path, notice: I18n.t('webhook_url_has_been_saved')
38+
redirect_to settings_webhooks_path, notice: I18n.t('webhook_url_has_been_saved')
39+
else
40+
redirect_back fallback_location: settings_webhooks_path
41+
end
3842
end
3943

4044
def update

app/javascript/elements/download_button.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ export default targetable(class extends HTMLElement {
55

66
connectedCallback () {
77
this.addEventListener('click', () => this.downloadFiles())
8+
this.addEventListener('keydown', (e) => {
9+
if (e.key === 'Enter' || e.key === ' ') {
10+
e.preventDefault()
11+
this.downloadFiles()
12+
}
13+
})
814
}
915

1016
toggleState () {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export default class extends HTMLElement {
2+
connectedCallback () {
3+
const dialog = document.getElementById(this.dataset.target)
4+
5+
this.querySelector('button').addEventListener('click', () => {
6+
if (dialog) {
7+
dialog.inert = false
8+
dialog.showModal()
9+
}
10+
})
11+
12+
if (dialog) {
13+
dialog.addEventListener('close', () => {
14+
dialog.inert = true
15+
})
16+
}
17+
}
18+
}

app/javascript/elements/scroll_buttons.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ export default class extends HTMLElement {
4747

4848
this.classList.remove('hidden', '-translate-y-10', 'opacity-0')
4949
this.classList.add('translate-y-0', 'opacity-100')
50+
this.inert = false
5051
}
5152

5253
hideButtons () {
5354
this.classList.remove('translate-y-0', 'opacity-100')
5455
this.classList.add('-translate-y-10', 'opacity-0')
56+
this.inert = true
5557

5658
setTimeout(() => {
5759
if (this.classList.contains('-translate-y-10')) {

app/javascript/form.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import FetchForm from './elements/fetch_form'
77
import ScrollButtons from './elements/scroll_buttons'
88
import PageContainer from './elements/page_container'
99
import SubmitForm from './elements/submit_form'
10+
import ModalButton from './elements/modal_button'
1011

1112
const safeRegisterElement = (name, element, options = {}) => !window.customElements.get(name) && window.customElements.define(name, element, options)
1213

@@ -16,6 +17,7 @@ safeRegisterElement('fetch-form', FetchForm)
1617
safeRegisterElement('scroll-buttons', ScrollButtons)
1718
safeRegisterElement('page-container', PageContainer)
1819
safeRegisterElement('submit-form', SubmitForm)
20+
safeRegisterElement('modal-button', ModalButton)
1921
safeRegisterElement('submission-form', class extends HTMLElement {
2022
connectedCallback () {
2123
this.appElem = document.createElement('div')

0 commit comments

Comments
 (0)