Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enregistrer le dernier evenement connu pour une adresse mail #894

Conversation

vincentporte
Copy link
Contributor

@vincentporte vincentporte commented Jan 27, 2025

Description

🎸 Creer ou mettre à jour EmailLastSeen lors des évènements suivants :

  • navigation d'un utilisateur authentifié : dans un middleware dedié
  • creation d'un Post/Topic : dans la méthode save du modèle Post
  • click sur une notification email : dans le middleware NotificationMiddleware de suivi des urls dans les mails de notification

Type de changement

🎢 Nouvelle fonctionnalité (changement non cassant qui ajoute une fonctionnalité).
🚧 technique

Points d'attention

🦺 Les mises à jour de Post ne déclenche plus de mise à jour de EmailLastSeen pour éviter la détérioration de données en cas de save massif sur des instances existantes du modèle Post
🦺 Creation d'un DSP, d'un UpVote ou d'un Event, les vues sont en LoginRequiredOnly. L'enregistrement du passage de l'utilisateur est donc déjà enregistré par MarkAsSeenLoggedUserMiddleware
🦺 prérequis #891 et #892

@vincentporte vincentporte linked an issue Jan 27, 2025 that may be closed by this pull request
7 tasks
@vincentporte vincentporte self-assigned this Jan 27, 2025
@vincentporte vincentporte added the python Pull requests that update Python code label Jan 27, 2025
@vincentporte vincentporte changed the base branch from master to 889-archivage---creation-de-la-table January 27, 2025 15:54
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from 129a1a5 to 11310f7 Compare January 27, 2025 17:11
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from 11310f7 to 125aaaf Compare January 28, 2025 09:57
@vincentporte vincentporte force-pushed the 889-archivage---creation-de-la-table branch from 0893173 to 0532166 Compare January 28, 2025 16:45
Copy link

