commit
e91029a25d
23 changed files with 34 additions and 45 deletions
2
Gemfile
2
Gemfile
|
@ -38,8 +38,6 @@ gem 'kaminari'
|
|||
# Decorators
|
||||
gem 'draper'
|
||||
|
||||
gem 'unicode_utils'
|
||||
|
||||
# Gestion des comptes utilisateurs
|
||||
gem 'devise'
|
||||
gem 'devise-async'
|
||||
|
|
|
@ -746,7 +746,6 @@ GEM
|
|||
unf_ext
|
||||
unf_ext (0.0.7.5)
|
||||
unicode-display_width (1.3.2)
|
||||
unicode_utils (1.4.0)
|
||||
unicorn (5.4.0)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
|
@ -866,7 +865,6 @@ DEPENDENCIES
|
|||
turbolinks
|
||||
typhoeus
|
||||
uglifier
|
||||
unicode_utils
|
||||
unicorn
|
||||
vcr
|
||||
warden!
|
||||
|
|
|
@ -71,7 +71,7 @@ class Admin::AttestationTemplatesController < AdminController
|
|||
end
|
||||
|
||||
def uninterlaced_png(uploaded_file)
|
||||
if uploaded_file.present? && uploaded_file.content_type == 'image/png'
|
||||
if uploaded_file&.content_type == 'image/png'
|
||||
chunky_img = ChunkyPNG::Image.from_io(uploaded_file)
|
||||
chunky_img.save(uploaded_file.tempfile.to_path, interlace: false)
|
||||
uploaded_file.tempfile.reopen(uploaded_file.tempfile.to_path, 'rb')
|
||||
|
|
|
@ -225,7 +225,7 @@ class Admin::ProceduresController < AdminController
|
|||
|
||||
def procedure_params
|
||||
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :notice, :web_hook_url, :euro_flag, :logo, :auto_archive_on]
|
||||
if @procedure.try(:locked?)
|
||||
if @procedure&.locked?
|
||||
params.require(:procedure).permit(*editable_params)
|
||||
else
|
||||
params.require(:procedure).permit(*editable_params, :lien_demarche, :cerfa_flag, :for_individual, :individual_with_siret, :ask_birthday, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
|
||||
|
|
|
@ -118,7 +118,7 @@ module NewGestionnaire
|
|||
# a gestionnaire is authenticated ... lets see if it can view the dossier
|
||||
|
||||
redirect_to gestionnaire_avis_url(avis)
|
||||
elsif avis.gestionnaire.present? && avis.gestionnaire.email == params[:email]
|
||||
elsif avis.gestionnaire&.email == params[:email]
|
||||
# the avis gestionnaire has already signed up and it sould sign in
|
||||
|
||||
redirect_to new_gestionnaire_session_url
|
||||
|
|
|
@ -138,7 +138,7 @@ module NewUser
|
|||
end
|
||||
|
||||
def dossier_with_champs
|
||||
@dossier_with_champs ||= Dossier.with_ordered_champs.find(params[:id])
|
||||
Dossier.with_ordered_champs.find(params[:id])
|
||||
end
|
||||
|
||||
def ensure_ownership!
|
||||
|
|
|
@ -15,9 +15,9 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def current_email
|
||||
current_user.try(:email) ||
|
||||
current_gestionnaire.try(:email) ||
|
||||
current_administrateur.try(:email)
|
||||
current_user&.email ||
|
||||
current_gestionnaire&.email ||
|
||||
current_administrateur&.email
|
||||
end
|
||||
|
||||
def root_path_for_profile(nav_bar_profile)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class AvisMailer < ApplicationMailer
|
||||
def avis_invitation(avis)
|
||||
@avis = avis
|
||||
email = @avis.gestionnaire.try(:email) || @avis.email
|
||||
email = @avis.gestionnaire&.email || @avis.email
|
||||
mail(to: email, subject: "Donnez votre avis sur le dossier nº #{@avis.dossier.id} (#{@avis.dossier.procedure.libelle})")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ class Avis < ApplicationRecord
|
|||
scope :updated_since?, -> (date) { where('avis.updated_at > ?', date) }
|
||||
|
||||
def email_to_display
|
||||
gestionnaire.try(:email) || email
|
||||
gestionnaire&.email || email
|
||||
end
|
||||
|
||||
def self.link_avis_to_gestionnaire(gestionnaire)
|
||||
|
@ -27,8 +27,7 @@ class Avis < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.avis_exists_and_email_belongs_to_avis?(avis_id, email)
|
||||
avis = Avis.find_by(id: avis_id)
|
||||
avis.present? && avis.email == email
|
||||
Avis.find_by(id: avis_id)&.email == email
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -11,7 +11,7 @@ module Mails
|
|||
|
||||
def self.default_template_name_for_procedure(procedure)
|
||||
attestation_template = procedure.attestation_template
|
||||
if attestation_template.present? && attestation_template.activated?
|
||||
if attestation_template&.activated?
|
||||
"mails/closed_mail_with_attestation"
|
||||
else
|
||||
"mails/closed_mail"
|
||||
|
|
|
@ -209,11 +209,11 @@ class Procedure < ApplicationRecord
|
|||
end
|
||||
|
||||
procedure.administrateur = admin
|
||||
procedure.initiated_mail = initiated_mail.try(:dup)
|
||||
procedure.received_mail = received_mail.try(:dup)
|
||||
procedure.closed_mail = closed_mail.try(:dup)
|
||||
procedure.refused_mail = refused_mail.try(:dup)
|
||||
procedure.without_continuation_mail = without_continuation_mail.try(:dup)
|
||||
procedure.initiated_mail = initiated_mail&.dup
|
||||
procedure.received_mail = received_mail&.dup
|
||||
procedure.closed_mail = closed_mail&.dup
|
||||
procedure.refused_mail = refused_mail&.dup
|
||||
procedure.without_continuation_mail = without_continuation_mail&.dup
|
||||
|
||||
procedure.cloned_from_library = from_library
|
||||
procedure.parent_procedure = self
|
||||
|
|
|
@ -31,7 +31,7 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def email
|
||||
object.user.try(:email)
|
||||
object.user&.email
|
||||
end
|
||||
|
||||
def entreprise
|
||||
|
|
|
@ -18,7 +18,7 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
|||
:individual_birthdate
|
||||
|
||||
def email
|
||||
object.user.try(:email)
|
||||
object.user&.email
|
||||
end
|
||||
|
||||
def state
|
||||
|
@ -47,19 +47,19 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def individual_prenom
|
||||
object.individual.try(:prenom)
|
||||
object.individual&.prenom
|
||||
end
|
||||
|
||||
def individual_nom
|
||||
object.individual.try(:nom)
|
||||
object.individual&.nom
|
||||
end
|
||||
|
||||
def individual_birthdate
|
||||
object.individual.try(:birthdate)
|
||||
object.individual&.birthdate
|
||||
end
|
||||
|
||||
def individual_gender
|
||||
object.individual.try(:gender)
|
||||
object.individual&.gender
|
||||
end
|
||||
|
||||
def emails_accompagnateurs
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
- if user_signed_in? && (@facade.dossier.owner_or_invite?(current_user))
|
||||
%a#maj_carte.action{ href: "/users/dossiers/#{@facade.dossier.id}/carte" }
|
||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
||||
= 'éditer'.upcase
|
||||
= 'ÉDITER'
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
- if user_signed_in? && (@facade.dossier.owner_or_invite?(current_user))
|
||||
= link_to modifier_dossier_path(@facade.dossier), class: 'action', id: 'maj_infos' do
|
||||
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
||||
= "éditer".upcase
|
||||
= "ÉDITER"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
- if @facade.procedure.for_individual?
|
||||
.row.title-row
|
||||
.col-xs-4.split-hr
|
||||
.col-xs-4.dossier-title= t('utils.depositaire').upcase
|
||||
.col-xs-4.dossier-title= t('utils.depositaire')
|
||||
.col-xs-4.split-hr
|
||||
.row
|
||||
.col-xs-6.depositaire-label Civilité
|
||||
|
@ -29,7 +29,7 @@
|
|||
- if champ.type_champ == 'header_section'
|
||||
.row.title-row.margin-top-40
|
||||
.col-xs-3.split-hr
|
||||
.col-xs-6.dossier-title= champ.libelle.upcase
|
||||
.col-xs-6.dossier-title= champ.libelle
|
||||
.col-xs-3.split-hr
|
||||
- else
|
||||
.row
|
||||
|
@ -60,7 +60,7 @@
|
|||
.col-xs-12
|
||||
.row.title-row
|
||||
.col-xs-4.split-hr
|
||||
.col-xs-4.dossier-title= t('utils.pieces').upcase
|
||||
.col-xs-4.dossier-title= t('utils.pieces')
|
||||
.col-xs-4.split-hr
|
||||
|
||||
.col-xs-12#pieces-justificatives.margin-bot-40
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/ We can't use &. because the controller may not implement #nav_bar_profile
|
||||
- nav_bar_profile = controller.try(:nav_bar_profile)
|
||||
|
||||
.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.en-cours
|
||||
%b
|
||||
= dossier_count = current_administrateur.procedures.count
|
||||
= ("Procedures".pluralize(dossier_count)).upcase
|
||||
= "Procedures".pluralize(dossier_count)
|
||||
|
||||
#action-block
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#first-block
|
||||
.en-cours
|
||||
= dossier_count = current_user.dossiers.count
|
||||
= ("Dossier".pluralize(dossier_count)).upcase
|
||||
= "Dossier".pluralize(dossier_count)
|
||||
%br
|
||||
EN COURS
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- dossier = Dossier.find_by(id: champ.value)
|
||||
- show_text_summary = dossier.present?
|
||||
- show_warning = !show_text_summary && champ.value.present?
|
||||
- text_summary = sanitize(dossier.try(:text_summary))
|
||||
- text_summary = sanitize(dossier&.text_summary)
|
||||
|
||||
.dossier-link
|
||||
= form.number_field :value,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- dossier = Dossier.find_by(id: champ.value)
|
||||
- show_text_summary = dossier.present?
|
||||
- show_warning = !show_text_summary && champ.value.present?
|
||||
- text_summary = dossier.try(:text_summary)
|
||||
- text_summary = dossier&.text_summary
|
||||
|
||||
.dossier-link
|
||||
%input.form-control{ name: "champs['#{ champ.id }']",
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
require "unicode_utils/upcase"
|
||||
|
||||
class String
|
||||
def upcase
|
||||
UnicodeUtils.upcase(self)
|
||||
end
|
||||
end
|
|
@ -1,11 +1,11 @@
|
|||
namespace :'2018_02_28_clean_invalid_emails_accounts' do
|
||||
task clean: :environment do
|
||||
Gestionnaire.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
||||
Gestionnaire.find_by(id: id, current_sign_in_at: nil).try(:destroy) # ensure account was never used
|
||||
Gestionnaire.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
|
||||
end
|
||||
|
||||
User.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
||||
User.find_by(id: id, current_sign_in_at: nil).try(:destroy) # ensure account was never used
|
||||
User.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue