Commit graph

350 commits

Author SHA1 Message Date
Paul Chavard
6776a5e05a fix(react): remove register component cache 2022-01-03 19:41:23 +01:00
Pierre de La Morinerie
07230870d3 js: don't track external links
This fixes an issue where, by default, links to private attachments are
reported to Matomo.

This is benign: attachments URLs can be filtered out server-side, and
expire after one hour anyway. But we don't want to ship an insecure
configuration by default.
2021-12-23 09:50:21 +01:00
Paul Chavard
f8d245d2f8 refactor(js): use dynamic import 2021-12-21 17:09:49 +00:00
Paul Chavard
ed2cbdc966 fix(champ): save departement name without code prefix 2021-12-06 20:58:08 +01:00
Pierre de La Morinerie
115ca5e24a js: don't create invalid menus by default
When a new "Menu" type de champ is added, it comes pre-filled with a
menu title – and nothing else. Which is confusing, and invalid.

Instead pre-fill the type de champ with actual values (no titles).
2021-12-02 09:00:37 +01:00
Paul Chavard
7d189575af fix(commune): do not display foreign departement when selecting commune 2021-11-25 13:49:57 +03:00
mfo
91c3a8be19 fix(eslint): max columns 2021-11-25 13:43:28 +03:00
Martin
0d486981a6 fix(ComboCOmmunesSearch.typo): fix combo communes search typo 2021-11-25 13:43:28 +03:00
Paul Chavard
ae09b37e72 fix(champs): save departement info on champ commune 2021-11-17 14:52:47 +03:00
Paul Chavard
ba0211ba52 feat(champ): ask for departement before asking for commune 2021-11-04 11:55:25 +01:00
Paul Chavard
7ebc439630 refactor(drop_down_list_champ): other option 2021-10-27 12:01:15 +02:00
Paul Chavard
8154daf847 refactor(drop_down_list_champ): other option 2021-10-27 12:00:39 +02:00
kara Diaby
c2fcd3992d add other option for dropdown select 2021-10-26 16:11:15 +02:00
kara Diaby
0e65916e44 add other option for dropdown radio 2021-10-26 16:11:15 +02:00
kara Diaby
dc35d9521f add other option to liste deroulante champ 2021-10-26 16:11:15 +02:00
Paul Chavard
d308448f02 feat(type_de_champ): add secondary label and description do linked drop downs 2021-10-26 12:18:01 +02:00
simon lehericey
933d7b8c8d merge with another preexisting account 2021-10-14 14:47:50 +02:00
simon lehericey
ce40e1127d merge with another new account 2021-10-14 14:47:50 +02:00
simon lehericey
19f81b594b merge with an existing account by using the password 2021-10-14 14:47:50 +02:00
Pierre de La Morinerie
b2774ed2f6 js: fix pays API request on older Edge and Safari
The /api/pays API requires user authentication. However older versions
of Edge and Safari don't transmit cookies by default during a
`fetch` request.

Use the `credentials: 'same-origin'` option explicitely to fix the
countries list.
2021-09-30 16:21:24 +02:00
Pierre de La Morinerie
4f33a7b72e js: improve auto-save-controller documentation 2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
ad8dcc7f7d js: don't report autosave failures that are timeouts
This prevents spamming Sentry with "[Autosave] Error: 0" messages.
2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
8dce7d59ed js: redirect to sign-in when a ujs link_to receives a 401
Before, when a 401 was received by a ujs-enabled link (like `link_to …,
method: :delete, data: { remote: true }`, rails-ujs tried to insert the
response text as a Javascript script.

As the script was something like `Please sign-in`, which is not valid
Javascript, the browser would throw an "Unexpected token" error.

The typical use-case is:

1. The user open a form in a tab,
2. The user disconnects in another tab,
3. In the first tab, the user clicks on a remote "Delete" link_to

In that case the browser raised an error in the console (and in Sentry),
but the user would see nothing.

With this commit, all 401 ujs errors are turned into redirects to the
sign-in page.

Fix https://sentry.io/organizations/demarches-simplifiees/issues/2522512693/activity/
2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
255c00c174 js: ignore a new variant of the same warning 2021-09-07 16:45:52 -05:00
Jérôme Desboeufs
7079af2fd4
Update photographies-aeriennes basemap URL 2021-09-01 21:58:12 +02:00
Pierre de La Morinerie
7380d27d78 js: fix null xhr in autosave error handling
Sentry reports many cases of the xhr object being missing in the
error handler.

Ensure the error handling code doesn't crash because of the missing xhr.
2021-08-31 14:54:02 -05:00
Paul Chavard
5d63ced246 fix(eslint): fix eslint warnings 2021-08-31 18:14:04 +02:00
Paul Chavard
a3cc072bbd feat(i18n): translate countries selector 2021-08-31 13:15:26 +02:00
Paul Chavard
b81cfea0e4 fix(combo-search): can input empty value 2021-08-18 15:48:37 +01:00
Paul Chavard
2a84f14521 Make generic 2021-08-18 12:09:20 +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
Pierre de La Morinerie
7808f6dd4f js: document utils.ajax() 2021-07-22 11:58:02 +02:00
Pierre de La Morinerie
c6fff58f38 js: fix typo in comment 2021-07-22 11:58:01 +02:00
Pierre de La Morinerie
071d9145ca js: don't attempt to log unexistent statusText 2021-07-22 11:58:01 +02:00
Paul Chavard
c7b0b8495b Get more results from communes API and use local matcher 2021-07-20 13:34:17 +02:00
Pierre de La Morinerie
63cde95fc9 js: ignore errors generated by a Microsoft crawler
Sentry has a lot of Javacript errors stating:

> UnhandledRejection: Non-Error promise rejection captured with value: Object Not Found Matching Id:2 

This is apparently caused by a Microsoft crawler (maybe for scanning
targets of email links), and can be safely ignored.

See https://forum.sentry.io/t/unhandledrejection-non-error-promise-rejection-captured-with-value/14062/12
2021-07-20 09:21:59 +02:00
Paul Chavard
38fdaa7404 Trigger onStyleChange when leyers are toggled 2021-07-07 16:23:55 +02:00
Paul Chavard
1e4c943392 Fix map controls checkbox labels 2021-07-07 15:38:21 +02:00
Paul Chavard
65adce1e24 Fix cadastres layer 2021-07-07 15:38:21 +02:00
Paul Chavard
527db7631e Add a point on map from coordinates input 2021-07-07 13:33:28 +02:00
Paul Chavard
0ce708028d Prevent crashes in combo boxes 2021-07-06 15:06:38 +02:00
Paul Chavard
87fb98f5ed Make IGN layers opacity configurable 2021-07-06 10:36:12 +02:00
Paul Chavard
fc966a2761 IGN layers on maps can now be disabled by the user 2021-06-30 20:07:52 +02:00
Paul Chavard
10cdd2c77e Apply suggestions from code review
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2021-06-16 09:38:47 +02:00
Paul Chavard
7f28c49887 expand commune searches with multiple post codes 2021-06-16 09:29:25 +02:00
Paul Chavard
7575f50d25 Fix autocomplete on blur 2021-06-15 10:13:31 +02:00
Paul Chavard
7f4e174871 Declare useCallback dependencies 2021-06-15 10:13:31 +02:00
simon lehericey
6be0bbaa9c Change bottom champs editor button from enregistrer to continuer 2021-06-15 09:54:32 +02:00
Paul Chavard
1b0cc62fc2 Add cadastres to MapReader 2021-05-24 11:57:00 +02:00
Paul Chavard
2244263b49 Add cadastres to MapEditor 2021-05-24 11:57:00 +02:00