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.
When deleting a dossier from the manager, the deletion notification
email was not being sent. This is because the returned object from
`Dossier#hide!` was invalid.
An Admin may archive a procedure to make it unavailable to
the general public, but before all dossiers are handled. In this case,
the messagerie needs to be available.
Fix#4089
Replaces
> La valeur du champ doit être un nombre entier (sans chiffres après
> la virgule)
by
> La valeur du champ « Nombre de parents » doit être un nombre entier
> (sans chiffres après la virgule)
Commentaires bu Users and Gestionnaire need the messagerie to be available; Automatic system Commentaires can be created anytime.
This reintroduces Commentaire validation that was introduced in #3979 and disabled in #4018
* Use the existing Dossier#messagerie_available? method
* Raise when attempting to build a Commentaire if not messagerie_available?
* Disable the Messagerie form if not messagerie_available?
* Add tests :)
* Tweak the Horaires formatting while we’re here.
Sometimes, when using nested attributes, touch doesn’t propagate to
parent relationships. (see https://github.com/rails/rails/issues/26726)
Specifically, this happens in our app when updating a dossier with
only new attachements (but without changing the value of any fields).
To work around this, we need to define the parent relationship
explicitely. This is good practice anyway.
Fix#3906
Using an “inactive” Follow scope, similar to the “active” scope.
(I was tempted to use a default_scope, but this breaks when trying to `unscope` it in associations.)
Don’t check manually in advance: just try to create the new Follow and silently fail.
Since we have both Rails validation and DB constraints in place, we have two types of errors to check. I’m not actually sure this change improves the legibility of the code.