Commit graph

3346 commits

Author SHA1 Message Date
simon lehericey
b29bae4707 a procedure has an encrypted api_particulier_token
Co-authored-by: François VANTOMME <akarzim@gmail.com>
2021-07-30 11:18:44 +02:00
François Vantomme
17b659539f Feat (API Particulier): new encryption service 2021-07-30 11:18:44 +02:00
kara Diaby
69393c2921 modify groupe instructeur controller 2021-07-27 19:38:22 +02:00
kara Diaby
9c976c6b71 fixup! tests 2021-07-27 19:38:21 +02:00
Paul Chavard
64cfb4d64e Fix sort with revisions 2021-07-23 10:57:04 +02:00
Pierre de La Morinerie
6475cdff7a
Revert "Suppression de la clef "migrated": true sur les filtres des ProcedurePresentation" 2021-07-23 09:26:13 +02:00
Pierre de La Morinerie
e1909ed29f brouillon: redirect to sign-in when disconnected
There are two cases where the draft auto-save might fail because the
user is no longer authenticated:

- The user signed-out in another tab,
- The brower quit and re-opened, so the Session cookie expired.

In both cases, the auto-save will never succeed until the user
authenticates again, so displaying a "Retry" button is cruel.

Moreover, in plus of all auto-save requests failing with a small error,
the actual hard failure only occurs after filling all the form and
trying to submit it. Then the user is redirected to the sign-in page –
but all their changes are lost.

Instead, we now redirect to the sign-in page on the first 401 error
during the auto-save, let the user sign-in, and then redirect back to
the form.
2021-07-22 11:58:02 +02:00
Paul Chavard
388fb39eb5 Fix false positive blank champ warnings 2021-07-22 10:45:25 +02:00
Paul Chavard
ac0f50b488 Improuve champ blank check 2021-07-22 10:45:25 +02:00
Pierre de La Morinerie
fd74d9a062 lib: remove the 'migrated' key on filters
In a9a4f6e2a8, a task to migrate
ProcedurePresentation's filters was added.

This task added a "migrated: true" key to all migrated filters.

