commit
216485a5b8
17 changed files with 60 additions and 101 deletions
2
Gemfile
2
Gemfile
|
@ -117,7 +117,7 @@ group :development, :test do
|
||||||
gem 'graphql-schema_comparator'
|
gem 'graphql-schema_comparator'
|
||||||
gem 'mina', git: 'https://github.com/mina-deploy/mina.git', require: false # Deploy
|
gem 'mina', git: 'https://github.com/mina-deploy/mina.git', require: false # Deploy
|
||||||
gem 'pry-byebug'
|
gem 'pry-byebug'
|
||||||
gem 'rspec-rails', '~> 4.0.0.beta'
|
gem 'rspec-rails'
|
||||||
gem 'rspec_junit_formatter', require: false
|
gem 'rspec_junit_formatter', require: false
|
||||||
gem 'ruby-debug-ide', require: false
|
gem 'ruby-debug-ide', require: false
|
||||||
gem 'simple_xlsx_reader'
|
gem 'simple_xlsx_reader'
|
||||||
|
|
38
Gemfile.lock
38
Gemfile.lock
|
@ -83,7 +83,7 @@ GEM
|
||||||
zeitwerk (~> 2.2, >= 2.2.2)
|
zeitwerk (~> 2.2, >= 2.2.2)
|
||||||
addressable (2.7.0)
|
addressable (2.7.0)
|
||||||
public_suffix (>= 2.0.2, < 5.0)
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
administrate (0.13.0)
|
administrate (0.14.0)
|
||||||
actionpack (>= 4.2)
|
actionpack (>= 4.2)
|
||||||
actionview (>= 4.2)
|
actionview (>= 4.2)
|
||||||
activerecord (>= 4.2)
|
activerecord (>= 4.2)
|
||||||
|
@ -149,7 +149,7 @@ GEM
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
case_transform (0.2)
|
case_transform (0.2)
|
||||||
activesupport
|
activesupport
|
||||||
caxlsx (3.0.1)
|
caxlsx (3.0.2)
|
||||||
htmlentities (~> 4.3, >= 4.3.4)
|
htmlentities (~> 4.3, >= 4.3.4)
|
||||||
mimemagic (~> 0.3)
|
mimemagic (~> 0.3)
|
||||||
nokogiri (~> 1.10, >= 1.10.4)
|
nokogiri (~> 1.10, >= 1.10.4)
|
||||||
|
@ -195,7 +195,7 @@ GEM
|
||||||
sinatra (>= 1.4.4)
|
sinatra (>= 1.4.4)
|
||||||
descendants_tracker (0.0.4)
|
descendants_tracker (0.0.4)
|
||||||
thread_safe (~> 0.3, >= 0.3.1)
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
devise (4.7.2)
|
devise (4.7.3)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 4.1.0)
|
railties (>= 4.1.0)
|
||||||
|
@ -206,7 +206,7 @@ GEM
|
||||||
devise (>= 4.0)
|
devise (>= 4.0)
|
||||||
devise-i18n (1.9.2)
|
devise-i18n (1.9.2)
|
||||||
devise (>= 4.7.1)
|
devise (>= 4.7.1)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.4.4)
|
||||||
discard (1.2.0)
|
discard (1.2.0)
|
||||||
activerecord (>= 4.2, < 7)
|
activerecord (>= 4.2, < 7)
|
||||||
domain_name (0.5.20190701)
|
domain_name (0.5.20190701)
|
||||||
|
@ -398,7 +398,7 @@ GEM
|
||||||
method_source (1.0.0)
|
method_source (1.0.0)
|
||||||
mime-types (3.3.1)
|
mime-types (3.3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2019.1009)
|
mime-types-data (3.2020.0512)
|
||||||
mimemagic (0.3.5)
|
mimemagic (0.3.5)
|
||||||
mini_mime (1.0.2)
|
mini_mime (1.0.2)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
|
@ -466,7 +466,7 @@ GEM
|
||||||
prawn (>= 0.11.1, < 3)
|
prawn (>= 0.11.1, < 3)
|
||||||
prawn-table (0.2.2)
|
prawn-table (0.2.2)
|
||||||
prawn (>= 1.3.0, < 3.0.0)
|
prawn (>= 1.3.0, < 3.0.0)
|
||||||
premailer (1.13.1)
|
premailer (1.14.1)
|
||||||
addressable
|
addressable
|
||||||
css_parser (>= 1.6.0)
|
css_parser (>= 1.6.0)
|
||||||
htmlentities (>= 4.0.0)
|
htmlentities (>= 4.0.0)
|
||||||
|
@ -518,10 +518,10 @@ GEM
|
||||||
bundler (>= 1.3.0)
|
bundler (>= 1.3.0)
|
||||||
railties (= 6.0.3.3)
|
railties (= 6.0.3.3)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-controller-testing (1.0.4)
|
rails-controller-testing (1.0.5)
|
||||||
actionpack (>= 5.0.1.x)
|
actionpack (>= 5.0.1.rc1)
|
||||||
actionview (>= 5.0.1.x)
|
actionview (>= 5.0.1.rc1)
|
||||||
activesupport (>= 5.0.1.x)
|
activesupport (>= 5.0.1.rc1)
|
||||||
rails-dom-testing (2.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
nokogiri (>= 1.6)
|
nokogiri (>= 1.6)
|
||||||
|
@ -577,15 +577,15 @@ GEM
|
||||||
rspec-core (~> 3.9.0)
|
rspec-core (~> 3.9.0)
|
||||||
rspec-expectations (~> 3.9.0)
|
rspec-expectations (~> 3.9.0)
|
||||||
rspec-mocks (~> 3.9.0)
|
rspec-mocks (~> 3.9.0)
|
||||||
rspec-core (3.9.1)
|
rspec-core (3.9.2)
|
||||||
rspec-support (~> 3.9.1)
|
rspec-support (~> 3.9.3)
|
||||||
rspec-expectations (3.9.1)
|
rspec-expectations (3.9.2)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-mocks (3.9.1)
|
rspec-mocks (3.9.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-rails (4.0.0)
|
rspec-rails (4.0.1)
|
||||||
actionpack (>= 4.2)
|
actionpack (>= 4.2)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
railties (>= 4.2)
|
railties (>= 4.2)
|
||||||
|
@ -593,7 +593,7 @@ GEM
|
||||||
rspec-expectations (~> 3.9)
|
rspec-expectations (~> 3.9)
|
||||||
rspec-mocks (~> 3.9)
|
rspec-mocks (~> 3.9)
|
||||||
rspec-support (~> 3.9)
|
rspec-support (~> 3.9)
|
||||||
rspec-support (3.9.2)
|
rspec-support (3.9.3)
|
||||||
rspec_junit_formatter (0.4.1)
|
rspec_junit_formatter (0.4.1)
|
||||||
rspec-core (>= 2, < 4, != 2.12.0)
|
rspec-core (>= 2, < 4, != 2.12.0)
|
||||||
rubocop (0.81.0)
|
rubocop (0.81.0)
|
||||||
|
@ -746,10 +746,10 @@ GEM
|
||||||
xray-rails (0.3.2)
|
xray-rails (0.3.2)
|
||||||
rails (>= 3.1.0)
|
rails (>= 3.1.0)
|
||||||
zeitwerk (2.4.0)
|
zeitwerk (2.4.0)
|
||||||
zip_tricks (5.0.0)
|
zip_tricks (5.3.1)
|
||||||
zipline (1.1.1)
|
zipline (1.2.1)
|
||||||
rails (>= 3.2.1, < 6.1)
|
rails (>= 3.2.1, < 6.1)
|
||||||
zip_tricks (>= 4.2.1, <= 5.0.0)
|
zip_tricks (>= 4.2.1, < 6.0)
|
||||||
zxcvbn-ruby (1.1.0)
|
zxcvbn-ruby (1.1.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
@ -842,7 +842,7 @@ DEPENDENCIES
|
||||||
rake-progressbar
|
rake-progressbar
|
||||||
react-rails
|
react-rails
|
||||||
rgeo-geojson
|
rgeo-geojson
|
||||||
rspec-rails (~> 4.0.0.beta)
|
rspec-rails
|
||||||
rspec_junit_formatter
|
rspec_junit_formatter
|
||||||
rubocop
|
rubocop
|
||||||
rubocop-rails_config
|
rubocop-rails_config
|
||||||
|
|
4
app/dashboards/demande_dashboard.rb
Normal file
4
app/dashboards/demande_dashboard.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
require "administrate/base_dashboard"
|
||||||
|
|
||||||
|
class DemandeDashboard < Administrate::BaseDashboard
|
||||||
|
end
|
|
@ -42,7 +42,7 @@ module DossierHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def autosave_available?(dossier)
|
def autosave_available?(dossier)
|
||||||
dossier.brouillon? && Flipper.enabled?(:autosave_dossier_draft, dossier.user)
|
dossier.brouillon?
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_submission_is_closed?(dossier)
|
def dossier_submission_is_closed?(dossier)
|
||||||
|
|
|
@ -288,17 +288,7 @@ class Dossier < ApplicationRecord
|
||||||
scope :for_procedure, -> (procedure) { includes(:user, :groupe_instructeur).where(groupe_instructeurs: { procedure: procedure }) }
|
scope :for_procedure, -> (procedure) { includes(:user, :groupe_instructeur).where(groupe_instructeurs: { procedure: procedure }) }
|
||||||
scope :for_api_v2, -> { includes(procedure: [:administrateurs], etablissement: [], individual: [], traitements: []) }
|
scope :for_api_v2, -> { includes(procedure: [:administrateurs], etablissement: [], individual: [], traitements: []) }
|
||||||
|
|
||||||
# todo: once we are sure with_cached_notifications does not introduce regressions, remove with_unoptimized_notifications
|
scope :with_notifications, -> do
|
||||||
# and use with_cached_notifications instead
|
|
||||||
scope :with_notifications, -> (instructeur) do
|
|
||||||
if Flipper.enabled?(:cached_notifications, instructeur)
|
|
||||||
return with_cached_notifications
|
|
||||||
else
|
|
||||||
return with_unoptimized_notifications
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
scope :with_cached_notifications, -> do
|
|
||||||
joins(:follows)
|
joins(:follows)
|
||||||
.where('last_champ_updated_at > follows.demande_seen_at' \
|
.where('last_champ_updated_at > follows.demande_seen_at' \
|
||||||
' OR groupe_instructeur_updated_at > follows.demande_seen_at' \
|
' OR groupe_instructeur_updated_at > follows.demande_seen_at' \
|
||||||
|
@ -308,33 +298,6 @@ class Dossier < ApplicationRecord
|
||||||
.distinct
|
.distinct
|
||||||
end
|
end
|
||||||
|
|
||||||
scope :with_unoptimized_notifications, -> do
|
|
||||||
# This scope is meant to be composed, typically with Instructeur.followed_dossiers, which means that the :follows table is already INNER JOINed;
|
|
||||||
# it will fail otherwise
|
|
||||||
# rubocop:disable DS/ApplicationName
|
|
||||||
joined_dossiers = joins('LEFT OUTER JOIN "champs" ON "champs" . "dossier_id" = "dossiers" . "id" AND "champs" . "parent_id" IS NULL AND "champs" . "private" = FALSE AND "champs"."updated_at" > "follows"."demande_seen_at"')
|
|
||||||
.joins('LEFT OUTER JOIN "champs" "champs_privates_dossiers" ON "champs_privates_dossiers" . "dossier_id" = "dossiers" . "id" AND "champs_privates_dossiers" . "parent_id" IS NULL AND "champs_privates_dossiers" . "private" = TRUE AND "champs_privates_dossiers"."updated_at" > "follows"."annotations_privees_seen_at"')
|
|
||||||
.joins('LEFT OUTER JOIN "avis" ON "avis" . "dossier_id" = "dossiers" . "id" AND avis.updated_at > follows.avis_seen_at')
|
|
||||||
.joins('LEFT OUTER JOIN "commentaires" ON "commentaires" . "dossier_id" = "dossiers" . "id" and commentaires.updated_at > follows.messagerie_seen_at and "commentaires"."email" != \'contact@tps.apientreprise.fr\' AND "commentaires"."email" != \'contact@demarches-simplifiees.fr\'')
|
|
||||||
# rubocop:enable DS/ApplicationName
|
|
||||||
|
|
||||||
updated_demandes = joined_dossiers
|
|
||||||
.where('champs.updated_at > follows.demande_seen_at OR groupe_instructeur_updated_at > follows.demande_seen_at')
|
|
||||||
|
|
||||||
updated_annotations = joined_dossiers
|
|
||||||
.where('champs_privates_dossiers.updated_at > follows.annotations_privees_seen_at')
|
|
||||||
|
|
||||||
updated_avis = joined_dossiers
|
|
||||||
.where('avis.updated_at > follows.avis_seen_at')
|
|
||||||
|
|
||||||
updated_messagerie = joined_dossiers
|
|
||||||
.where('commentaires.updated_at > follows.messagerie_seen_at')
|
|
||||||
.where.not(commentaires: { email: OLD_CONTACT_EMAIL })
|
|
||||||
.where.not(commentaires: { email: CONTACT_EMAIL })
|
|
||||||
|
|
||||||
updated_demandes.or(updated_annotations).or(updated_avis).or(updated_messagerie).distinct
|
|
||||||
end
|
|
||||||
|
|
||||||
accepts_nested_attributes_for :individual
|
accepts_nested_attributes_for :individual
|
||||||
|
|
||||||
delegate :siret, :siren, to: :etablissement, allow_nil: true
|
delegate :siret, :siren, to: :etablissement, allow_nil: true
|
||||||
|
|
|
@ -141,14 +141,14 @@ class Instructeur < ApplicationRecord
|
||||||
.where(groupe_instructeur: target_groupes)
|
.where(groupe_instructeur: target_groupes)
|
||||||
.send(scope) # :en_cours or :termine or :not_archived (or any other Dossier scope)
|
.send(scope) # :en_cours or :termine or :not_archived (or any other Dossier scope)
|
||||||
.merge(followed_dossiers)
|
.merge(followed_dossiers)
|
||||||
.with_notifications(self)
|
.with_notifications
|
||||||
end
|
end
|
||||||
|
|
||||||
def procedure_ids_with_notifications(scope)
|
def procedure_ids_with_notifications(scope)
|
||||||
groupe_instructeur_ids = Dossier
|
groupe_instructeur_ids = Dossier
|
||||||
.send(scope) # :en_cours or :termine (or any other Dossier scope)
|
.send(scope) # :en_cours or :termine (or any other Dossier scope)
|
||||||
.merge(followed_dossiers)
|
.merge(followed_dossiers)
|
||||||
.with_notifications(self)
|
.with_notifications
|
||||||
.select(:groupe_instructeur_id)
|
.select(:groupe_instructeur_id)
|
||||||
|
|
||||||
GroupeInstructeur.where(id: groupe_instructeur_ids).pluck(:procedure_id)
|
GroupeInstructeur.where(id: groupe_instructeur_ids).pluck(:procedure_id)
|
||||||
|
|
|
@ -91,7 +91,7 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
|
|
||||||
case table
|
case table
|
||||||
when 'notifications'
|
when 'notifications'
|
||||||
dossiers_id_with_notification = dossiers.merge(instructeur.followed_dossiers).with_notifications(instructeur).ids
|
dossiers_id_with_notification = dossiers.merge(instructeur.followed_dossiers).with_notifications.ids
|
||||||
if order == 'desc'
|
if order == 'desc'
|
||||||
return dossiers_id_with_notification +
|
return dossiers_id_with_notification +
|
||||||
(dossiers.order('dossiers.updated_at desc').ids - dossiers_id_with_notification)
|
(dossiers.order('dossiers.updated_at desc').ids - dossiers_id_with_notification)
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
= link_to "Créez une démarche de test",
|
= link_to "Créer votre compte administrateur",
|
||||||
new_demande_path,
|
DEMANDE_INSCRIPTION_ADMIN_PAGE_URL,
|
||||||
class: "role-panel-button-primary",
|
class: "role-panel-button-primary",
|
||||||
rel: "noopener noreferrer"
|
rel: "noopener noreferrer"
|
||||||
%br
|
%br
|
||||||
|
@ -204,8 +204,8 @@
|
||||||
.half.first-half
|
.half.first-half
|
||||||
%h1.cta-panel-title Vous êtes prêt pour dématérialiser ?
|
%h1.cta-panel-title Vous êtes prêt pour dématérialiser ?
|
||||||
%p.cta-panel-explanation Réduisez vos temps d'instruction de 50 %
|
%p.cta-panel-explanation Réduisez vos temps d'instruction de 50 %
|
||||||
= link_to "Créer une démarche de test",
|
= link_to "Créer votre compte administrateur",
|
||||||
new_demande_path,
|
DEMANDE_INSCRIPTION_ADMIN_PAGE_URL,
|
||||||
class: "cta-panel-button-blue"
|
class: "cta-panel-button-blue"
|
||||||
|
|
||||||
.half
|
.half
|
||||||
|
|
|
@ -28,7 +28,6 @@ features = [
|
||||||
:administrateur_web_hook,
|
:administrateur_web_hook,
|
||||||
:insee_api_v3,
|
:insee_api_v3,
|
||||||
:instructeur_bypass_email_login_token,
|
:instructeur_bypass_email_login_token,
|
||||||
:autosave_dossier_draft,
|
|
||||||
:maintenance_mode,
|
:maintenance_mode,
|
||||||
:mini_profiler,
|
:mini_profiler,
|
||||||
:xray,
|
:xray,
|
||||||
|
|
|
@ -40,6 +40,7 @@ FAQ_OU_EN_EST_MON_DOSSIER_URL = [FAQ_URL, "article", "11-je-veux-savoir-ou-en-es
|
||||||
FAQ_ERREUR_SIRET_URL = [FAQ_URL, "article", "4-erreur-siret"].join("/")
|
FAQ_ERREUR_SIRET_URL = [FAQ_URL, "article", "4-erreur-siret"].join("/")
|
||||||
|
|
||||||
STATUS_PAGE_URL = ENV.fetch("STATUS_PAGE_URL", "https://status.demarches-simplifiees.fr")
|
STATUS_PAGE_URL = ENV.fetch("STATUS_PAGE_URL", "https://status.demarches-simplifiees.fr")
|
||||||
|
DEMANDE_INSCRIPTION_ADMIN_PAGE_URL = ENV.fetch("DEMANDE_INSCRIPTION_ADMIN_PAGE_URL", "https://www.demarches-simplifiees.fr/commencer/demande-d-inscription-a-demarches-simplifiees")
|
||||||
MATOMO_IFRAME_URL = "https://stats.data.gouv.fr/index.php?module=CoreAdminHome&action=optOut&language=fr&&fontColor=333333&fontSize=16px&fontFamily=Muli"
|
MATOMO_IFRAME_URL = "https://stats.data.gouv.fr/index.php?module=CoreAdminHome&action=optOut&language=fr&&fontColor=333333&fontSize=16px&fontFamily=Muli"
|
||||||
|
|
||||||
# rubocop:enable DS/ApplicationName
|
# rubocop:enable DS/ApplicationName
|
||||||
|
|
|
@ -454,9 +454,9 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
before { follower.follow(dossier) }
|
before { follower.follow(dossier) }
|
||||||
|
|
||||||
it 'the follower has a notification' do
|
it 'the follower has a notification' do
|
||||||
expect(follower.followed_dossiers.with_notifications(follower)).to eq([])
|
expect(follower.followed_dossiers.with_notifications).to eq([])
|
||||||
subject
|
subject
|
||||||
expect(follower.followed_dossiers.with_notifications(follower)).to eq([dossier.reload])
|
expect(follower.followed_dossiers.with_notifications).to eq([dossier.reload])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -671,8 +671,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
|
|
||||||
it 'updates the annotations' do
|
it 'updates the annotations' do
|
||||||
Timecop.travel(now + 1.hour)
|
Timecop.travel(now + 1.hour)
|
||||||
expect(instructeur.followed_dossiers.with_notifications(instructeur)).to eq([])
|
expect(instructeur.followed_dossiers.with_notifications).to eq([])
|
||||||
expect(another_instructeur.followed_dossiers.with_notifications(instructeur)).to eq([dossier.reload])
|
expect(another_instructeur.followed_dossiers.with_notifications).to eq([dossier.reload])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -693,9 +693,9 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'the follower has a notification' do
|
it 'the follower has a notification' do
|
||||||
expect(instructeur.reload.followed_dossiers.with_notifications(instructeur)).to eq([])
|
expect(instructeur.reload.followed_dossiers.with_notifications).to eq([])
|
||||||
subject
|
subject
|
||||||
expect(instructeur.reload.followed_dossiers.with_notifications(instructeur)).to eq([dossier.reload])
|
expect(instructeur.reload.followed_dossiers.with_notifications).to eq([dossier.reload])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -887,8 +887,6 @@ describe Users::DossiersController, type: :controller do
|
||||||
before do
|
before do
|
||||||
Timecop.freeze(now)
|
Timecop.freeze(now)
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
# Flipper.enable(:cached_notifications, instructeur_with_instant_message)
|
|
||||||
# Flipper.enable(:cached_notifications, instructeur_without_instant_message)
|
|
||||||
allow(ClamavService).to receive(:safe_file?).and_return(scan_result)
|
allow(ClamavService).to receive(:safe_file?).and_return(scan_result)
|
||||||
allow(DossierMailer).to receive(:notify_new_commentaire_to_instructeur).and_return(double(deliver_later: nil))
|
allow(DossierMailer).to receive(:notify_new_commentaire_to_instructeur).and_return(double(deliver_later: nil))
|
||||||
instructeur_with_instant_message.follow(dossier)
|
instructeur_with_instant_message.follow(dossier)
|
||||||
|
@ -913,15 +911,15 @@ describe Users::DossiersController, type: :controller do
|
||||||
|
|
||||||
context 'notification' do
|
context 'notification' do
|
||||||
before 'instructeurs have no notification before the message' do
|
before 'instructeurs have no notification before the message' do
|
||||||
expect(instructeur_with_instant_message.followed_dossiers.with_notifications(instructeur_with_instant_message)).to eq([])
|
expect(instructeur_with_instant_message.followed_dossiers.with_notifications).to eq([])
|
||||||
expect(instructeur_without_instant_message.followed_dossiers.with_notifications(instructeur_without_instant_message)).to eq([])
|
expect(instructeur_without_instant_message.followed_dossiers.with_notifications).to eq([])
|
||||||
Timecop.travel(now + 1.day)
|
Timecop.travel(now + 1.day)
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'adds them a notification' do
|
it 'adds them a notification' do
|
||||||
expect(instructeur_with_instant_message.reload.followed_dossiers.with_notifications(instructeur_with_instant_message)).to eq([dossier.reload])
|
expect(instructeur_with_instant_message.reload.followed_dossiers.with_notifications).to eq([dossier.reload])
|
||||||
expect(instructeur_without_instant_message.reload.followed_dossiers.with_notifications(instructeur_without_instant_message)).to eq([dossier.reload])
|
expect(instructeur_without_instant_message.reload.followed_dossiers.with_notifications).to eq([dossier.reload])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,8 +42,8 @@ feature 'The user' do
|
||||||
fill_in('dossier_link', with: '123')
|
fill_in('dossier_link', with: '123')
|
||||||
find('.editable-champ-piece_justificative input[type=file]').attach_file(Rails.root + 'spec/fixtures/files/file.pdf')
|
find('.editable-champ-piece_justificative input[type=file]').attach_file(Rails.root + 'spec/fixtures/files/file.pdf')
|
||||||
|
|
||||||
click_on 'Enregistrer le brouillon'
|
blur
|
||||||
expect(page).to have_content('Votre brouillon a bien été sauvegardé')
|
expect(page).to have_css('span', text: 'Brouillon enregistré', visible: true)
|
||||||
|
|
||||||
# check data on the dossier
|
# check data on the dossier
|
||||||
expect(user_dossier.brouillon?).to be true
|
expect(user_dossier.brouillon?).to be true
|
||||||
|
@ -116,7 +116,8 @@ feature 'The user' do
|
||||||
|
|
||||||
expect(page).to have_content('Supprimer', count: 2)
|
expect(page).to have_content('Supprimer', count: 2)
|
||||||
|
|
||||||
click_on 'Enregistrer le brouillon'
|
blur
|
||||||
|
expect(page).to have_css('span', text: 'Brouillon enregistré', visible: true)
|
||||||
|
|
||||||
expect(page).to have_content('Supprimer', count: 2)
|
expect(page).to have_content('Supprimer', count: 2)
|
||||||
|
|
||||||
|
@ -124,13 +125,17 @@ feature 'The user' do
|
||||||
click_on 'Supprimer l’élément'
|
click_on 'Supprimer l’élément'
|
||||||
end
|
end
|
||||||
|
|
||||||
click_on 'Enregistrer le brouillon'
|
blur
|
||||||
|
expect(page).to have_css('span', text: 'Brouillon enregistré', visible: true)
|
||||||
|
|
||||||
expect(page).to have_content('Supprimer', count: 1)
|
expect(page).to have_content('Supprimer', count: 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:simple_procedure) do
|
let(:simple_procedure) do
|
||||||
tdcs = [build(:type_de_champ, mandatory: true, libelle: 'texte obligatoire')]
|
tdcs = [
|
||||||
|
build(:type_de_champ, mandatory: true, libelle: 'texte obligatoire'),
|
||||||
|
build(:type_de_champ, mandatory: false, libelle: 'texte optionnel')
|
||||||
|
]
|
||||||
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
|
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -139,9 +144,9 @@ feature 'The user' do
|
||||||
fill_individual
|
fill_individual
|
||||||
|
|
||||||
# Check an incomplete dossier can be saved as a draft, even when mandatory fields are missing
|
# Check an incomplete dossier can be saved as a draft, even when mandatory fields are missing
|
||||||
click_on 'Enregistrer le brouillon'
|
fill_in('texte optionnel', with: 'ça ne suffira pas')
|
||||||
expect(user_dossier.reload.brouillon?).to be(true)
|
blur
|
||||||
expect(page).to have_content('Votre brouillon a bien été sauvegardé')
|
expect(page).to have_css('span', text: 'Brouillon enregistré', visible: true)
|
||||||
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
|
expect(page).to have_current_path(brouillon_dossier_path(user_dossier))
|
||||||
|
|
||||||
# Check an incomplete dossier cannot be submitted when mandatory fields are missing
|
# Check an incomplete dossier cannot be submitted when mandatory fields are missing
|
||||||
|
@ -185,7 +190,6 @@ feature 'The user' do
|
||||||
expect(page).to have_text('RIB.pdf')
|
expect(page).to have_text('RIB.pdf')
|
||||||
|
|
||||||
# Expect the submit buttons to be enabled
|
# Expect the submit buttons to be enabled
|
||||||
expect(page).to have_button('Enregistrer le brouillon', disabled: false)
|
|
||||||
expect(page).to have_button('Déposer le dossier', disabled: false)
|
expect(page).to have_button('Déposer le dossier', disabled: false)
|
||||||
|
|
||||||
# Reload the current page
|
# Reload the current page
|
||||||
|
@ -226,7 +230,6 @@ feature 'The user' do
|
||||||
attach_file('Pièce justificative 1', Rails.root + 'spec/fixtures/files/file.pdf')
|
attach_file('Pièce justificative 1', Rails.root + 'spec/fixtures/files/file.pdf')
|
||||||
expect(page).to have_text('Une erreur s’est produite pendant l’envoi du fichier')
|
expect(page).to have_text('Une erreur s’est produite pendant l’envoi du fichier')
|
||||||
expect(page).to have_button('Ré-essayer', visible: true)
|
expect(page).to have_button('Ré-essayer', visible: true)
|
||||||
expect(page).to have_button('Enregistrer le brouillon', disabled: false)
|
|
||||||
expect(page).to have_button('Déposer le dossier', disabled: false)
|
expect(page).to have_button('Déposer le dossier', disabled: false)
|
||||||
|
|
||||||
# Test that retrying after a failure works
|
# Test that retrying after a failure works
|
||||||
|
@ -234,7 +237,6 @@ feature 'The user' do
|
||||||
click_on('Ré-essayer', visible: true)
|
click_on('Ré-essayer', visible: true)
|
||||||
expect(page).to have_text('analyse antivirus en cours')
|
expect(page).to have_text('analyse antivirus en cours')
|
||||||
expect(page).to have_text('file.pdf')
|
expect(page).to have_text('file.pdf')
|
||||||
expect(page).to have_button('Enregistrer le brouillon', disabled: false)
|
|
||||||
expect(page).to have_button('Déposer le dossier', disabled: false)
|
expect(page).to have_button('Déposer le dossier', disabled: false)
|
||||||
|
|
||||||
# Reload the current page
|
# Reload the current page
|
||||||
|
@ -244,11 +246,7 @@ feature 'The user' do
|
||||||
expect(page).to have_text('file.pdf')
|
expect(page).to have_text('file.pdf')
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the draft autosave is enabled' do
|
context 'draft autosave' do
|
||||||
before do
|
|
||||||
Flipper.enable_actor(:autosave_dossier_draft, user)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'autosave a draft', js: true do
|
scenario 'autosave a draft', js: true do
|
||||||
log_in(user, simple_procedure)
|
log_in(user, simple_procedure)
|
||||||
fill_individual
|
fill_individual
|
||||||
|
|
|
@ -53,8 +53,7 @@ feature 'Invitations' do
|
||||||
expect(page).to have_no_selector('.button.invite-user-action')
|
expect(page).to have_no_selector('.button.invite-user-action')
|
||||||
|
|
||||||
fill_in 'Texte obligatoire', with: 'Some edited value'
|
fill_in 'Texte obligatoire', with: 'Some edited value'
|
||||||
click_button 'Enregistrer le brouillon'
|
blur
|
||||||
expect(page).to have_text('Votre brouillon a bien été sauvegardé')
|
|
||||||
expect(page).to have_field('Texte obligatoire', with: 'Some edited value')
|
expect(page).to have_field('Texte obligatoire', with: 'Some edited value')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,9 @@ describe Dossier do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create(:follow, dossier: dossier, instructeur: instructeur, messagerie_seen_at: 2.hours.ago)
|
create(:follow, dossier: dossier, instructeur: instructeur, messagerie_seen_at: 2.hours.ago)
|
||||||
Flipper.enable_actor(:cached_notifications, instructeur)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { instructeur.followed_dossiers.with_notifications(instructeur) }
|
subject { instructeur.followed_dossiers.with_notifications }
|
||||||
|
|
||||||
context('without changes') do
|
context('without changes') do
|
||||||
it { is_expected.to eq [] }
|
it { is_expected.to eq [] }
|
||||||
|
|
|
@ -8,7 +8,6 @@ describe Instructeur, type: :model do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
assign(procedure_2)
|
assign(procedure_2)
|
||||||
Flipper.enable_actor(:cached_notifications, instructeur)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'follow' do
|
describe 'follow' do
|
||||||
|
|
|
@ -262,7 +262,6 @@ describe ProcedurePresentation do
|
||||||
let!(:older_dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
let!(:older_dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Flipper.enable_actor(:cached_notifications, instructeur)
|
|
||||||
notified_dossier.update!(last_champ_updated_at: Time.zone.local(2018, 9, 20))
|
notified_dossier.update!(last_champ_updated_at: Time.zone.local(2018, 9, 20))
|
||||||
create(:follow, instructeur: instructeur, dossier: notified_dossier, demande_seen_at: Time.zone.local(2018, 9, 10))
|
create(:follow, instructeur: instructeur, dossier: notified_dossier, demande_seen_at: Time.zone.local(2018, 9, 10))
|
||||||
notified_dossier.touch(time: Time.zone.local(2018, 9, 20))
|
notified_dossier.touch(time: Time.zone.local(2018, 9, 20))
|
||||||
|
|
Loading…
Reference in a new issue