From 93b4d6fcc41bcc290edaadfcce99dec16a721195 Mon Sep 17 00:00:00 2001 From: Jim Fenton Date: Sat, 20 Jul 2019 19:47:32 +0000 Subject: [PATCH] Added Closing Notes to history and about pages for groups. Fixes issue #2725. Commit ready for merge. - Legacy-Id: 16559 --- ietf/group/forms.py | 4 ++- ietf/group/views.py | 38 +++++++++++++++++++++++++++ ietf/templates/group/group_about.html | 5 ++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/ietf/group/forms.py b/ietf/group/forms.py index 50c56baa2..0dbb0ea96 100644 --- a/ietf/group/forms.py +++ b/ietf/group/forms.py @@ -57,7 +57,8 @@ class StatusUpdateForm(forms.Form): raise forms.ValidationError("NULL TXT file input is not a valid option") class ConcludeGroupForm(forms.Form): - instructions = forms.CharField(widget=forms.Textarea(attrs={'rows': 30}), required=True, strip=False) + instructions = forms.CharField(widget=forms.Textarea(attrs={'rows': 15}), required=True, strip=False) + closing_note = forms.CharField(widget=forms.Textarea(attrs={'rows': 5}), label='Closing note, for WG history (optional)', required=False, strip=False) class GroupForm(forms.Form): name = forms.CharField(max_length=80, label="Name", required=True) @@ -78,6 +79,7 @@ class GroupForm(forms.Form): list_subscribe = forms.CharField(max_length=255, required=False) list_archive = forms.CharField(max_length=255, required=False) urls = forms.CharField(widget=forms.Textarea, label="Additional URLs", help_text="Format: https://site/path (Optional description). Separate multiple entries with newline. Prefer HTTPS URLs where possible.", required=False) + closing_note = forms.CharField(widget=forms.Textarea, label="Closing note", required=False) def __init__(self, *args, **kwargs): self.group = kwargs.pop('group', None) diff --git a/ietf/group/views.py b/ietf/group/views.py index 7844c74d2..849a84694 100644 --- a/ietf/group/views.py +++ b/ietf/group/views.py @@ -523,6 +523,10 @@ def group_about(request, acronym, group_type=None): e = group.latest_event(type__in=("changed_state", "requested_close",)) requested_close = group.state_id != "conclude" and e and e.type == "requested_close" + e = None + if group.state_id == "conclude": + e = group.latest_event(type='closing_note') + can_manage = can_manage_group_type(request.user, group) charter_submit_url = "" if group.features.has_chartering_process: @@ -542,6 +546,7 @@ def group_about(request, acronym, group_type=None): "status_update": status_update, "charter_submit_url": charter_submit_url, "editable_roles": roles_for_group_type(group_type), + "closing_note": e, })) def all_status(request): @@ -1000,6 +1005,22 @@ def edit(request, group_type=None, acronym=None, action="edit", field=None): group.save() + #Handle changes to Closing Note, if any. It's an event, not a group attribute like the others + closing_note = "" + e = group.latest_event(type='closing_note') + if e: + closing_note = e.desc + + if closing_note != clean["closing_note"]: + closing_note = clean["closing_note"] + e = GroupEvent(group=group, by=request.user.person) + e.type = "closing_note" + if closing_note == "": + e.desc = "(Closing note deleted)" #Flag value so something shows up in history + else: + e.desc = closing_note + e.save() + if action=="charter": return redirect('ietf.doc.views_charter.submit', name=charter_name_for_group(group), option="initcharter") @@ -1007,6 +1028,13 @@ def edit(request, group_type=None, acronym=None, action="edit", field=None): else: # Not POST: if not new_group: ad_role = group.ad_role() + closing_note = "" + e = group.latest_event(type='closing_note') + if e: + closing_note = e.desc + if closing_note == "(Closing note deleted)": + closing_note = "" + init = dict(name=group.name, acronym=group.acronym, state=group.state, @@ -1016,6 +1044,7 @@ def edit(request, group_type=None, acronym=None, action="edit", field=None): list_subscribe=group.list_subscribe if group.list_subscribe else None, list_archive=group.list_archive if group.list_archive else None, urls=format_urls(group.groupurl_set.all()), + closing_note = closing_note, ) for slug in roles_for_group_type(group_type): @@ -1042,7 +1071,10 @@ def conclude(request, acronym, group_type=None): form = ConcludeGroupForm(request.POST) if form.is_valid(): instructions = form.cleaned_data['instructions'] + closing_note = form.cleaned_data['closing_note'] + if closing_note != "": + instructions = instructions+"\n\n=====\nClosing note:\n\n"+closing_note email_admin_re_charter(request, group, "Request closing of group", instructions, 'group_closure_requested') e = GroupEvent(group=group, by=request.user.person) @@ -1050,6 +1082,12 @@ def conclude(request, acronym, group_type=None): e.desc = "Requested closing group" e.save() + if closing_note != "": + e = GroupEvent(group=group, by=request.user.person) + e.type = "closing_note" + e.desc = closing_note + e.save() + kwargs = {'acronym':group.acronym} if group_type: kwargs['group_type'] = group_type diff --git a/ietf/templates/group/group_about.html b/ietf/templates/group/group_about.html index aae865416..236e8d342 100644 --- a/ietf/templates/group/group_about.html +++ b/ietf/templates/group/group_about.html @@ -221,6 +221,11 @@ {% endif %} + {% if closing_note and closing_note.desc != "(Closing note deleted)" %} +

Closing note for {{ group.type.desc.title }}

+ {{ closing_note.desc }} + {% endif %} + {% if group.features.has_chartering_process %}

Charter for {% if group.state_id == "proposed" %}proposed{% endif %} {{ group.type.desc.title }}

{# the linebreaks filter adds

, no surrounding

necessary: #}