Now that this task has run, we can safely remove the extra key.
2021-07-20 16:51:32 +02:00
Pierre de La Morinerie
fda59c9231 lib: remove outdated tasks 2021-07-20 15:34:31 +02:00
Pierre de La Morinerie
32ab2f0a80 instructeur: limit the maximum size of a filter value
This prevents the URL from exceeding the max size, and
causing '414: Request-URI too large' errors.
2021-07-20 14:49:48 +02:00
Pierre de La Morinerie
831672391e app: use a long-lived cookie for CSRF token
See the ADR document for rationale.
2021-07-20 11:11:52 +02:00
Pierre de La Morinerie
446c57ed63 specs: add a feature test for forgery protection 2021-07-20 11:11:52 +02:00
Pierre de La Morinerie
71741c5f98 views: fix checkbox wrongly selected in multiple_drop_down_list
The check for whether the checkbox should be checked or not was made by
matching the whole string. Thus, given two options 'valid' and
'invalid', the check for the presence of 'valid' would succeed even when
only 'invalid' was present in the values (because
`'valid'.includes?('invalid')`.

The code now checks against the list of items in the selected_options.
2021-07-20 09:01:07 +02:00
kara Diaby
0b6c7dace7 tests 2021-07-15 16:32:07 +02:00
Pierre de La Morinerie
40b3ea8ad6
Revert "Instructeurs : limitation de la valeur d'un filtre à 100 caractères" 2021-07-13 18:19:46 +02:00
kara Diaby
d2d046a39d fix encoding problems with cherlock Holmes gem 2021-07-13 10:58:41 +02:00
Pierre de La Morinerie
3c8a88a660 instructeur: limit the maximum size of a filter value
This prevents the URL from exceeding the max size, and
causing '414: Request-URI too large' errors.
2021-07-08 16:17:22 +02:00
Paul Chavard
527db7631e Add a point on map from coordinates input 2021-07-07 13:33:28 +02:00
Paul Chavard
ab31087f23 Hide cadastres if there is none 2021-07-07 12:28:27 +02:00
Pierre de La Morinerie
37c62ac0a3 app: display standard error page when no cookies are present
This occurs mostly when Safari attempts to perform a POST request
again (without sending any of the cookies).

In that case, our custom `422.html` page is more helpful to the user
(because it has a link to the previous page) than a "No cookies" blank
text.
2021-07-06 16:29:22 +02:00
Christophe Robillard
bc07a875eb integrate a mininum weight for the average dossier weight
before this commit, the average dossier weight took account only pieces
justificatives. With this commit, we add a minimum weight for other
files included in an archive like pdf_export, log operations,
attachments added to traitements. This minimum weight is set arbitrary,
from the observation of some random procedures in production
2021-07-06 15:58:45 +02:00
Pierre de La Morinerie
09933454ff app: improve InvalidAuthenticityToken logging
- Log on all controllers
- Improve description of the controller action involved
- Ignore Safari bogus requests
2021-07-06 12:42:01 +02:00
Christophe Robillard
54d91335f2 remove the ability to download an 'everything' archive
there are sometimes an error that happen when building an everything
archive. The error explanation is not understood at the moment.
To deliver the archive feature quickly, we remove the 'everything' archive for
the moment
2021-07-05 11:05:07 +02:00
Paul Chavard
280e54b59d Enable test revisions 2021-07-01 15:59:07 +02:00
Pierre de La Morinerie
1faf91bdbe experts: protect password update as well as sign-up 2021-06-30 10:46:42 +02:00
Pierre de La Morinerie
6f7a2fde57 experts: fix saving password on sign-in 2021-06-30 10:46:42 +02:00
Pierre de La Morinerie
4f5c5e26ae spec: cleanup spec for Experts::AvisController 2021-06-30 10:46:42 +02:00
Christophe Robillard
66cc0dd08d Revert "Revert "Expose dossier PDF export as IO""
This reverts commit 362093eff0.
2021-06-24 21:01:59 +02:00
krichtof
362093eff0
Revert "Expose dossier PDF export as IO" 2021-06-24 19:21:37 +02:00
Paul Chavard
b73d504f8d Expose dossier PDF export as IO
Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2021-06-24 17:49:24 +02:00
Paul Chavard
a4482233b8 [GraphQL] expose deleted dossiers 2021-06-24 11:51:37 +02:00
Paul Chavard
0ca5e1abe2 Preview should reflect revision changes 2021-06-24 11:39:49 +02:00
Paul Chavard
8b2c2c6466 Handle carte layers changes 2021-06-24 11:39:49 +02:00
Paul Chavard
35eccb5630 Show separate blocks for types de champ and annotation changes 2021-06-23 09:40:07 +02:00
Paul Chavard
19195008e8 Expose removed types_de_champ in exports 2021-06-23 09:40:07 +02:00
simon lehericey
eadae7af6b show all available tdc for procedure presentation 2021-06-23 09:40:07 +02:00
Paul Chavard
8d49b5556a test revision changes 2021-06-23 09:40:07 +02:00
Paul Chavard
f238710044 Add last_month export 2021-06-23 09:23:10 +02:00
kara Diaby
bcc23ae7a6 test file 2021-06-22 16:33:38 +02:00
kara Diaby
309b3414d6 tests 2021-06-22 16:33:38 +02:00
Pierre de La Morinerie
5908b8019a specs: properly use xhr: true in javascript requests
This avoids an unexpected `ActionController::InvalidCrossOriginRequest`
exception to be raised when the forgery protection is disabled.
2021-06-22 13:21:55 +02:00
Paul Chavard
1f7d86d5a5 Add delete dossier action to dossiers list 2021-06-18 11:35:00 +02:00
Christophe Robillard
fdec9b2fd5 archives: don't update dossiers
this fix avoid to touch dossier after attaching pdf_export_for_instructeur
2021-06-18 11:00:57 +02:00
Christophe Robillard
7851d6b1cc archives: count archived dossiers 2021-06-18 08:59:13 +02:00
Pierre de La Morinerie
12d17bc245 spec: fix Timecop.freeze without Timecop.return
Time was frozen without being un-frozen at the end of the spec.

This caused a spec in `Procedure#publish_or_reopen!` to fail randomly.

Fixed by using the `Timecop.freeze do` form, which unfreezes after the
execution of the block.
2021-06-17 17:36:43 +02:00
Christophe Robillard
896190b91e return nil when no traitement time 2021-06-17 16:31:53 +02:00
Christophe Robillard
887c5cb4a9 correct rubocop offenses 2021-06-17 16:31:53 +02:00
Christophe Robillard
a5ae5af56a extract NB_DAYS_RECENT_DOSSIERS and PERCENTILE 2021-06-17 16:31:53 +02:00
Christophe Robillard
bdf2f47eb9 fix specs for procedure stats 2021-06-17 16:31:53 +02:00
Christophe Robillard
a8840faadb move stats methods to appropriate concern class 2021-06-17 16:31:53 +02:00
Christophe Robillard
701b72494d compute usual traitement time for specific month 2021-06-17 16:31:53 +02:00
Pierre de La Morinerie
b5bde6608c routes: replace the email param in the Avis URLs by a query param 2021-06-17 11:15:51 +02:00
kara Diaby
cd030fd975 add csv fixture file 2021-06-15 19:36:47 +02:00
kara Diaby
6ebd57640c tests 2021-06-15 19:36:46 +02:00
simon lehericey
6be0bbaa9c Change bottom champs editor button from enregistrer to continuer 2021-06-15 09:54:32 +02:00
Paul Chavard
a2c53ce7ea format phone numbers 2021-06-15 09:14:55 +02:00
François Vantomme
c9b1095d1e Refactor (Rubocop): replace map{ … }.compact by filter_map
In Ruby 2.7, Enumerable#filter_map has been added.
This cop identifies places where map { … }.compact can be replaced by filter_map.

See: https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancemapcompact
2021-06-11 15:38:09 +02:00
Christophe Robillard
aee8db99d0 add spec for dossier weight estimation 2021-06-09 10:52:38 +02:00
Christophe Robillard
4fd0ad71c3 add spec for archive weight estimation 2021-06-09 10:52:38 +02:00
Christophe Robillard
f0b2327ec6 add spec for count dossiers termines by month 2021-06-09 10:52:38 +02:00
Christophe Robillard
41569efe9d extract estimate_weight
and rename nb_dossiers by nb_dossiers_termines
2021-06-09 10:52:38 +02:00
Paul Chavard
44ebd0e8a5 Fix api education wrong data type 2021-06-08 12:25:24 +02:00
kara Diaby
fab4a41c57 add tests regarding /users/statistiques view 2021-06-07 15:09:39 +02:00
Paul Chavard
1888f74b10 Prevent double processing of declarative dossiers 2021-06-04 17:55:40 +02:00
Paul Chavard
9819a5ff77 Update spec/models/procedure_spec.rb
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2021-06-03 13:11:16 +02:00
Paul Chavard
a0d4c9d54c Fix published revisions 2021-06-03 13:11:16 +02:00
Paul Chavard
990ae10399 GraphQL byte_size should be BigInt 2021-06-03 10:53:17 +02:00
Paul Chavard
f076fa803e Handle GeoJSON validation errors 2021-06-02 12:43:24 +02:00
Paul Chavard
05380b9520 Fix destoying discarded procedures 2021-05-27 18:48:56 +02:00
Pierre de La Morinerie
929a556f9f i18n: add feature spec for changing the language 2021-05-27 11:01:26 +02:00
François Vantomme
99086a63be Fix (Instructeur): deal nicely with non-guaranteed elements order in arrays
Use of one-dimension arrays comparison & `contain_exactly` RSpec matcher
to avoid this behaviour:

Failures:
  1) InstructeursImportService#import when an email is malformed ignores or corrects
     Failure/Error:
       expect(procedure_groupes).to match_array([
         ["Occitanie", ["paul@mccartney.uk", "ringo@starr.uk"]],
         ["défaut", []]
       ])
       expected collection contained:  [["Occitanie", ["paul@mccartney.uk", "ringo@starr.uk"]], ["défaut", []]]
       actual collection contained:    [["Occitanie", ["ringo@starr.uk", "paul@mccartney.uk"]], ["défaut", []]]
       the missing elements were:      [["Occitanie", ["paul@mccartney.uk", "ringo@starr.uk"]]]
       the extra elements were:        [["Occitanie", ["ringo@starr.uk", "paul@mccartney.uk"]]]
     # ./spec/services/instructeurs_import_service_spec.rb:70:in `block (4 levels) in <main>'