@tonial tonial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je suis en phase avec @francoisfreitag sur l'utilisation du save : c'est risqué parce qu'on risque d'appeler EmailLastSeen à des moment où on ne le voudrait pas (action manuelle dans l'admin, migration, etc)

Copy link

@tonial tonial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je suis en phase avec le commentaire de @francoisfreitag, appeler EmailLastSeen dans les save() des modèles va fausser les données utilisée pour déclencher l'anonymisation :)

Copy link

@tonial tonial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je suis en phase avec le commentaire de @francoisfreitag, appeler EmailLastSeen dans les save() des modèles va fausser les données utilisée pour déclencher l'anonymisation :)

@vincentporte vincentporte force-pushed the 889-archivage---creation-de-la-table branch 3 times, most recently from 76f886e to 87d52be Compare February 5, 2025 13:07
Base automatically changed from 889-archivage---creation-de-la-table to master February 6, 2025 08:12
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from ddb0b57 to 240ffe1 Compare February 6, 2025 09:56
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from 240ffe1 to c5387b7 Compare February 6, 2025 18:00
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from 0a69446 to c3cbf23 Compare February 10, 2025 10:52
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from c3cbf23 to 5705efa Compare February 10, 2025 14:30
@vincentporte vincentporte marked this pull request as ready for review February 10, 2025 14:49
vincentporte added a commit that referenced this pull request Feb 11, 2025
## Description

🎸 `EmailLastSeenKind` contient des valeurs qui ne seront pas utilisées.
Ces valeurs sont celles d'actions réservées aux utilisateurs connectés.
Elles seront donc déjà enregistrées via le type `Logged` avec le mise en
place du middleware `MarkAsSeenLoggedUserMiddleware` de #894

## Type de changement

🚧 technique

### Points d'attention

🦺 Issue #888
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from 5705efa to 37aa773 Compare February 11, 2025 10:16
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from 37aa773 to 9a3efca Compare February 11, 2025 14:35
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from 9a3efca to 7c972f3 Compare February 11, 2025 16:39
@vincentporte vincentporte force-pushed the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch from 7c972f3 to 6bd0e7d Compare February 11, 2025 17:07
@vincentporte vincentporte merged commit 9aa316c into master Feb 12, 2025
8 checks passed
@vincentporte vincentporte deleted the 893-enregistrer-le-dernier-evenement-pour-un-email-dans-emaillastseen branch February 12, 2025 10:50
vincentporte added a commit that referenced this pull request Feb 12, 2025
…rtir des évènements passés (#896)

## Description

🎸 Collecter les `User.last_login`, `Event`, `DSP`, `UpVote`,
`ForumRating`, `Post` anonymes et authentifiés, `Notification` visitées
(#891)
🎸 dédupliquer les emails en gardant l'evènement le plus récent
🎸 ignorer les emails déjà enregistrés dans `EmailLastSeen`, en
considerant que l'enregistrement dans `EmailLastSeen` est le plus récent
🎸 Insérer l'ensemble dans `EmailLastSeen`

## Type de changement

🚧 technique

### Points d'attention

🦺 `test_collect_clicked_notifs` casse par principe en attendant #891 
🦺 prérequis #892 & #894 

### simulation sur données du 27 janvier 2025

```
$ python manage.py populate_emaillastseen
INFO 2025-02-11 11:20:09,215 ./lacommunaute/users/management/commands/populate_emaillastseen.py : starting to populate EmailLastSeen table
INFO 2025-02-11 11:20:09,215 ./lacommunaute/users/management/commands/populate_emaillastseen.py : processing users
INFO 2025-02-11 11:20:09,493 ./lacommunaute/users/management/commands/populate_emaillastseen.py : will process 19353 emails
INFO 2025-02-11 11:20:09,577 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 18353
INFO 2025-02-11 11:20:09,693 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 17353
INFO 2025-02-11 11:20:09,777 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 16353
INFO 2025-02-11 11:20:09,862 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 15353
INFO 2025-02-11 11:20:09,947 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 14353
INFO 2025-02-11 11:20:10,095 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 13353
INFO 2025-02-11 11:20:10,454 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 12353
INFO 2025-02-11 11:20:10,739 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 11353
INFO 2025-02-11 11:20:10,838 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 10353
INFO 2025-02-11 11:20:10,975 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 9353
INFO 2025-02-11 11:20:11,075 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 8353
INFO 2025-02-11 11:20:11,172 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 7353
INFO 2025-02-11 11:20:11,271 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 6353
INFO 2025-02-11 11:20:11,369 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 5353
INFO 2025-02-11 11:20:11,464 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 4353
INFO 2025-02-11 11:20:11,553 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 3353
INFO 2025-02-11 11:20:11,647 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 2353
INFO 2025-02-11 11:20:11,743 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 1353
INFO 2025-02-11 11:20:11,873 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 353
INFO 2025-02-11 11:20:11,912 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 0
INFO 2025-02-11 11:20:11,912 ./lacommunaute/users/management/commands/populate_emaillastseen.py : processing events
INFO 2025-02-11 11:20:11,921 ./lacommunaute/users/management/commands/populate_emaillastseen.py : will process 309 emails
INFO 2025-02-11 11:20:11,937 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 0
INFO 2025-02-11 11:20:11,937 ./lacommunaute/users/management/commands/populate_emaillastseen.py : processing DSP
INFO 2025-02-11 11:20:11,994 ./lacommunaute/users/management/commands/populate_emaillastseen.py : will process 3087 emails
INFO 2025-02-11 11:20:12,085 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 2087
INFO 2025-02-11 11:20:12,179 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 1087
INFO 2025-02-11 11:20:12,278 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 87
INFO 2025-02-11 11:20:12,298 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 0
INFO 2025-02-11 11:20:12,298 ./lacommunaute/users/management/commands/populate_emaillastseen.py : processing upvotes
INFO 2025-02-11 11:20:12,319 ./lacommunaute/users/management/commands/populate_emaillastseen.py : will process 837 emails
INFO 2025-02-11 11:20:12,367 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 0
INFO 2025-02-11 11:20:12,367 ./lacommunaute/users/management/commands/populate_emaillastseen.py : processing forum ratings
INFO 2025-02-11 11:20:12,380 ./lacommunaute/users/management/commands/populate_emaillastseen.py : will process 236 emails
INFO 2025-02-11 11:20:12,409 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 0
INFO 2025-02-11 11:20:12,409 ./lacommunaute/users/management/commands/populate_emaillastseen.py : processing posts
INFO 2025-02-11 11:20:12,562 ./lacommunaute/users/management/commands/populate_emaillastseen.py : will process 4777 emails
INFO 2025-02-11 11:20:12,654 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 3777
INFO 2025-02-11 11:20:12,741 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 2777
INFO 2025-02-11 11:20:12,880 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 1777
INFO 2025-02-11 11:20:13,019 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 777
INFO 2025-02-11 11:20:13,077 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 0
INFO 2025-02-11 11:20:13,077 ./lacommunaute/users/management/commands/populate_emaillastseen.py : processing clicked notifications
INFO 2025-02-11 11:20:13,082 ./lacommunaute/users/management/commands/populate_emaillastseen.py : will process 82 emails
INFO 2025-02-11 11:20:13,100 ./lacommunaute/users/management/commands/populate_emaillastseen.py : remaining: 0
INFO 2025-02-11 11:20:13,100 ./lacommunaute/users/management/commands/populate_emaillastseen.py : that's all folks!
```
vincentporte pushed a commit that referenced this pull request Feb 13, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.21.0](v2.20.0...v2.21.0)
(2025-02-13)


### Features

* creation de la table de suivi RGPD
([#892](#892))
([dfc378a](dfc378a))
* enregistrer le dernier evenement connu pour une adresse mail
([#894](#894))
([9aa316c](9aa316c))
* extension des droits des utilisateurs de l'équipe - Documentation et
Partenaires
([#914](#914))
([95bea05](95bea05))
* extension des droits des utilisateurs de l'équipe
([#913](#913))
([d5add12](d5add12))
* hydrater la table du dernier évènement connu pour un email à partir
des évènements passés
([#896](#896))
([28c4cb2](28c4cb2))
* masquer le filtre sur les reponses certifiees
([a648647](a648647))
* masquer le filtre sur les reponses certifiees
([#908](#908))
([84e9a42](84e9a42))
* **notification:** enregistrer les retours sur les notifs mails
([#891](#891))
([ec67205](ec67205))
* remplacer un nom de domaine expiré dans les données utilisateurs
([#907](#907))
([fb886e1](fb886e1))
* **search:** ajout de liens de recherche vers le site des emplois
([#879](#879))
([c6ac2a3](c6ac2a3))
* supprimer les traces d'envoi d'emails de plus de 90 jours
([#902](#902))
([8abf9ef](8abf9ef))


### Bug Fixes

* suppression de type dans `EmailLastSeen`
([#905](#905))
([a21b502](a21b502))
* televersement des fichiers en erreur
([#899](#899))
([d9951e1](d9951e1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
vincentporte pushed a commit that referenced this pull request Feb 13, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.21.0](v2.20.0...v2.21.0)
(2025-02-13)


### Features

* creation de la table de suivi RGPD
([#892](#892))
([dfc378a](dfc378a))
* enregistrer le dernier evenement connu pour une adresse mail
([#894](#894))
([9aa316c](9aa316c))
* extension des droits des utilisateurs de l'équipe - Documentation et
Partenaires
([#914](#914))
([95bea05](95bea05))
* extension des droits des utilisateurs de l'équipe
([#913](#913))
([d5add12](d5add12))
* hydrater la table du dernier évènement connu pour un email à partir
des évènements passés
([#896](#896))
([28c4cb2](28c4cb2))
* masquer le filtre sur les reponses certifiees
([a648647](a648647))
* masquer le filtre sur les reponses certifiees
([#908](#908))
([84e9a42](84e9a42))
* **notification:** enregistrer les retours sur les notifs mails
([#891](#891))
([ec67205](ec67205))
* remplacer un nom de domaine expiré dans les données utilisateurs
([#907](#907))
([fb886e1](fb886e1))
* **search:** ajout de liens de recherche vers le site des emplois
([#879](#879))
([c6ac2a3](c6ac2a3))
* supprimer les traces d'envoi d'emails de plus de 90 jours
([#902](#902))
([8abf9ef](8abf9ef))


### Bug Fixes

* suppression de type dans `EmailLastSeen`
([#905](#905))
([a21b502](a21b502))
* televersement des fichiers en erreur
([#899](#899))
([d9951e1](d9951e1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Archivage - Enregistrer le dernier evenement pour un email dans EmailLastSeen
3 participants