Fixing rubocop errors

pull/668/head
Eros Stein 2 months ago
parent aa764cfdcf
commit 9070194bae

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
class EmbedScriptsController < ActionController::Metal class EmbedScriptsController < ActionController::Metal
EMBED_SCRIPT = <<~JAVASCRIPT.freeze EMBED_SCRIPT = <<~JAVASCRIPT
const buildIframe = (element) => { const buildIframe = (element) => {
const iframe = document.createElement('iframe'); const iframe = document.createElement('iframe');
const src = element.dataset.src || element.getAttribute('src'); const src = element.dataset.src || element.getAttribute('src');

@ -16,8 +16,10 @@ class SendSubmitterReminderEmailJob
reminder_index = params['reminder_index'].to_i reminder_index = params['reminder_index'].to_i
return if reminder_index.positive? && return if reminder_index.positive? &&
submitter.submission_events.exists?(event_type: 'send_reminder_email', submitter.submission_events.exists?(
data: { 'reminder_index' => reminder_index }) event_type: 'send_reminder_email',
data: { 'reminder_index' => reminder_index }
)
mail = SubmitterMailer.invitation_email(submitter) mail = SubmitterMailer.invitation_email(submitter)

@ -7,6 +7,14 @@ class Ability
template_scope = Abilities::TemplateConditions.collection(user) template_scope = Abilities::TemplateConditions.collection(user)
template_check = ->(template) { Abilities::TemplateConditions.entity(template, user: user, ability: 'manage') } template_check = ->(template) { Abilities::TemplateConditions.entity(template, user: user, ability: 'manage') }
allow_viewer_permissions(user, template_scope, template_check)
allow_editor_permissions(user, template_scope, template_check) unless user.viewer?
allow_admin_permissions(user) if user.admin?
end
private
def allow_viewer_permissions(user, template_scope, template_check)
can :read, Template, template_scope, &template_check can :read, Template, template_scope, &template_check
can :read, TemplateFolder, account_id: user.account_id can :read, TemplateFolder, account_id: user.account_id
can :read, Submission, account_id: user.account_id can :read, Submission, account_id: user.account_id
@ -14,9 +22,9 @@ class Ability
can :manage, UserConfig, user_id: user.id can :manage, UserConfig, user_id: user.id
can :manage, EncryptedUserConfig, user_id: user.id can :manage, EncryptedUserConfig, user_id: user.id
can :read, Account, id: user.account_id can :read, Account, id: user.account_id
end
return if user.viewer? def allow_editor_permissions(user, template_scope, template_check)
can %i[create update], Template, template_scope, &template_check can %i[create update], Template, template_scope, &template_check
can :destroy, Template, account_id: user.account_id can :destroy, Template, account_id: user.account_id
can :manage, TemplateFolder, account_id: user.account_id can :manage, TemplateFolder, account_id: user.account_id
@ -24,9 +32,9 @@ class Ability
can :manage, Submission, account_id: user.account_id can :manage, Submission, account_id: user.account_id
can :manage, Submitter, account_id: user.account_id can :manage, Submitter, account_id: user.account_id
can :manage, AccessToken, user_id: user.id can :manage, AccessToken, user_id: user.id
end
return unless user.admin? def allow_admin_permissions(user)
can :manage, User, account_id: user.account_id can :manage, User, account_id: user.account_id
can :manage, EncryptedConfig, account_id: user.account_id can :manage, EncryptedConfig, account_id: user.account_id
can :manage, AccountConfig, account_id: user.account_id can :manage, AccountConfig, account_id: user.account_id

@ -542,7 +542,6 @@ module Submissions
rescue StandardError rescue StandardError
column.image(PdfIcons.logo_io, width: 40, height: 40, position: :float) column.image(PdfIcons.logo_io, width: 40, height: 40, position: :float)
ensure ensure
column.formatted_text([{ text: account&.name || Docuseal.product_name }], column.formatted_text([{ text: account&.name || Docuseal.product_name }],
font_size: 20, font_size: 20,
font: [FONT_NAME, { variant: :bold }], font: [FONT_NAME, { variant: :bold }],

Loading…
Cancel
Save