Commit graph

9334 commits

Author SHA1 Message Date
krichtof
4954f798a5
Merge pull request #4742 from betagouv/4532-supprime-email-column-de-la-table-admin
#4532 supprime la colonne email de la table admin
2020-02-04 16:47:44 +01:00
Christophe Robillard
50fcd24b46 admin: fix pending demandes
fetch email with map
2020-02-04 16:21:42 +01:00
Christophe Robillard
53f420c748 admin: fix sql column ambiguity
administrateurs_instructeurs and users (loaded by
Administrateur.default_scope) have administrateur_id column with same
name. This commit indicates which column to use for GROUP query.
2020-02-04 16:21:42 +01:00
Christophe Robillard
cef776ff9e admin: fix add administrateur to a procedure 2020-02-04 16:21:42 +01:00
Christophe Robillard
f8309c45a6 admin: order by user email 2020-02-04 16:21:42 +01:00
Christophe Robillard
91f1722088 admin: always eager load the user relationship
Now that `Administrateur.email` is merely an alias to
`administrateur.user.email`,
and we changed every occurence of `administrateurs.pluck(:email)` to
`administrateurs.map(&:email)`, the new version using `map` may cause N+1
queries if the users have not been preloaded.

  It makes sense to always preload the user when fetching an
  Administrateur:

  - Administrateur and User have a strongly coupled relationship
  - It avoids N+1 queries everywhere in the app

  Of course fetching an administrateur without needing its user will now do
  an unecessary fetch of the associated user. But it seems better than
  leaving a risk of N+1 queries in many places.
