Skip to content

Commit 75f7035

Browse files
committed
Tweaked the Person.needs_consent() method to take historic roles into account and to handle records without associated usesrs.
- Legacy-Id: 15459
1 parent 2aefd51 commit 75f7035

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

ietf/person/models.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from django.conf import settings
1313

1414
from django.core.validators import validate_email
15+
from django.core.exceptions import ObjectDoesNotExist
1516
from django.db import models
1617
from django.contrib.auth.models import User
1718
from django.template.loader import render_to_string
@@ -173,10 +174,15 @@ def needs_consent(self):
173174
needs_consent.append("full name")
174175
if self.ascii != self.name_from_draft:
175176
needs_consent.append("ascii name")
176-
if self.biography and self.role_set.count():
177+
if self.biography and not (self.role_set.exists() or self.rolehistory_set.exists()):
177178
needs_consent.append("biography")
178-
if self.user and self.user.communitylist_set.exists():
179-
needs_consent.append("draft notification subscription(s)")
179+
if self.user_id:
180+
needs_consent.append("login")
181+
try:
182+
if self.user.communitylist_set.exists():
183+
needs_consent.append("draft notification subscription(s)")
184+
except ObjectDoesNotExist:
185+
pass
180186
for email in self.email_set.all():
181187
if not email.origin.split(':')[0] in ['author', 'role', 'reviewer', 'liaison', 'shepherd', ]:
182188
needs_consent.append("email address(es)")

0 commit comments

Comments
 (0)