demarches-normaliennes/app/models
Pierre de La Morinerie e5f5440663 models: explicitely save procedure's new revision
Deep-cloned objects have all their relationships stale. Thus, for a
newly deep-cloned revision, `revision.types_de_champs` returns `[]`,
even when it actually has associated types de champ.

This causes consecutive champs creations and re-ordering to fail in
subtle ways, like:

```
procedure.draft_revision.add_type_de_champ(…)
procedure.publish_revision!
procedure.draft_revision.add_type_de_champ(…)
procedure.draft_revision.move_type_de_champ(…) # this will fail
```

As `publish_revision!` created a new stale revision, moving the type
de champ fails because not all existing champs are found until the
object is refreshed.

We don't hit this path in production, because usually only a single
operation is made in a request.

To fix this, save the new revision before associating it as the draft
procedure.

(Another option would be to `reload` the revision after creation, but
this seems better contained and matches the name of the method.)
2021-11-25 08:49:17 +01:00
..
champs models: remove custom code for file size validation message 2021-11-24 10:06:45 +01:00
concerns models: remove custom code for file size validation message 2021-11-24 10:06:45 +01:00
mails Fix apostrophes ‘ -> ’ 2021-05-26 18:05:14 +02:00
types_de_champ fix(revisions): fix repetitions export with revisions 2021-11-03 18:20:48 +01:00
.keep First Commit 2015-08-10 11:05:06 +02:00
administrateur.rb merge admin 2021-10-19 16:12:42 +02:00
administrateurs_instructeur.rb merge instructeur 2021-10-07 15:51:31 +02:00
administrateurs_procedure.rb feat(manager): add become administrateur button in manager (with 24h expiration) 2021-10-07 11:32:12 +02:00
agent_connect_client.rb manage AgentConnect callback 2021-11-23 14:17:59 +01:00
api_entreprise_token.rb zeitwerk: Api -> API 2021-02-09 13:07:30 +01:00
application_record.rb Add id argument to most collections on dossier 2021-03-02 12:42:22 +01:00
archive.rb Revert "Revert "Export de tous les dossier d'une démarche"" 2021-04-29 17:29:47 +02:00
assign_to.rb Remove ignored_columns 2021-04-13 17:00:07 +01:00
attestation.rb models: require belong_to associations on attestation 2020-08-18 15:57:36 +02:00
attestation_template.rb models: remove custom code for file size validation message 2021-11-24 10:06:45 +01:00
avis.rb models: remove custom code for file size validation message 2021-11-24 10:06:45 +01:00
bill_signature.rb fix(virus scan): prevent virus scan on archives and signatures uploads 2021-09-07 14:21:48 +02:00
bulk_message.rb add procedure to bulk messages 2021-08-04 11:35:06 +02:00
champ.rb add other option to liste deroulante champ 2021-10-26 16:11:15 +02:00
commentaire.rb models: remove custom code for file size validation message 2021-11-24 10:06:45 +01:00
current.rb Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
current_confirmation.rb mailers: add procedure context to the confirmation link 2020-02-25 11:45:36 +00:00
deleted_dossier.rb fix(dossiers): wrap dossier discard in a transaction 2021-11-02 18:17:35 +01:00
demande.rb [fix #1601] show pipedrive demandes in manager 2018-03-22 15:37:16 +01:00
dossier.rb feat(dossiers/show): enhance header with expirations message/banner. also ensure consistent design between dossier states 2021-11-23 05:50:25 +01:00
dossier_operation_log.rb fix(dossier): fix dossier.avis cascade 2021-10-26 11:16:29 +02:00
dossier_transfer.rb fix(transfer): remove discarded dossiers from transfers 2021-10-26 10:41:01 +02:00
dossier_transfer_log.rb feat(dossier): add dossier transfer models 2021-09-08 14:39:46 +02:00
entreprise.rb Add default nil value for numero_tva_intracommunautaire 2021-03-16 12:57:10 +01:00
etablissement.rb fix(virus scan): prevent virus scan on archives and signatures uploads 2021-09-07 14:21:48 +02:00
exercice.rb models: require belong_to associations on exercice 2020-08-18 15:57:36 +02:00
expert.rb add case when the old_expert or old_instructeur is nil 2021-10-12 11:04:06 +02:00
experts_procedure.rb add revoked at to experts_procedures 2021-04-06 10:39:22 +02:00
export.rb Add last_month export 2021-06-23 09:23:10 +02:00
follow.rb models: require belong_to associations on follow 2020-08-18 15:57:37 +02:00
france_connect_information.rb merge with an existing account by using the password 2021-10-14 14:47:50 +02:00
france_connect_particulier_client.rb FC initializers: remove Hashie 2018-01-15 17:08:38 +01:00
geo_area.rb Do not crash when properties is nil 2021-05-26 12:40:07 +02:00
groupe_instructeur.rb Rename for consistency with defaut_groupe_instructeur 2021-03-04 10:45:02 +01:00
individual.rb affiche Madame ou Monsieur 2020-12-08 21:30:54 +01:00
instructeur.rb add agent_connect_id to instructeur 2021-11-23 14:17:59 +01:00
invite.rb use after_create instead of after_save 2020-09-29 18:15:38 +00:00
merge_log.rb Add merge log 2021-10-28 14:39:13 +02:00
module_api_carto.rb models: require belong_to associations on module_api_carto 2020-08-18 15:57:37 +02:00
procedure.rb models: explicitely save procedure's new revision 2021-11-25 08:49:17 +01:00
procedure_overview.rb Fix apostrophes ‘ -> ’ 2021-05-26 18:05:14 +02:00
procedure_presentation.rb Fix sort with revisions 2021-07-23 10:57:04 +02:00
procedure_revision.rb revisions 2021-10-27 12:00:39 +02:00
procedure_revision_type_de_champ.rb Remove migration service 2020-09-02 11:26:26 +02:00
service.rb models: require belong_to associations on service 2020-08-18 15:57:37 +02:00
siret.rb Do one thing per line 2018-10-01 16:15:46 +02:00
stat.rb cache landing data 2020-10-06 16:12:01 +02:00
super_admin.rb models: extract password complexity to a concern 2021-09-09 09:40:39 -05:00
traitement.rb fix(spec): get back to stable state 2021-11-19 12:36:03 +01:00
trusted_device_token.rb models: require belong_to associations on trusted_device_token 2020-08-18 15:57:37 +02:00
type_de_champ.rb fix(export): remove wrong columns from repetition spreadsheets 2021-11-10 20:45:32 +01:00
user.rb include hidden dossier in merge 2021-11-15 23:14:41 +01:00