2021-05-27 08:33:52 +02:00
Paul Chavard
9b0dae4cc2 Fix apostrophes ‘ -> ’ 2021-05-26 18:05:14 +02:00
Paul Chavard
4922bc88d6 Do not crash when properties is nil 2021-05-26 12:40:07 +02:00
Paul Chavard
21ee79669d Better labels in test 2021-05-25 11:43:38 +02:00
Paul Chavard
179bb5a9fe Apply suggestions from code review
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2021-05-25 11:43:38 +02:00
Paul Chavard
acb277e650 Use stable_id when replacing tags 2021-05-25 11:43:38 +02:00
kara Diaby
4b6196e6f6 verify avis privacy 2021-05-25 11:24:15 +02:00
Paul Chavard
c5f2faa3d2 add tests for backward compatibility of geo_areas 2021-05-24 11:57:00 +02:00
Paul Chavard
3b85ade440 Add compatibility cadsatre layer with old API GEO 2021-05-24 11:57:00 +02:00
Paul Chavard
01c558953b Remove API GEO legacy adapter 2021-05-24 11:50:16 +02:00
simon lehericey
b620888597 show only dossier avis 2021-05-20 16:18:04 +02:00
kara Diaby
aaf943569a rename avis confidential test 2021-05-20 11:13:24 +02:00
simon lehericey
17617fba43 address champ needs the data column 2021-05-19 15:59:18 +02:00
simon lehericey
a46000dc1f ensure to_s is used on specialized champ 2021-05-19 09:39:20 +02:00
Paul Chavard
e043645a88 cleanup tests 2021-05-18 11:42:10 +02:00
kara Diaby
468e9e849a tests 2021-05-18 11:42:10 +02:00
Paul Chavard
5f419954b4 Fix dossier deleted user display 2021-05-13 10:43:55 +02:00
Paul Chavard
3f7a2bea9b Dossier without user should be valid 2021-05-11 17:50:10 +02:00
Paul Chavard
8a74438dc1 Use conservation_extension instead of en_construction_conservation_extension 2021-05-11 17:33:53 +02:00
simon lehericey
c5f6c9ae1e fix missing state translation 2021-05-10 11:17:34 +02:00
François Vantomme
99ce5195bc Fix (API Entreprise): test fails randomly
Don't assume array order, just check that all values are present
2021-05-07 17:42:15 +02:00
Pierre de La Morinerie
77b65f3aa0 tasks: remove older after_party tasks 2021-05-06 15:19:37 +02:00
simon lehericey
55b80df29d display count before text in tabs 2021-05-06 09:13:20 +02:00
simon lehericey
5124e08ccd disable faulty manager spec 2021-05-05 21:34:57 +02:00
simon lehericey
ccce724976 refactor as created fci must have an user_id 2021-05-05 14:36:34 +02:00
simon lehericey
e18fb116c6 cannot create fci without user 2021-05-05 14:36:34 +02:00
simon lehericey
8d0082419c do not know how it worked before 2021-05-05 14:36:34 +02:00
simon lehericey
9dc9e92c16 use the with_user trait in feature 2021-05-05 14:28:20 +02:00
simon lehericey
1cf59f722e add :with_user trait to fci as user_id is mandatory 2021-05-05 14:28:20 +02:00
simon lehericey
ed404f129b remove now falling spec of obsolete task 2021-05-05 14:28:20 +02:00
simon lehericey
9fd1c604a1 display follower instructeur emails in alphabetic order 2021-05-04 16:38:34 +02:00
simon lehericey
50f679746f do not extract twice the same dossier_id if the dossier is followed twice 2021-05-04 16:38:34 +02:00
Paul Chavard
bcbfcdc537 Revert "Merge pull request #6142 from tchak/enable_brouillon_extend_conservation"
This reverts commit 48eb4d9778, reversing
changes made to 5539d5cb8c.

