From 16f9e0e974e6dc8b50b2794ac56ce9a53c2f0854 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Wed, 11 Oct 2023 12:09:10 -0400 Subject: [PATCH] fix: Adjust IRTF charter approval email headers (#5917) (#6460) --- ietf/doc/tests_charter.py | 15 ++++++++++- .../0003_ballot_approved_charter.py | 26 +++++++++++++++++++ ietf/name/fixtures/names.json | 2 +- ietf/templates/doc/charter/action_text.txt | 2 +- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 ietf/mailtrigger/migrations/0003_ballot_approved_charter.py diff --git a/ietf/doc/tests_charter.py b/ietf/doc/tests_charter.py index f65cf14e0..0350fc022 100644 --- a/ietf/doc/tests_charter.py +++ b/ietf/doc/tests_charter.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright The IETF Trust 2011-2020, All Rights Reserved +# Copyright The IETF Trust 2011-2023, All Rights Reserved import datetime @@ -817,6 +817,19 @@ class EditCharterTests(TestCase): self.assertEqual(group.groupmilestone_set.filter(state="active", desc=m1.desc).count(), 1) self.assertEqual(group.groupmilestone_set.filter(state="active", desc=m4.desc).count(), 1) + def test_approve_irtf(self): + charter = CharterFactory(group__type_id='rg') + url = urlreverse('ietf.doc.views_charter.approve', kwargs=dict(name=charter.name)) + login_testing_unauthorized(self, "secretary", url) + empty_outbox() + r = self.client.post(url, dict()) + self.assertEqual(r.status_code, 302) + self.assertEqual(len(outbox), 2) + self.assertTrue("IRTF" in outbox[1]['From']) + self.assertTrue("irtf-announce" in outbox[1]['To']) + self.assertTrue(charter.group.acronym in outbox[1]['Cc']) + self.assertTrue("RG Action" in outbox[1]['Subject']) + def test_charter_with_milestones(self): charter = CharterFactory() diff --git a/ietf/mailtrigger/migrations/0003_ballot_approved_charter.py b/ietf/mailtrigger/migrations/0003_ballot_approved_charter.py new file mode 100644 index 000000000..ef2e4dc44 --- /dev/null +++ b/ietf/mailtrigger/migrations/0003_ballot_approved_charter.py @@ -0,0 +1,26 @@ +# Copyright The IETF Trust 2023, All Rights Reserved + +from django.db import migrations + +def forward(apps, schema_editor): + MailTrigger = apps.get_model("mailtrigger", "MailTrigger") + Recipient = apps.get_model("mailtrigger", "Recipient") + mt = MailTrigger.objects.get(pk="ballot_approved_charter") + mt.to.remove(mt.to.first()) + mt.to.add(Recipient.objects.get(slug="group_stream_announce")) + +def reverse(apps, schema_editor): + MailTrigger = apps.get_model("mailtrigger", "MailTrigger") + Recipient = apps.get_model("mailtrigger", "Recipient") + mt = MailTrigger.objects.get(pk="ballot_approved_charter") + mt.to.remove(mt.to.first()) + mt.to.add(Recipient.objects.get(slug="ietf_announce")) + +class Migration(migrations.Migration): + dependencies = [ + ("mailtrigger", "0002_slidesubmitter"), + ] + + operations = [ + migrations.RunPython(forward, reverse) + ] diff --git a/ietf/name/fixtures/names.json b/ietf/name/fixtures/names.json index d4bdcd8f2..e71fe08a7 100644 --- a/ietf/name/fixtures/names.json +++ b/ietf/name/fixtures/names.json @@ -3770,7 +3770,7 @@ ], "desc": "Recipients when a charter is approved", "to": [ - "ietf_announce" + "group_stream_announce" ] }, "model": "mailtrigger.mailtrigger", diff --git a/ietf/templates/doc/charter/action_text.txt b/ietf/templates/doc/charter/action_text.txt index fbe9ed3fe..9a1e71522 100644 --- a/ietf/templates/doc/charter/action_text.txt +++ b/ietf/templates/doc/charter/action_text.txt @@ -1,4 +1,4 @@ -{% load ietf_filters %}{% autoescape off %}From: The IESG +{% load ietf_filters %}{% autoescape off %}From: {% if group.type_id == "rg" %}The IRTF {% else %}The IESG {% endif %} To: {{ to }}{% if cc %} Cc: {{ cc }} {% endif %} Subject: {{ group.type.name }} Action: {{ action_type }} {{ group.name }} ({{ group.acronym }})