Multiple emails for Discourse user #1

Closed
opened 2023-03-18 21:40:26 +00:00 by freezed · 7 comments

How Discourse manages multiple users email in this export?

6c79b9ac76/helloasso_to_discourse.py (L78)

How Discourse manages multiple users email in this export? https://git.afpy.org/AFPy/helloasso-to-discourse/src/commit/6c79b9ac7676400228e69372eb6606b755669933/helloasso_to_discourse.py#L78
Owner

It gives:

'email': '...', 'secondary_emails': [...],

Looks like you don't have a secondary email, by some kind of luck when I tried:

(Pdb) p users[0]

from the returned list of users, it gave me:

{'id': 108, 'username': 'freezed',

How likely it is that, out of 450 users, the first of the list is you?

Anyway, I changed the code a bit: 6c06f32d09

It also prints now:

$ helloasso-to-discourse sync https://discuss.afpy.org "$(pass discuss.afpy.org-api-key)" ./afpy adhesion-2023-a-l-afpy 114
Found 60 emails in HelloAsso
Found 507 emails in Discourse
Found 31 in common
31 Discourse users already have the badge 'Adhérent'

There's room for enhancement, but gotta sleep.

It gives: 'email': '...', 'secondary_emails': [...], Looks like you don't have a secondary email, by some kind of luck when I tried: (Pdb) p users[0] from the returned list of users, it gave me: {'id': 108, 'username': 'freezed', How likely it is that, out of 450 users, the first of the list is you? Anyway, I changed the code a bit: 6c06f32d09f0d7a218d07fb9f3f05464126b662c It also prints now: ``` $ helloasso-to-discourse sync https://discuss.afpy.org "$(pass discuss.afpy.org-api-key)" ./afpy adhesion-2023-a-l-afpy 114 Found 60 emails in HelloAsso Found 507 emails in Discourse Found 31 in common 31 Discourse users already have the badge 'Adhérent' ``` There's room for enhancement, but gotta sleep.
Author

Looks like you don't have a secondary email, by some kind of luck when I tried

Not yet, but I have at last 3 hello asso account, I was wondering what happend if I put all those in Discourse

How likely it is that, out of 450 users, the first of the list is you?

🤷 🙂

> Looks like you don't have a secondary email, by some kind of luck when I tried Not yet, but I have at last 3 _hello asso_ account, I was wondering what happend if I put all those in Discourse > How likely it is that, out of 450 users, the first of the list is you? 🤷 🙂
Owner

Not yet, but I have at last 3 hello asso account, I was wondering what happend if I put all those in Discourse

According to the code, no matter the number of emails Helloasso side and the number of emails Discourse side, as long as pairs matches, the linked account get assigned a badge.

But if you succeed in having multiple helloasso accounts with valid PyConFR registrations, each matching an distinct email alias Discourse side it can try to assign you the badge multiple times (once per matching email).

It may not go that bad as the badge can't be assigned twice (it's a per-badge discourse configuration).

But if Discourse gives a 4** HTTP error, the raise_for_status may just throw an unhandled exception.

I'd say "if it works, don't fix it" so as long as I don't hit the exeption, I won't "fix it".

> Not yet, but I have at last 3 hello asso account, I was wondering what happend if I put all those in Discourse According to [the code](https://git.afpy.org/AFPy/helloasso-to-discourse/src/commit/709c5b1d23a1333f91a56c4a24cc9fa9c4fb572a/helloasso_to_discourse.py#L158), no matter the number of emails Helloasso side and the number of emails Discourse side, as long as pairs matches, the linked account get assigned a badge. But if you succeed in having multiple helloasso accounts with valid PyConFR registrations, each matching an distinct email alias Discourse side it can try to assign you the badge multiple times (once per matching email). It may not go that bad as the badge can't be assigned twice (it's a per-badge discourse configuration). But if Discourse gives a 4** HTTP error, the `raise_for_status` may just throw an unhandled exception. I'd say "if it works, don't fix it" so as long as I don't hit the exeption, I won't "fix it".
Author

Sorry I didn’t dive into the code 🙁

I just update my Discourse account.
Now I had 3 email adresses used with HelloAsso.
Each adress has been used only for 1 event, no colision risks.

Sorry I didn’t dive into the code 🙁 I just update my Discourse account. Now I had 3 email adresses used with HelloAsso. Each adress has been used only for 1 event, no colision risks.
Owner
$ helloasso-to-discourse sync https://discuss.afpy.org "$(pass discuss.afpy.org-api-key)" ./afpy adhesion-2023-a-l-afpy membre
Found 62 emails in HelloAsso
Found 511 emails in Discourse
Found 32 in common
32 Discourse users already have the badge 'Membre'

$ helloasso-to-discourse sync https://discuss.afpy.org "$(pass discuss.afpy.org-api-key)" ./afpy pyconfr-2023 pyconfr-2023
Found 460 emails in HelloAsso
Found 511 emails in Discourse
Found 54 in common
54 Discourse users already have the badge 'PyConFR 2023'

Rien de nouveau à synchro, et pas de d'expception, tout semble bien aller avec tes mails.

À mon avis tu as déjà tes badges ...

... ah oui tu as déjà tes badges.

``` $ helloasso-to-discourse sync https://discuss.afpy.org "$(pass discuss.afpy.org-api-key)" ./afpy adhesion-2023-a-l-afpy membre Found 62 emails in HelloAsso Found 511 emails in Discourse Found 32 in common 32 Discourse users already have the badge 'Membre' $ helloasso-to-discourse sync https://discuss.afpy.org "$(pass discuss.afpy.org-api-key)" ./afpy pyconfr-2023 pyconfr-2023 Found 460 emails in HelloAsso Found 511 emails in Discourse Found 54 in common 54 Discourse users already have the badge 'PyConFR 2023' ``` Rien de nouveau à synchro, et pas de d'expception, tout semble bien aller avec tes mails. À mon avis tu as déjà tes badges ... ... ah oui [tu as déjà tes badges](https://discuss.afpy.org/u/freezed/badges).
Author

Pour info mon adhésion et PyConFr 2023 sont avec mon mail principal.
Les 2 autres mails sont pour les adhésions passée et PyConFr 2019.
Voilà, merci pour le boulot 👍

Pour info mon adhésion et PyConFr 2023 sont avec mon mail principal. Les 2 autres mails sont pour les adhésions passée et PyConFr 2019. Voilà, merci pour le boulot 👍
Owner

les adhésions passée

Pas de badge pour ça :(

PyConFr 2019

J'aimerai bien un badge pour ça, il me manque le design, ping @Melcore :)

> les adhésions passée Pas de badge pour ça :( > PyConFr 2019 J'aimerai bien un badge pour ça, il me manque le design, ping @Melcore :)
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: AFPy/helloasso-to-discourse#1
No description provided.