Skip to content

Commit 98c24d1

Browse files
authored
fix: Use correct group type in session request email response (ietf-tools#5275)
* fix: Use correct group type in session request email response Fixes ietf-tools#2120 * Address review comments * Address review comments
1 parent ddcfb09 commit 98c24d1

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

ietf/secr/sreq/views.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
import datetime
6+
import inflect
67
from collections import defaultdict, OrderedDict
78

89
from django.conf import settings
@@ -105,18 +106,29 @@ def get_lock_message(meeting=None):
105106
meeting = get_meeting(days=14)
106107
return meeting.session_request_lock_message
107108

108-
def get_requester_text(person,group):
109-
'''
110-
This function takes a Person object and a Group object and returns the text to use in the
111-
session request notification email, ie. Joe Smith, a Chair of the ancp working group
112-
'''
113-
roles = group.role_set.filter(name__in=('chair','secr'),person=person)
109+
110+
def get_requester_text(person, group):
111+
"""
112+
This function takes a Person object and a Group object and returns the text to use
113+
in the session request notification email, ie. Joe Smith, a Chair of the ancp
114+
working group
115+
"""
116+
roles = group.role_set.filter(name__in=("chair", "secr", "ad"), person=person)
114117
if roles:
115-
return '%s, a %s of the %s working group' % (person.ascii, roles[0].name, group.acronym)
116-
if group.parent and group.parent.role_set.filter(name='ad',person=person):
117-
return '%s, a %s Area Director' % (person.ascii, group.parent.acronym.upper())
118-
if person.role_set.filter(name='secr',group__acronym='secretariat'):
119-
return '%s, on behalf of the %s working group' % (person.ascii, group.acronym)
118+
rolename = str(roles[0].name)
119+
return "%s, %s of the %s %s" % (
120+
person.name,
121+
inflect.engine().a(rolename),
122+
group.acronym.upper(),
123+
group.type.verbose_name,
124+
)
125+
if person.role_set.filter(name="secr", group__acronym="secretariat"):
126+
return "%s, on behalf of the %s %s" % (
127+
person.name,
128+
group.acronym.upper(),
129+
group.type.verbose_name,
130+
)
131+
120132

121133
def save_conflicts(group, meeting, conflicts, name):
122134
'''
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% load ams_filters %}
22

3-
{{ header }} meeting session request has just been submitted by {{ requester }}.
3+
{% filter wordwrap:78 %}{{ header }} meeting session request has just been submitted by {{ requester }}.{% endfilter %}
44

55
{% include "includes/session_info.txt" %}

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ gunicorn>=20.1.0
3535
hashids>=1.3.1
3636
html2text>=2020.1.16 # Used only to clean comment field of secr/sreq
3737
html5lib>=1.1 # Only used in tests
38+
inflect>= 6.0.2
3839
jsonfield>=3.1.0 # for SubmissionCheck. This is https://github.com/bradjasper/django-jsonfield/.
3940
jwcrypto>=1.2 # for signed notifications - this is aspirational, and is not really used.
4041
logging_tree>=1.9 # Used only by the showloggers management command

0 commit comments

Comments
 (0)