Reduce repetition in the templates by moving "add/delete" logic to
view. Fix up logic in templates, mailing list closing emails look correct (both approval and denial, with and without messages from the approver). - Legacy-Id: 210
This commit is contained in:
parent
4e426dec4c
commit
ac853962e2
|
@ -213,6 +213,10 @@ def list_req_wizard(request):
|
|||
|
||||
def list_approve(request, object_id):
|
||||
list = get_object_or_404(MailingList, mailing_list_id=object_id)
|
||||
if list.mail_type == 5 or list.mail_type == 6:
|
||||
req = 'delete'
|
||||
else:
|
||||
req = 'add'
|
||||
action = 'toapprove'
|
||||
email_to = None
|
||||
if request.method == 'POST':
|
||||
|
@ -222,7 +226,7 @@ def list_approve(request, object_id):
|
|||
list.add_comment = request.POST['add_comment']
|
||||
list.save()
|
||||
if list.mail_type == 6: # deletion of non-wg list
|
||||
for nonwg in NonWgMailingList.objects.filter(Q(list_url__iendswith=list.list_name) | Q(list_url__iendswith='%s@%s' % (list.list_name, list.list_domain))):
|
||||
for nonwg in NonWgMailingList.objects.filter(Q(list_url__iendswith=list.mlist_name) | Q(list_url__iendswith='%s@%s' % (list.mlist_name, list.domain_name))):
|
||||
nonwg.status = -1
|
||||
nonwg.save()
|
||||
email_to = 'ietf-action@ietf.org'
|
||||
|
@ -237,8 +241,8 @@ def list_approve(request, object_id):
|
|||
email_cc = None
|
||||
action = 'denied'
|
||||
if email_to is not None:
|
||||
send_mail_subj(request, email_to, ('Mailing List Request Tool', 'ietf-secretariat-reply@ietf.org'), 'mailinglists/list_subject.txt', 'mailinglists/list_email.txt', {'list': list, 'action': action}, email_cc)
|
||||
send_mail_subj(request, email_to, ('Mailing List Request Tool', 'ietf-secretariat-reply@ietf.org'), 'mailinglists/list_subject.txt', 'mailinglists/list_email.txt', {'list': list, 'action': action, 'req': req}, email_cc)
|
||||
# fall through
|
||||
form = ApprovalComment()
|
||||
return render_to_response('mailinglists/list_%s.html' % action, {'list': list, 'form': form},
|
||||
return render_to_response('mailinglists/list_%s.html' % action, {'list': list, 'form': form, 'req': req},
|
||||
context_instance=RequestContext(request) )
|
||||
|
|
|
@ -2,15 +2,12 @@ Dear list requestor,
|
|||
|
||||
{% filter wordwrap:"72" %}
|
||||
Your request to {% spaceless %}{% include "mailinglists/list_type_message2.txt" %}{% endspaceless %}
|
||||
has been {{ action }} by {{ list.auth_person }}, {{ list.auth_person.email }}.
|
||||
has been {{ action }} by {{ list.auth_person }}, {{ list.auth_person.email.1 }}.
|
||||
{% endfilter %}
|
||||
|
||||
{% ifequal action "approved" %}
|
||||
{% spaceless %}
|
||||
{# wish to not repeat myself here #}
|
||||
{% ifequal list.mail_type 5 %}
|
||||
The mailing list will be closed within two business days.
|
||||
{% else %}
|
||||
{% ifequal list.mail_type 6 %}
|
||||
{% ifequal req "delete" %}
|
||||
The mailing list will be closed within two business days.
|
||||
{% else %}
|
||||
Your list will be created and the archives will be tested.
|
||||
|
@ -20,18 +17,12 @@ For security reasons we suggest that you change this password.
|
|||
Please remember to forward this changed password to any other list
|
||||
admins.
|
||||
{% endifequal %}
|
||||
{% endifequal %}
|
||||
{% endspaceless %}
|
||||
|
||||
Requestor: {{ list.requestor }}
|
||||
|
||||
Requestor's email address: {{ list.requestor_email }}
|
||||
|
||||
Email list name: {{ list.mlist_name }}@{{ list.domain_name }}
|
||||
{% endifequal %}
|
||||
|
||||
{% include "mailinglists/list_summary.txt" %}
|
||||
|
||||
{% if list.add_comments %}
|
||||
Comments by {{ list.auth_person }}, {{ list.auth_person.email }}:
|
||||
{{ list.add_comments }}
|
||||
{% if list.add_comment %}
|
||||
Comments by {{ list.auth_person }}, {{ list.auth_person.email.1 }}:
|
||||
{{ list.add_comment }}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<tr><td colspan="2">Request to {{ list.get_mail_type_display }}</td></tr>
|
||||
<tr><td colspan="2">Request to {% filter escape %}{% include "mailinglists/list_type_message2.txt" %}{% endfilter %}</td></tr>
|
||||
<tr><td> Requestor: </td><td>{{ list.requestor|escape }}</td></tr>
|
||||
<tr><td> Requestor's email address: </td><td>{{ list.requestor_email|urlize }}</td></tr>
|
||||
<tr><td> Email list name: </td><td>{{ list.mlist_name }}@{{ list.domain_name }}</td></tr>
|
||||
{# probably here is where add/move vs. delete comes in? #}
|
||||
{% ifequal req "delete" %}
|
||||
<tr><td> Reason for closing list: </td><td>{{ list.reason_to_delete|escape|linebreaksbr }}</td></tr>
|
||||
{% else %}
|
||||
<tr><td> Short description of the email list: </td><td>{{ list.short_desc|escape }}</td></tr>
|
||||
<tr><td> Long description of the email list: </td><td>{{ list.long_desc|escape }}</td></tr>
|
||||
<tr><td> Administrator(s): </td><td><pre>{{ list.admins|escape }}</pre></td></tr>
|
||||
|
@ -14,3 +16,4 @@
|
|||
<tr><td> Administrator approval required for posts: </td><td>{{ list.post_admin|yesno:"YES,NO" }}</td></tr>
|
||||
<tr><td> Private Archive: </td><td>{{ list.archive_private|yesno:"YES,NO" }}</td></tr>
|
||||
<tr><td> Specific information about how to access and move the exiting archive from a remote location (optional): </td><td>{{ list.archive_remote }}</td></tr>
|
||||
{% endifequal %}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{% spaceless %}
|
||||
{# wish to not repeat myself here #}
|
||||
{% ifequal list.mail_type 5 %}
|
||||
Reason for closing list: {{ list.reason_to_delete }}
|
||||
{% else %}
|
||||
{% ifequal list.mail_type 6 %}
|
||||
Requestor: {{ list.requestor }}
|
||||
|
||||
Requestor's email address: {{ list.requestor_email }}
|
||||
|
||||
Email list name: {{ list.mlist_name }}@{{ list.domain_name }}
|
||||
|
||||
{% ifequal req "delete" %}
|
||||
Reason for closing list: {{ list.reason_to_delete }}
|
||||
{% else %}
|
||||
Short description of the email list: {{ list.short_desc }}
|
||||
|
@ -33,5 +34,3 @@ Specific information about how to access and move the existing archive from a re
|
|||
{{ list.archive_remote }}
|
||||
|
||||
{% endifequal %}
|
||||
{% endifequal %}
|
||||
{% endspaceless %}
|
||||
|
|
Loading…
Reference in a new issue