Skip to content

Commit 31352b0

Browse files
committed
Added Person.needs_consent() which returns a list of descriptions of fields for which consent is needed, or [].
- Legacy-Id: 15258
1 parent 35e16ef commit 31352b0

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

ietf/person/models.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,25 @@ def expired_drafts(self):
163163
from ietf.doc.models import Document
164164
return Document.objects.filter(documentauthor__person=self, type='draft', states__slug__in=['repl', 'expired', 'auth-rm', 'ietf-rm']).order_by('-time')
165165

166+
def needs_consent(self):
167+
"""
168+
Returns an empty list or a list of fields which holds information that
169+
requires consent to be given.
170+
"""
171+
needs_consent = []
172+
if self.name != self.name_from_draft:
173+
needs_consent.append("full name")
174+
if self.ascii != self.name_from_draft:
175+
needs_consent.append("ascii name")
176+
if self.biography and self.role_set.count():
177+
needs_consent.append("biography")
178+
if self.user and self.user.communitylist_set.exists():
179+
needs_consent.append("draft notification subscription(s)")
180+
for email in self.email_set.all():
181+
if not email.origin.split(':')[0] in ['author', 'role', 'reviewer', 'liaison', 'shepherd', ]:
182+
needs_consent.append("email address(es)")
183+
return needs_consent
184+
166185
def save(self, *args, **kwargs):
167186
created = not self.pk
168187
super(Person, self).save(*args, **kwargs)

0 commit comments

Comments
 (0)