2020-02-04 16:21:42 +01:00
Christophe Robillard
4a1980e95a admin: disable the email column 2020-02-04 16:21:42 +01:00
Christophe Robillard
ed970d3f3c admin: create without providing email 2020-02-04 16:21:42 +01:00
Christophe Robillard
2bb161c3cb admin: alias Administrateur.email 2020-02-04 16:21:42 +01:00
Christophe Robillard
7bb298722f remove unique constraint on admin emails 2020-02-04 16:21:42 +01:00
Christophe Robillard
055918aabc admin: replace calls to Administrateur.find_by(email: ...) 2020-02-04 16:21:42 +01:00
krichtof
e72233fced
Merge pull request #4733 from betagouv/4127-suppression-users-via-manager
Superadmin : peut supprimer un compte via le manager
2020-02-04 16:19:37 +01:00
Christophe Robillard
c137917396 fix typo 2020-02-04 16:07:01 +01:00
Christophe Robillard
deb11f281f remove useless relation between administrateur and dossiers 2020-02-04 16:07:01 +01:00
Christophe Robillard
5a46effcbc remove useless condition to admin that can be deleted
administrateur can be deleted only if he/she has a procedure where
he/she is the only admin
2020-02-04 16:07:01 +01:00
Christophe Robillard
4bf020cb96 rend le test plus élégant 2020-02-04 16:07:01 +01:00
Christophe Robillard
6fc8a27bd7 destroys not all dossiers
but only dossiers for a specific user
2020-02-04 16:07:01 +01:00
Christophe Robillard
cee4c5b8fb Revert "Revert "4127 fix superadmin supprime compte usager""
This reverts commit 751f24f7bb.
2020-02-04 16:07:01 +01:00
Paul Chavard
a82cf22b71
Merge pull request #4731 from tchak/tweak-exports-polling
Tweak a bit timeout values for export polling
2020-02-03 16:02:18 +01:00
Paul Chavard
5afe158c89 Tweak a bit timeout values for export polling 2020-02-03 15:56:10 +01:00
Keirua
82a9c9c56a
Merge pull request #4737 from betagouv/4658-fix-apostrophe
#4658 - balises avec accents et apostrophes
2020-02-03 15:44:09 +01:00
clemkeirua
57a0973c99 added a test to show #4658 does not exist 2020-02-03 15:43:53 +01:00
Keirua
2beb63fadb
Merge pull request #4734 from tchak/select-timeout
Add a timeout to select2 queries
2020-02-03 15:41:53 +01:00
Paul Chavard
068471003d Add a timeout to select2 queries 2020-02-03 15:34:08 +01:00
Keirua
9dd5d1d04f
Merge pull request #4732 from tchak/revert-revert-js-update
Update javascript dependencies (revert of revert)
2020-02-03 15:20:29 +01:00
Paul Chavard
82014e4e21 Enforce node 12 2020-02-03 14:54:25 +01:00
Paul Chavard
a86129c3a1 Revert "Revert "Update javascript dependencies and add webpack-bundle-analyzer""
This reverts commit eddd59e554.
2020-02-03 14:54:25 +01:00
Keirua
d19c9c6dcc
Merge pull request #4739 from betagouv/improve-cop-detection
lint: improve Rubocop detection
2020-02-03 11:55:03 +01:00
Pierre de La Morinerie
cbaa584bd0 lint: improve Rubocop detection
Instead on relying on the environment, we try to load the Rubocop cop
only if Rubocop is currently loaded.
2020-02-03 11:09:11 +01:00
Keirua
a6b337c436
Merge pull request #4735 from betagouv/fix/rubocop-custom-rule
Only load rubocop's custom rule in development
2020-01-30 15:30:24 +01:00
clemkeirua
eb20dd9153 only load unscoped custom rule in development 2020-01-30 15:23:21 +01:00
Paul Chavard
ab93a75b6d
Merge pull request #4726 from tchak/auto-watch-exports
Poll for export readiness updates
2020-01-30 11:07:05 +01:00
Paul Chavard
08400cdd4c Poll for export readiness updates 2020-01-29 22:52:03 +01:00
Keirua
a7e1137eeb
Merge pull request #4728 from betagouv/revert-4656-cleanup-js
Revert "Update javascript dependencies and add webpack-bundle-analyzer"
2020-01-29 14:58:32 +01:00
Keirua
eddd59e554
Revert "Update javascript dependencies and add webpack-bundle-analyzer" 2020-01-29 14:51:55 +01:00
Keirua
d4dbc44dac
Merge pull request #4723 from betagouv/fix-double-render
fix: les demandes de PDF pour les brouillons génèrent des DoubleRender
2020-01-29 14:33:33 +01:00
clemkeirua
1c3573c7db fix DoubleRender error for brouillon pdf 2020-01-29 14:24:23 +01:00
Paul Chavard
5bd4c16de8
Merge pull request #4725 from betagouv/fix-export-excel-invalid-worksheet
Fix - Suppression des caractères invalides pour feuilles excel
2020-01-29 11:21:00 +00:00
clemkeirua
fcea7c4f85 remove invalid excel worksheet characters 2020-01-29 11:45:56 +01:00
Paul Chavard
ea4bb93bba
Merge pull request #4720 from tchak/graphql-big-int
[GraphQL] Use GraphQL::Types::BigInt instead of Int
2020-01-29 10:10:46 +00:00
Paul Chavard
6030409b2f [GraphQL] Use GraphQL::Types::BigInt instead of Int 2020-01-28 21:48:00 +01:00
Paul Chavard
42fd2a4774
Merge pull request #4721 from betagouv/rubocop-unscoped
Ajout d'une règle Rubocop pour interdire `unscoped`
2020-01-28 21:47:39 +01:00
Pierre de La Morinerie
cf101d64d8 lint: add a Rubocop rule to forbid the use of unscoped
`unscoped` often has an effect broader than intended. For instance:

```
user.dossiers.unscoped.destroy_all
```

will not destroy all the user's dossier, including the hidden ones,
but **all the dossiers of all users**.

Instead, narrower unscoping should be used:

```
user.dossiers.unscope(where: :hidden).destroy_all
```

(Or even better, use the new `Dossier.with_hidden` scope).
2020-01-28 17:32:38 +01:00
Pierre de La Morinerie
96932faa3f models: add a Dossier#with_hidden scope, and remove unscoped usages 2020-01-28 17:32:38 +01:00
Pierre de La Morinerie
1448d5b098 models: add a Procedure#with_hidden scope, and remove unscoped usages
This avoids the broad use of `unscoped` to remove the `hidden_at`
clause.
2020-01-28 17:32:38 +01:00
Pierre de La Morinerie
4efea77280 specs: regroup dossier scope specs together 2020-01-28 17:32:38 +01:00
Pierre de La Morinerie
780cb965a5
Update javascript dependencies and add webpack-bundle-analyzer (#4656)
Mise à jour des dépendances Javascript ; ajout de webpack-bundle-analyzer
2020-01-28 17:29:18 +01:00
Paul Chavard
4982039086 Fix fontawesome not tree shaking properly 2020-01-28 16:37:44 +01:00
Paul Chavard
7ebebf2e80 Refactor leaflet code for better loading 2020-01-28 16:37:44 +01:00
Paul Chavard
a223eb05da Update javascript dependencies and add webpack-bundle-analyzer 2020-01-28 16:37:44 +01:00