Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use correct group type in session request email response #5275

Merged
merged 5 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions ietf/secr/sreq/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


import datetime
import inflect
from collections import defaultdict, OrderedDict

from django.conf import settings
Expand Down Expand Up @@ -105,18 +106,29 @@ def get_lock_message(meeting=None):
meeting = get_meeting(days=14)
return meeting.session_request_lock_message

def get_requester_text(person,group):
'''
This function takes a Person object and a Group object and returns the text to use in the
session request notification email, ie. Joe Smith, a Chair of the ancp working group
'''
roles = group.role_set.filter(name__in=('chair','secr'),person=person)

def get_requester_text(person, group):
"""
This function takes a Person object and a Group object and returns the text to use
in the session request notification email, ie. Joe Smith, a Chair of the ancp
working group
"""
roles = group.role_set.filter(name__in=("chair", "secr", "ad"), person=person)
if roles:
return '%s, a %s of the %s working group' % (person.ascii, roles[0].name, group.acronym)
if group.parent and group.parent.role_set.filter(name='ad',person=person):
return '%s, a %s Area Director' % (person.ascii, group.parent.acronym.upper())
if person.role_set.filter(name='secr',group__acronym='secretariat'):
return '%s, on behalf of the %s working group' % (person.ascii, group.acronym)
rolename = str(roles[0].name)
return "%s, %s of the %s %s" % (
person.name,
inflect.engine().a(rolename),
group.acronym.upper(),
group.type.verbose_name,
)
if person.role_set.filter(name="secr", group__acronym="secretariat"):
return "%s, on behalf of the %s %s" % (
person.name,
group.acronym.upper(),
group.type.verbose_name,
)


def save_conflicts(group, meeting, conflicts, name):
'''
Expand Down
2 changes: 1 addition & 1 deletion ietf/secr/templates/sreq/session_request_notification.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load ams_filters %}

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

{% include "includes/session_info.txt" %}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ gunicorn>=20.1.0
hashids>=1.3.1
html2text>=2020.1.16 # Used only to clean comment field of secr/sreq
html5lib>=1.1 # Only used in tests
inflect>= 6.0.2
jsonfield>=3.1.0 # for SubmissionCheck. This is https://github.com/bradjasper/django-jsonfield/.
jwcrypto>=1.2 # for signed notifications - this is aspirational, and is not really used.
logging_tree>=1.9 # Used only by the showloggers management command
Expand Down