Commit graph

1420 commits

Author SHA1 Message Date
maatinito
9de9a1fd71 Use time.zone functions instead of server time functions
(Time.zone.today vs Date.today)
2019-11-26 14:26:36 +01:00
simon lehericey
f45ede7f44 href should not contain space 2019-11-21 15:34:59 +01:00
Paul Chavard
0c6705f7fd Drop old export service 2019-11-21 10:25:40 +01:00
Paul Chavard
ba03dbf8dd [GraphQL] Add dossierEnvoyerMessage mutation 2019-11-13 19:54:27 +01:00
Pierre de La Morinerie
88373ddf20 individual: raise when the individual object cannot be created
Currently, a number of dossiers in production are for procedures for
individuals, but don't have a `individual` object.

This is probably because creating the Individual from France Connect
infos fails – but fails quietly, and nullify the relationship.

As a first step, we now raise an exception when the creation from FC
infos fails. We will then identify the issue, and see if we can fix it –
or if we should be resilient to this kind of issues.
2019-11-12 18:29:37 +01:00
Paul Chavard
990c867c2e [GraphQL] Add more filters to dossiers 2019-11-07 22:07:42 +01:00
Paul Chavard
f22b39b7c5 Handle non unique champ repetable labels
fix #4466
2019-11-07 14:27:52 +01:00
Paul Chavard
2a61ed5b1c Export etablissement information in csv
fix #4440
2019-11-07 14:27:52 +01:00
clemkeirua
04c13190c3 introduce smtp_key in order to use 2 different sendinblue keys
client_key is exposed to the client via gon, so if we use it for sending email too we are exposing a key so anybody could send an email.
The current client_key has a different level of right and can't send emails so it's ok to expose it.
2019-11-06 13:34:36 +01:00
clemkeirua
959aacdea5 Sendinblue email balancing using proper credentials
This reverts commit c61981e795.
2019-11-06 13:34:36 +01:00
Paul Chavard
0562e2728f Fix type_de_champ validation error 2019-11-06 12:54:07 +01:00
Paul Chavard
ee62d6fca4 Fix move type de champs 2019-11-06 12:54:07 +01:00
simon lehericey
9f5169eb7d Remove unused Administrateur.reset_password method 2019-11-05 14:10:39 +01:00
simon lehericey
395aba8bbc Remove administrateur active notion 2019-11-05 14:10:39 +01:00
simon lehericey
5643e671a0 Code use user.active? 2019-11-05 14:10:39 +01:00
simon lehericey
b193dd1465 User get the active notion 2019-11-05 14:10:39 +01:00
simon lehericey
e3d7688e66 [fix #4473] Invite_administrateur!: do not reset password if the user is active 2019-11-05 10:29:39 +01:00
simon lehericey
243bc2887f Invite_administrateur!: remove unused return 2019-11-05 10:29:39 +01:00
clemkeirua
c61981e795 Revert "Sendinblue email balancing using interceptor"
This reverts commit b2135b6576.
2019-11-04 15:55:08 +01:00
Chaïb Martinez
b2135b6576 Sendinblue email balancing using interceptor
Signed-off-by: Chaïb Martinez <chaibax@gmail.com>
2019-11-04 15:30:44 +01:00
Pierre de La Morinerie
2e8d365b93 instructeurs: disable the email column 2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
f8358b3ae9 instructeurs: create without providing the email 2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
8e6930d257 instructeurs: fix ProcedurePresentation to use instructeur.user.email
The `joins` are declared explicitely in order to associate a predictable
name to the joined table.

Otherwise, when the query is joined with `:users`, ActiveRecord will
alias the join automatically  to solve the conflict. Unfortunately, the
automatic resolution means that the table name becomes unpredictable,
and thus unsuitable to perform queries on.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
8b8213c301 instructeurs: always eager load the user relationship
Now that `Instructeur.email` is merely an alias to `instructeur.user.email`,
and we changed every occurence of `instructeurs.pluck(:email)` to
`instructeurs.map(&:email)`, the new version using `map` may cause N+1 queries
if the users have not been preloaded.

It makes sense to always preload the user when fetching an Instructeur:

- Instructeur and User have a strongly coupled relationship
- It avoids N+1 queries everywhere in the app

Of course fetching an instructeur without needing its user will now do an
unecessary fetch of the associated user. But it seems better than leaving
a risk of N+1 queries in many places.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
a462edb9bc instructeurs: alias instructeur.email
This also means we need to replace instances of `pluck` on the email
column.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
cd478b489e instructeurs: replace calls to Instructeur.find_by(email: …) 2019-11-04 10:44:23 +01:00
Paul Chavard
839b0d7e6d Add Entreprise raison sociale to dossier export
fix #4422
2019-10-31 17:11:46 +01:00
simon lehericey
4febf1851f notifications_for_procedure is now based on instructeur.groupe_instructeurs 2019-10-25 09:42:17 +02:00
simon lehericey
e290fc3674 No need to update column as the sign_up process activates the user 2019-10-24 18:32:48 +02:00
simon lehericey
8ae592fe25 [fix #4361] administrateur active 2019-10-24 18:32:48 +02:00
clemkeirua
d9e993571c add a warning during export generation 2019-10-24 16:27:10 +02:00
clemkeirua
da590cc73a sequence async file generation so that the queue flag is cleared 2019-10-24 16:27:10 +02:00
simon lehericey
1fa149575c Add constraints to GroupeInstructeur 2019-10-23 21:47:20 +02:00
Paul Chavard
86b271997b Invite experts to linked dossiers
closes #3669
2019-10-23 13:10:09 +02:00
clemkeirua
87741f4b49 introduce constant for exports 2019-10-22 09:51:14 +02:00
clemkeirua
cdab08b198 UI work 2019-10-22 09:51:14 +02:00
clemkeirua
43424e4f4e merge with the work of paul, using 3 links 2019-10-22 09:51:14 +02:00
clemkeirua
70ea5e167e procedure download is performed through a controller in order not to leak the URL 2019-10-22 09:50:58 +02:00
simon lehericey
6b8cefa551 Procedure: defaut_groupe_instructeur is the first group
Especially useful when the defaut groupe is renamed ...
2019-10-17 15:48:14 +02:00
simon lehericey
5897464224 Build Dossier champ only once 2019-10-17 15:48:14 +02:00
simon lehericey
0c15326df6 User: inactive user have never signed_in 2019-10-08 10:09:16 +02:00
simon lehericey
3e0f1b9c66 User: eager load instructeur and administrateur to remove 2 db requests per http request 2019-10-08 09:53:40 +02:00
simon lehericey
451387d32d Dossier: add conditions on joins for with_notifications scope 2019-09-26 15:46:20 +02:00
Nicolas Bouilleaud
03c950ea97 Move followed_dossiers_with_notifications to a Dossier scope
Instead of instructeur.followed_dossiers_with_notifications, we can now write instructeur.followed_dossiers.with_notifications.

Yay composition!
2019-09-25 14:10:00 +02:00
Nicolas Bouilleaud
a4166d3c57 Refactor Instructeur.notifications_* methods
- rename `dossiers_id_with_notifications` to `followed_dossiers_with_notifications`,
- rename `notifications_per_procedure` to `procedures_with_notifications`,
- return an ActiveRecord::Relation instead of the result of the query, so that the call place can compose it,
- `merge` with the wanted Dossier scope in the call places, don’t bother passing it as a parameter,
- use the “state” (now “scope”) parameter as a scope method that can be just applied on `Dossier`.
2019-09-25 14:10:00 +02:00
Paul Chavard
eb7aba18e6 Add dossier champs and annotations types 2019-09-24 10:47:21 +02:00
Paul Chavard
8928eaba11 Add demarche champs and annotations types 2019-09-24 10:47:21 +02:00
Paul Chavard
a7fc4df09b Resolve models and types 2019-09-24 10:47:21 +02:00
Paul Chavard
2e854f2ac3 Add graph loading scopes to Dossier and Procedure 2019-09-24 10:47:21 +02:00
Nicolas Bouilleaud
f74fde3f80 Avoid sending notification emails about archived dossiers 2019-09-20 11:06:33 +02:00
Nicolas Bouilleaud
769621de46 Explicitly pass the “state” param in notifications_*_procedure methods 2019-09-20 11:06:33 +02:00
Nicolas Bouilleaud
8a06c01f13 Reorder methods in instructeur.rb
Move token stuff together, out of notification-related stuff.
2019-09-20 10:48:08 +02:00
Nicolas Bouilleaud
4f0871dab0 Use a single query in dossiers_id_with_notifications (instead of four)
This is used in /procedures#show and /procedures#index, to display badges on the “suivis” and “traités” tabs of each procedure. Rails cache helps when it’s the exact same query, but it’s not the case for different tabs.

I’m not certain it’ll be a visible performance improvement but it shouldn’t hurt.
2019-09-20 09:45:59 +02:00
simon lehericey
faddbc23ef Eager load procedure: :groupe_instructeurs for export 2019-09-19 12:30:12 +02:00
simon lehericey
a2f82ab8be Add groupe_instructeur_label to export v2 2019-09-19 12:30:12 +02:00
simon lehericey
3bc20bdb06 Procedure.routee? 2019-09-19 12:30:12 +02:00
simon lehericey
8660d4af30 Instructeur: only export its dossiers 2019-09-19 12:24:40 +02:00
simon lehericey
e2acb0a946 ProcedurePresentation: can use groupe instructeur 2019-09-18 15:51:02 +02:00
simon lehericey
9b16bd2037 Dossier: retrieve all dossiers for a procedure 2019-09-18 15:51:02 +02:00
simon lehericey
21577a0f0b Instructeur: dedup procedures with multiple gi 2019-09-18 15:51:02 +02:00
Paul Chavard
8fcf1353f3 Remove duplicated attachments 2019-09-17 18:12:53 +02:00
Nicolas Bouilleaud
0c98f29d59 Move the cached procedure stats queries to a ProcedureStatsConcern 2019-09-17 16:43:48 +02:00
Nicolas Bouilleaud
c26a701a17 Refactor and redesign publish modal
* remove the autocomplete menu
* use ujs to pre-validate the procedure
* tweak the UI
2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
bd1e0aba38 Add Procedure path suggestion 2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
8806eab8d6 Properly validate Procedure.lien_site_web is set when publishing 2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
00c37eccb3 Simplify procedure.path and publish event
* Get rid of the “reopen” event, merge it with “publish” (it’s the same code)
* Remove the “availability” states; “available with brouillon” makes no sense since the brouillons path are always uuids
* Instead of checking if publish can happen, just try it and handle the errors
2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
b9968b76b0 Remove “avec_lien” helpers now that Procedure.path cannot be nil 2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
8fa630d2bb Remove Gestionnaire.visible_procedures
It is actually the same thing as Gestionnaire.procedures. It already included the procedures with paths as well as the archived procedures, and in production, there were no Gestionnaire for who procedures was returning a different result than visible_procedures (expect for two baddata brouillon procedures with a nil path).

In addition, Procedure.path is now nonnull, which means the Procedure.avec_lien scope is pointless.

Finally, the current spec showed that the only procedure not visible to the gestion was the one he was not assigned to.
2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
e9c6ed80e4 Migration: Index and make Procedure.path nonnull 2019-09-17 16:30:48 +02:00
Paul Chavard
88842918f9 Prepare to drop columns 2019-09-17 12:37:37 +02:00
simon lehericey
acb99609ba Move defaut_groupe_instructeur as has_one and eager_load 2019-09-16 15:57:07 +02:00
Paul Chavard
b97cbd3402 Serialize champ repetition for tags
closes #4272
2019-09-12 17:23:18 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
Paul Chavard
c370c2f475 Cleanup FlipFlop 2019-09-10 23:52:44 +02:00
Paul Chavard
65e227c44b Migrate to flipper 2019-09-10 16:10:14 +02:00
Paul Chavard
3eb3ae001e Rename “Passé en construction le” to 'Déposé le' for clarity 2019-09-10 14:59:10 +02:00
Paul Chavard
434210de2e Ignore to be removed columns 2019-09-10 10:49:12 +02:00
Paul Chavard
7ffb98e616 Remove carrierwave uploaders 2019-09-10 10:49:12 +02:00
Pierre de La Morinerie
2724f4667b groupe_instructeur: unsassign instructeurs on group destroy
Fix #4282
2019-09-09 17:29:29 +02:00
simon lehericey
ad7ef6c739 Link assign_to and procedure by groupe_instructeur 2019-09-03 06:47:02 +02:00
simon lehericey
d0bfb62fec Procedure Factory: use procedure.new_dossier 2019-09-03 06:47:02 +02:00
simon lehericey
3cc8f0c792 Link Dossier and GroupeInstructeur 2019-09-03 06:47:02 +02:00
simon lehericey
a82d49aa60 Procedure: save procedure while cloning
This is required to be able to assign the administrateur.instructeur to the defaut_groupe_instructeur of the new procedure
2019-09-02 11:41:12 +02:00
simon lehericey
31cb056351 Procedure: remove direct instructeurs access
Add shortcut for the spec to assign instructeurs directly to the defaut groupe
2019-09-02 11:41:12 +02:00
simon lehericey
ba24958035 Procedure add missing_instructeurs? 2019-09-02 11:41:12 +02:00
simon lehericey
85499365a0 Instructeur has_many procedures through groupe_instructeur 2019-09-02 11:41:12 +02:00
simon lehericey
25991c2892 Assign a procedure assign a group as well 2019-09-02 11:41:12 +02:00
simon lehericey
97884c4349 Link AssignTo et GroupeInstructeur 2019-09-02 11:41:12 +02:00
simon lehericey
115d91387c A procedure has a default groupe instructeur 2019-09-02 11:41:12 +02:00
simon lehericey
f296318072 Create GroupeInstructeur 2019-09-02 11:41:12 +02:00
Paul Chavard
3c6b35d720 Fix attestation preview 2019-08-28 16:33:51 +02:00
Paul Chavard
a19b10b118 Migrate attestation files to active_storage 2019-08-27 17:42:52 +02:00
clemkeirua
188e0fd6b2 removed ask_birthday for new procedures & dossiers 2019-08-27 15:32:17 +02:00
Paul Chavard
d02e0fc556 Fix and test migrate_procedure_logo task 2019-08-22 11:28:03 +02:00
Paul Chavard
cc35a04e26 Migrate procedure logo to active_storage 2019-08-21 11:15:00 +02:00
Paul Chavard
b7b46e9a82 Improve clone of procedure attachements 2019-08-20 17:30:44 +02:00
simon lehericey
c1a622efa1 Add User.create_or_promote_to_administrateur 2019-08-20 12:20:12 +02:00
simon lehericey
97d0855d47 add User.create_or_promote_to_instructeur 2019-08-20 12:20:12 +02:00
simon lehericey
e913b01c52 fix_manager_reset_password 2019-08-20 12:12:20 +02:00
simon lehericey
ebe871819d Fix admin deletion by an administration 2019-08-20 12:01:36 +02:00
Paul Chavard
e9ba7700d4 Remove commentaire file uploader 2019-08-20 10:24:13 +02:00
simon lehericey
dab1519b8c Remove credenticals synchronisation logic 2019-08-16 11:35:19 +02:00
simon lehericey
e3e6bc7689 ! NEED JOB REBOOT Move remind activation logic to user 2019-08-14 16:34:50 +02:00
simon lehericey
d0ac1c3301 Fix manager invite administrateur 2019-08-14 16:34:50 +02:00
simon lehericey
1b38d4071d temporary remove password complexity check 2019-08-14 15:06:16 +02:00
simon lehericey
840be2408e Remove administrateur devise methods 2019-08-14 15:06:15 +02:00
simon lehericey
81f44fa76b Link user and administrateur 2019-08-14 15:06:15 +02:00
simon lehericey
5fdac38cb2 Fix instructeur invitation 2019-08-13 15:15:16 +02:00
simon lehericey
47b7dc368b Remove or fix now nonsense code 2019-08-13 15:15:16 +02:00
simon lehericey
a84e07a376 Remove instructeur devise methods 2019-08-13 15:15:16 +02:00
simon lehericey
dd4ffb926c Link user and instructeur 2019-08-13 15:15:16 +02:00
simon lehericey
3fde2a6f70 Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
simon lehericey
6902f84b85 Brutally rename gestionnaire filename to instructeur 2019-08-12 13:47:01 +02:00
clemkeirua
1e6847bc6f introduce constants for M./Mme 2019-08-01 17:42:32 +02:00
clemkeirua
d7105cb6f8 added spec for dossier#update_with_france_connect 2019-08-01 17:42:32 +02:00
clemkeirua
707e8a0004 dossier_controller#new uses info from FC if any 2019-08-01 17:42:32 +02:00
maatinito
0b0ef8a318 #3928 Zxcvbn service to compute password complexity 2019-08-01 17:12:14 +02:00
Paul Chavard
02904f55b1 Fix champ policy 2019-08-01 16:41:53 +02:00
Paul Chavard
c75e39884e Save selection utilisateur as geo area 2019-08-01 11:38:09 +02:00
clemkeirua
f5d3818e3c remove unnecessary retransition methods 2019-08-01 10:40:08 +02:00
clemkeirua
38b48f4217 transition from accepte to instruction as superadmin 2019-08-01 10:29:51 +02:00
Paul Chavard
b266915892 Add repetitions to api 2019-08-01 10:04:35 +02:00
Paul Chavard
fba195c0b5 Add attestation url to dossier on api 2019-07-31 18:30:40 +02:00
Paul Chavard
25db21467d Stop using Flipflop as switch for Fog 2019-07-31 15:15:09 +02:00
Paul Chavard
fc75580a3c Start using pundit 2019-07-30 18:09:28 +02:00
Paul Chavard
8c72470a6c Add default etablissement champ name 2019-07-30 17:17:36 +02:00
Paul Chavard
ab1170bcfc Fix export dossier n+1 query 2019-07-30 17:17:36 +02:00
Pierre de La Morinerie
95e24392f9 models: remove old pieces justificatives 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
ea1c8ea7e3 models: remove associations to old pieces justificatives 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
0da0a2b446 model: remove support for cloning procedures with old pj 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
f69f325236 api: remove export of old pieces justificatives 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
e975fe4ade tasks: remove task to migrate old pieces justificatives 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
0018f36b44 gestionnaire: remove UI for filtering pieces justificatives 2019-07-30 16:11:16 +02:00
Pierre de La Morinerie
0c4cb3b498 admin: remove UI for managing old pj 2019-07-30 16:11:16 +02:00
pedong
8d03a6747c add lockable to User, Gestionnaire, administration, Administrateur 2019-07-29 17:48:44 +02:00
Nicolas Bouilleaud
b066ccbc89 Make sure Procedure.path is not null in our data 2019-07-29 13:53:33 +02:00
clemkeirua
6f47655301 rendu lien_site_web obligatoire au moment de la publication 2019-07-25 15:46:04 +02:00
Pierre de La Morinerie
1c837eb901 mailers: improve wording of transactional emails and default templates 2019-07-25 12:25:50 +02:00
Pierre de La Morinerie
8313752663 mailers: add CTA to templated emails 2019-07-25 12:25:50 +02:00
clemkeirua
f166077f5e ajout d'un bouton de suppression des admin dans le manager 2019-07-23 16:11:15 +02:00
Pierre de La Morinerie
45abb6ebc2 mailers: move default templates to a specific subdirectory
It makes more understandable that they are templates (and not views
rendered directly by Rails).
2019-07-22 16:22:20 +02:00
clemkeirua
d62740c198 extraction de la taille max des fichiers dans une constante 2019-07-18 17:19:39 +02:00
clemkeirua
ee8a1092e4 extracted MonAvisEmbedValidator 2019-07-17 18:04:32 +02:00
clemkeirua
6d43465ee5 renammed into monavis_embed 2019-07-17 18:04:32 +02:00
clemkeirua
8d2c5cfa14 validation par regex 2019-07-17 18:04:32 +02:00
Pierre de La Morinerie
727702ad4b emails: mention the procedure name in the email title 2019-07-17 15:01:19 +02:00
clemkeirua
7eeddc0b79 using a shared example + scoped to state TERMINE 2019-07-17 11:53:16 +02:00
clemkeirua
b8fa567c81 ajout du tag 'lien document justificatif' 2019-07-17 11:53:16 +02:00
Pierre de La Morinerie
a8354bd103 dossiers: unify deletion of dossiers between manager and user
The code paths for deleting a dossier were different, depending on
whether the dossier was deleted by the user, or from the Manager.

This commit unifies the two code paths into one.

This has the effect of:

- An operation log is now recorded when an user deletes its own dossier;
- Gestionnaires are now notified even when the dossier is deleted from
  the Manager;
- The `support:delete_user_account` task now requires the email address
  of the author.
2019-07-16 16:22:20 +02:00
clemkeirua
25f81f1d3c download a dossier as zip with all attachments 2019-07-16 09:11:25 +02:00