# Conflicts:
#	app/models/dossier.rb
#	db/schema.rb
2021-05-04 16:03:29 +02:00
Christophe Robillard
01f180022b prend en compte uniquement les pj pour estimer la taille d'un dossier 2021-05-04 12:50:12 +02:00
Paul Chavard
f6508899de Refactor NotificationMailer 2021-05-04 12:05:06 +02:00
Paul Chavard
a4fd629f4a Enable user destruction 2021-05-04 12:05:06 +02:00
Paul Chavard
b2a867266a Allow users to extend conservation on drafts 2021-04-29 19:50:30 +02:00
Christophe Robillard
3d04221dab generate pdf export for dossier only on demand 2021-04-29 17:30:38 +02:00
Christophe Robillard
f40d96fbd2 Revert "Revert "Export de tous les dossier d'une démarche""
This reverts commit d9a588b52e.
2021-04-29 17:29:47 +02:00
krichtof
d9a588b52e
Revert "Export de tous les dossier d'une démarche" 2021-04-29 16:07:18 +02:00
Pierre de La Morinerie
fbfe5c3817 jobs: also retry native ActiveStorage's jobs on transient errors 2021-04-29 14:08:12 +02:00
Pierre de La Morinerie
684af77e35 jobs: extract an RetryOnTranscientErrors concern 2021-04-29 14:08:12 +02:00
simon lehericey
7b94c2de88 remove extra Dossier call in projection 2021-04-29 11:46:00 +02:00
simon lehericey
db23a853a9 fetch all notification at once 2021-04-29 11:23:41 +02:00
simon lehericey
20fb756097 one less count 2021-04-29 11:23:41 +02:00
simon lehericey
8b73d8804c fetch all exports at once by groupe_instructeurs_ids 2021-04-29 11:23:41 +02:00
Paul Chavard
f9fb6473b4 geo module is not really accessible :( 2021-04-28 15:34:53 +02:00
Paul Chavard
85b907807a Improuve ComboMultipleDropdownList style 2021-04-28 12:54:45 +02:00
Christophe Robillard
09870c918d prevent race conditions when creating archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
dfbe004122 rename content_type to time_span_type for archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
9134114c2e fix rubocop offenses 2021-04-28 11:40:58 +02:00
Christophe Robillard
8bee53fe77 rend plus robuste la création de l'archive 2021-04-28 11:40:58 +02:00
Christophe Robillard
71a5e41e5b add archive_zip_globale feature flag 2021-04-28 11:40:58 +02:00
Christophe Robillard
8b2849408c instructeurs can create and download archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
07cc4fa97f add service to create procedure archive 2021-04-28 11:40:58 +02:00
Christophe Robillard
fba0d78153 generate pdf export inside pieces_justificatives_service 2021-04-28 11:40:58 +02:00
Christophe Robillard
c25f3c79d9 add archive model 2021-04-28 11:40:58 +02:00
Paul Chavard
2a068fb9b0 Remove user feedback buttons 2021-04-22 15:40:40 +01:00
Paul Chavard
c20ad5ca17 Remove the link between commentaire and user 2021-04-22 15:10:47 +01:00
Pierre de La Morinerie
d530b272a1 password: add specific page for reset instructions 2021-04-22 14:24:15 +02:00
simon lehericey
553e1d973c remove old methods 2021-04-22 10:46:04 +02:00
simon lehericey
5bfd4ecbbf add DossierProjectionService 2021-04-22 10:46:04 +02:00
Pierre de La Morinerie
7ee29b2190 spec: fix flaky expert test
In this test, two Avis are created for each expert:
- one for the original dossier,
- one for the dossier linked to the original dossier.

When we check for a sign-up link, we should do so using the
Avis for the original dossier explicitely.
2021-04-20 12:06:12 +02:00
Pierre de La Morinerie
6b14420ffa sign_in: improve "Forgot password?" appearance on mobile 2021-04-20 09:34:52 +02:00
Pierre de La Morinerie
0749d981ab password: make the "Reset password" button clearer 2021-04-20 09:34:52 +02:00
Pierre de La Morinerie
fffb85987c app: retain user email on sign-in error 2021-04-20 09:34:52 +02:00
kara Diaby
5982660c37 tests 2021-04-19 10:23:45 +02:00
François Vantomme
f747b0a46a Chore(test): enable rspec only-failures support 2021-04-15 14:17:39 +02:00
kara Diaby
198e3ed3b8 expert mailer instead of avis mailer 2021-04-15 12:22:40 +02:00
kara Diaby
f4aa29a799 add expert mailer preview 2021-04-15 11:29:55 +02:00
Paul Chavard
6d37e1d133 Fix discarded procedures destruction 2021-04-14 12:24:16 +01:00
Paul Chavard
5b56ec425b Fix discarded dossiers destruction 2021-04-14 12:24:16 +01:00
François Vantomme
a596df9a4a Test: use APPLICATION_NAME to deal nicely with custom configuration 2021-04-13 22:46:33 +02:00
Pierre de La Morinerie
872f6b0153 lib: add migration helpers for making a column unique 2021-04-13 18:09:59 +02:00
simon lehericey
fde433a7cf do not ask for avis if the dossier is absent 2021-04-13 12:04:45 +02:00
simon lehericey
c683fad3f3 [#6084] add after_party task to fill missing data 2021-04-13 09:59:28 +02:00
simon lehericey
52c8b60419 This is why you need to add a COUNT(DISTINCT dossiers.id) to make it work 2021-04-13 09:32:48 +02:00
simon lehericey
594cda3ee3 Remove previous attempt but steal its spec 2021-04-13 09:32:48 +02:00