Commit graph

1675 commits

Author SHA1 Message Date
Christophe Robillard
9a62d3fe0c delete a user 2020-01-13 10:06:43 +01:00
Paul Chavard
785a09b326 Use service_url instead of blob_url on secure attachments 2020-01-08 14:43:05 +01:00
Pierre de La Morinerie
b3558c497d dossiers: make build_default_individual explicit
It avoid the use of callbacks, and may avoid situations where an empty
individual is implicitely created.
2020-01-08 10:48:22 +01:00
Pierre de La Morinerie
5e05556ee8 dossiers: add a validation on dossier individual
Validate that a dossier on a `for_individual?` procedure always has
an `individual` associated record.

For this, the individual needs to be built before the record is
validated (i.e. even before the `before_create` callback is run).

This should help with #4596: now if a dossier is created without an
`individual`, or if the `invividual` record is later removed, the
validation will fail.
2020-01-08 10:48:22 +01:00
Pierre de La Morinerie
e32a42cfe6 dossiers: split the dossier creation on several lines 2020-01-08 10:48:22 +01:00
Pierre de La Morinerie
5b2311c851 dossiers: rescue RecordNotFound only for procedures
This ensures that we won't rescue an `ActiveRecord::RecordNotFound`
exception related to another object.
2020-01-08 10:48:21 +01:00
Paul Chavard
e61e39d345 Remove unused code and tests 2020-01-07 11:52:51 +01:00
Paul Chavard
ff46ee366e Fix user brouillon spec 2020-01-07 11:52:51 +01:00
Paul Chavard
22aa2d4ee0 Make all location champs autocomplete 2020-01-07 11:52:51 +01:00
Paul Chavard
fa2eea81aa Cleanup demarche archivee state 2020-01-07 11:13:42 +01:00
Pierre de La Morinerie
8eb295d67e dossiers: avoid exceptions on invalid AASM transitions
When attempting an invalid transition on a dossier, provide a meaningful
error message (instead of letting an `AASM::InvalidTransition` exception
propagate).

