Accepting an invitation gives the role to a user record looked up by email

Ouverte Adaptée aux débutants
#6,409 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
76/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
django, python

Piste de recherche

Lisez Invitation.accept dans contentcuration/contentcuration/models.py, autour des lignes 3701–3710, et suivez l’attribution du rôle à l’utilisateur sélectionné. Commencez par exécuter ou localiser les tests d’acceptation des invitations, puis ajoutez une couverture de régression pour les cas d’adresse e-mail en double et d’absence de compte actif. Le travail est terminé lorsque le compte actif dont l’adresse e-mail correspond exactement reçoit le rôle et qu’un compte actif manquant renvoie 400 sans modifier les éditeurs ni les spectateurs du canal.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

DEV: backend

Overview

Invitation.accept looks the invited user up again by email, case-insensitively, with no filter on active or deleted users and no ordering. When several user records share the email in different case, the role can go to an inactive or deleted record instead of the user who accepted. When an admin accepts an invitation for an email that has no account, accept adds None as an editor and the request fails with IntegrityError.

Complexity: Low
Target branch: hotfixes

Context
  • Invitation.accept starts with User.objects.filter(email__iexact=self.email).first().
  • Reproduced:
    • Active user [email protected] accepts an invitation. An older inactive record [email protected] becomes the channel editor, and the accepting user doesn't.
    • An admin accepts an invitation for an email with no account, and gets 500 with IntegrityError on a null user_id.
  • Related: #4779, #3050. #6406 backports the invitee-only accept check to hotfixes. #6405 depends on the same lookup on unstable.
The Change
  • Accepting should give the role to the active account whose email exactly matches the invitation's. #5893 lets admins accept on an invitee's behalf, so the accepting user isn't always the invitee.
  • Accepting an invitation with no matching active account should fail with a validation error and change nothing.
Acceptance Criteria
General
  • When other records share the invitee's email in a different case, the active account with the exact email gets the role and no other record does.
  • Accepting an invitation whose email has no active account returns 400 and leaves the channel's editors and viewers unchanged.
Testing
  • Both reproduced cases in Context have regression tests.

AI usage

I scoped the audit. Claude Code found and reproduced these failures and drafted this issue.

Langage dominant
Python
Étoiles
212
Forks
321
Merge moyen
1 j 7 h
PR mergées (30 j)
14

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de learningequality/studio

Toutes les issues de learningequality/studio

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.