As the comment states, it would be nice to load the Virus Scanner on
the Attachment (rather than the blob).
However, in order not to clobber the blob metadata, we want to run the
VirusScanner once the blob analyzer did run.
And the most direct way to detect that the blob analyzer did run is to
add an `on_update_commit` hook on the blob, as this hook will be
trigerred when saving changes to the metadata. This is what the current
solution uses.
So the current solution is almost optimal, and has a low chance of
accidentally clobbering the blob metadata – as the virus scanner is only
started when the analysis phase is finished.
This fixes an issue where clicking quickly on several "Remove row"
buttons on a repetition field results in autosave errors.
This is because the N+1 autosave request is correctly sent after the
Nth response from the server, but _before_ the row element is actually
removed from the DOM. So the N+1 request actually sends the fields for
the deleted row, which makes the server raise an error.
With this fix, the row gets properly removed when the server responds,
and before the next request is started.
Before, when autosaving a draft, removing a repetition row would
send `_destroy` inputs to the controller – but not remove the row
from the DOM. This led to the `_destroy` inputs being sent again
on the next autosave request, which made the controller raise
(because the row fields were already deleted before).
To fix this, we let the controller response remove the deleted
row(s) from the DOM.
Doing it using a controller response avoids the need to keep track
of operations on the Javascript side: the controller can easily
know which row was just deleted, and emit the relevant changes for
the DOM. This keeps the autosave requests robust: even if a request
is skipped (e.g. because of a network interruption), the next request
will still contain the relevant informations to succeed, and not let the
form in an unstable state.
Fix#5470
After clicking on a radio button option, it is impossible to revert to
the "None of the values selected" state.
However on non-mandatory fields, reverting to the no-selection value
should be possible.
To fix this, add an explicit "N/A" option.
Rails : les relations `belongs_to` sont maintenant requises par défaut. (Pour une relation optionnelle, mentionner explicitement `belongs_to :table, optional: true`)
- Make `type_de_champ.procedure` a requirement;
- Move the procedure_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
- Make `champ.dossier` a requirement;
- Move the dossier_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
- Allow specs to only build the champ (instead of saving it to the
database), which bypasses the requirement to have a dossier.