This handles not only the case where the same state is applied twice
(which was already handled manually), but all cases where the transition
is invalid.
2019-12-19 13:25:32 +01:00
simon lehericey
60538c9c28 Controller use new export model 2019-12-18 13:13:15 +01:00
simon lehericey
745086cbb5 Simplify view 2019-12-18 13:13:15 +01:00
simon lehericey
d0f0533a32 Remove unused code 2019-12-18 13:13:15 +01:00
simon lehericey
f069f6f779 Make the new instructeur receive the affectation mail 2019-12-16 18:20:00 +01:00
simon lehericey
058442c84e [link to #4557] An instructeur cannot change its email on its own 2019-12-11 17:18:21 +01:00
simon lehericey
21910c959e @current_user -> current_user 2019-12-11 17:18:21 +01:00
Paul Chavard
2f060fc30a Add depubliee state to procedures 2019-12-04 16:52:41 +01:00
Paul Chavard
e429c79eb1 Allow administrators to set themselves démarches as déclaratives 2019-12-04 12:30:26 +01:00
Pierre de La Morinerie
3212dfddca app: allow hiding the browser banner for one week 2019-12-03 16:09:18 +01:00
simon lehericey
4175aa0b28 GroupeInstructeur: do not use outdated email column 2019-12-02 14:52:01 +01:00
Paul Chavard
7b947feae4 Rename demarche archivée to demarche close 2019-11-28 15:07:16 +01:00
Paul Chavard
c1c8ab7ac6 Disable transition from publiée to brouillon 2019-11-28 14:17:47 +01:00
simon lehericey
6657459f9c Fix add instructeur with empty mail
As select2 does not handle required attribute, we can only add server side logic
2019-11-27 14:39:16 +01:00
Pierre de La Morinerie
f58f9f9950 dossiers: render a valid response after an autosave
This helps Firefox DevTools to mark the request as valid and completed
successfuly.
2019-11-27 10:37:33 +00:00
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
Pierre de La Morinerie
68f5aae99d autosave: add feature test 2019-11-21 14:00:06 +01:00
Paul Chavard
0c6705f7fd Drop old export service 2019-11-21 10:25:40 +01:00
clemkeirua
be7fde1103 fix UnknownFormat raised in Instructeurs::ProceduresController#download_export 2019-11-21 09:52:38 +01:00
Christophe Robillard
b42f21264e permet le suivi auto après envoi instructeur
Close #4163
2019-11-20 16:41:30 +01:00
Pierre de La Morinerie
5f9a9d059e dossiers: render JSON if needed
When receiving a request that expects JSON, return a simple '200'.

This avoids the unecessary work of rendering all the HTML page (which
ultimately will not be used).
2019-11-20 11:30:27 +01:00
Pierre de La Morinerie
8b8a96abda dossiers: save draft by default (instead of submitting)
Make the default behavior of `update_brouillon` be to update the draft,
instead of submitting the dossier.

This makes all requests made to `update_brouillon` without specifying
an extra `submit_draft` parameter to just save the draft. It will make
autosaving the draft easier and safer.
2019-11-20 11:24:31 +01:00
simon lehericey
dae7a3bfd0 [fix #4529] Log user email in manager space 2019-11-19 12:15:03 +01:00
simon lehericey
9ca026a630 Use a select2 box for looking to instructeurs 2019-11-18 17:08:51 +01:00
Paul Chavard
556ec351f3 Drop email on instructeurs 2019-11-13 15:38:44 +01:00
Paul Chavard
990c867c2e [GraphQL] Add more filters to dossiers 2019-11-07 22:07:42 +01:00
Paul Chavard
f5c80f211d Guard for missing attestation on dossier 2019-11-06 12:54:07 +01:00
Paul Chavard
95f98fe605 API v1 correctly handle resultats_par_page 2019-11-06 12:54:07 +01:00
Pierre de La Morinerie
8df91df9fa assigns: strip and lowercase the search filter 2019-11-06 12:16:30 +01:00
Pierre de La Morinerie
0eeac59ecd assigns: fix search among the unassigned instructeurs
This was broken since moving the email out of the Instructeur column.
2019-11-06 12:16:30 +01:00
simon lehericey
5643e671a0 Code use user.active? 2019-11-05 14:10:39 +01:00
Pierre de La Morinerie
c37bfc7349 instructeurs: fix email casing in invitation
When inviting an instructeur, the code first looked up an existing
instructeur using the normalized (downcased) email address–but then
tried to promote it using the non-normalized version, which failed.

This fixes the issue by always using the normalized email.
2019-11-05 10:54:58 +01:00
Pierre de La Morinerie
f63cd86811 webhook: fix a crash when the Helpscout customer is unknown 2019-11-04 18:36:52 +01:00
Pierre de La Morinerie
f131dbb80d instructeurs: make the create form not using email directly
Before the form attempted to read an email value from the Instructeur
model, and failed (because the empty Instructeur had no user yet).

We could let `Instructeur#email` return `nil` if there is no User –
but as a created Instructeur is always supposed to have a User, this
seems like a nice safeguard to keep.

So instead this commit rewrites the create form, which now doesn’t
depend on an Instructeur model. Seems easy enough for now.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
d78d206544 instructeurs: fix expert creation not to use Instructeur.email
It kind of worked until now, because the email field is disabled, and
thus never accessed.

But better make it clean, by accessing an object (User) where the email
field actually exists.
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
Pierre de La Morinerie
627d30191f manager: allow hidden procedures to be searched
The Manager::DossiersController already allow hidden dossiers to be
searched and displayed. Give the same behavior to Procedures.
2019-10-31 17:03:02 +01:00
Nicolas Bouilleaud
72b7ff221c move procedure to new design 2019-10-31 10:27:19 +01:00
simon lehericey
477f7c9837 Remove instructeur 2019-10-30 14:27:51 +01:00
simon lehericey
79b808470c Add instructeur 2019-10-30 14:27:51 +01:00
simon lehericey
94081a3997 Show Groupe Instructeur 2019-10-30 14:27:51 +01:00
simon lehericey
4491dca19a Index Groupe Instructeur 2019-10-30 14:27:51 +01:00
simon lehericey
d411bfddc8 We can send a dossier to instructeurs from the same groupe 2019-10-25 09:42:17 +02:00
simon lehericey
8ae592fe25 [fix #4361] administrateur active 2019-10-24 18:32:48 +02:00
Pierre de La Morinerie
35e97ac617 patron: add content to the repetition champ 2019-10-24 16:52:29 +02:00
Pierre de La Morinerie
8f4ead96b0 patron: make the labels more readable 2019-10-24 16:52:29 +02:00
clemkeirua
d9e993571c add a warning during export generation 2019-10-24 16:27:10 +02:00
simon lehericey
35bba62297 Update routing critéria name 2019-10-23 21:47:20 +02:00
simon lehericey
a5ffe9f54b Remove instructeur from the group 2019-10-23 21:47:20 +02:00
simon lehericey
a6deafd885 Add instructeurs to groupe 2019-10-23 21:47:20 +02:00
simon lehericey
3dd3af8482 Groupe instructeur update 2019-10-23 21:47:20 +02:00
simon lehericey
9a6336f508 Groupe instructeur create 2019-10-23 21:47:20 +02:00
simon lehericey
733e83cc54 Groupe instructeur show 2019-10-23 21:47:20 +02:00
simon lehericey
2749c00ce3 Groupe instructeur index 2019-10-23 21:47:20 +02:00
simon lehericey
6a974663b0 An instructeur owns procedure with groupe instructeur mechanisme 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
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
clemkeirua
1af2b63ed1 initial implementation of async export 2019-10-22 09:50:58 +02:00
simon lehericey
b7434c3132 User can choose its gi 2019-10-17 15:48:14 +02:00
simon lehericey
5143d341ec Admin: 1 query for crips 2019-10-08 09:53:40 +02:00
clemkeirua
053cc5cfc5 [fix #4058] instructeur peut passer accepte → instruction 2019-10-07 15:17:33 +02:00
clemkeirua
d3063c0b63 remove download_as_zip feature flag 2019-10-03 10:48:24 +02:00
Paul Chavard
bf6fbbf2b6 Add graphql end point 2019-09-24 10:47:21 +02:00
Nicolas Bouilleaud
a2131d0fcc Don’t unfollow when archiving
It was slightly broken in two ways:
- it doesn’t make other instructeurs unfollow the dossier
- if the dossier is unarchived, instructeurs don’t refollow automatically.
2019-09-20 11:06:33 +02:00
simon lehericey
8660d4af30 Instructeur: only export its dossiers 2019-09-19 12:24:40 +02:00
simon lehericey
f5bbc9e2f9 InstructeurProcedureShow: show dossier for all the gi involved 2019-09-18 15:51:02 +02:00
Paul Chavard
8fcf1353f3 Remove duplicated attachments 2019-09-17 18:12:53 +02:00
simon lehericey
dec42e4886 Instructeur procedure index: show stats by procedure
Also sum the count from differents groupe_instructeur from the same procedure
2019-09-17 17:19:14 +02:00
Nicolas Bouilleaud
0c98f29d59 Move the cached procedure stats queries to a ProcedureStatsConcern 2019-09-17 16:43:48 +02:00
Nicolas Bouilleaud
06d60cd943 Cache requests in procedures/stats 2019-09-17 16:43:48 +02:00
Nicolas Bouilleaud
3e2985b305 First attempt at procedure stats
fixes #3945, #3946, #3948
2019-09-17 16:43:48 +02:00
Nicolas Bouilleaud
543f9894c1 Make sure the “commencer” link uses the proper test path 2019-09-17 16:30: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
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
99f986b815 Cleanup Procedure retrieval in “Commencer”
Make sure to only fetch active (brouillons or published) procedures.
2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
92e6032115 Remove path availability dead code when creating/editing a procedure
There’s no “path” field anymore in the Procedure form, it can only be set when publishing.
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
maatinito
ae34e48624 [fix #4311] Unable to reinvite admin 2019-09-17 16:15:04 +02:00
Paul Chavard
ff2b6ca3ea Fix service controller 2019-09-17 12:37:37 +02:00
Paul Chavard
adfa80142a Cleanup application_controller and current_user 2019-09-17 12:37:37 +02:00
Paul Chavard
3eeebd62eb Use built in active_storage helper 2019-09-17 11:11:08 +02:00
simon lehericey
acb99609ba Move defaut_groupe_instructeur as has_one and eager_load 2019-09-16 15:57:07 +02:00
simon lehericey
afa0237349 remove logo n+1 2019-09-16 15:48:19 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
Pierre de La Morinerie
503c393a87 helpscout: use replies_sent to compute contact rate
The `conversations_count` we previously used counts replies, but also
all conversations that were tagged or re-tagged during the month – with
made counting the actual work spent on user support brittle.

Counting the replies is a better estimation of what we get.

Unfortunately this also removes the filtering-by-tag feature. To
mitigate this, the reports are now scoped to a specific mailbox. This
allows to create extra mailboxes for conversations that should't be
counted in the stats.
2019-09-11 17:26:10 +02:00