Correct calculation of bofreq_responsible mailtrigger.Recipient to return no addresses for documents that are not of type bofreq. Commit ready for merge. Fixes #3358.

- Legacy-Id: 19255
This commit is contained in:
Robert Sparks 2021-07-21 22:38:15 +00:00
parent c01fea3920
commit 83f1b6229e

View file

@ -406,13 +406,14 @@ class Recipient(models.Model):
def gather_bofreq_responsible(self, **kwargs): def gather_bofreq_responsible(self, **kwargs):
addrs = [] addrs = []
if 'doc' in kwargs: if 'doc' in kwargs:
bofreq = kwargs['doc'] doc = kwargs['doc']
responsible = bofreq_responsible(bofreq) if doc.type_id=='bofreq':
if responsible: responsible = bofreq_responsible(doc)
addrs.extend([leader.email_address() for leader in responsible]) if responsible:
else: addrs.extend([leader.email_address() for leader in responsible])
addrs.extend(Recipient.objects.get(slug='iab').gather(**{})) else:
addrs.extend(Recipient.objects.get(slug='iesg').gather(**{})) addrs.extend(Recipient.objects.get(slug='iab').gather(**{}))
addrs.extend(Recipient.objects.get(slug='iesg').gather(**{}))
return addrs return addrs
def gather_bofreq_previous_responsible(self, **kwargs): def gather_bofreq_previous_responsible(self, **kwargs):