Skip to content

Commit 71d797b

Browse files
committed
Refines Joel's fix to show clearly who receives draft submission confirmation emails, to show a more detailed warning text when the submitter isn't in the addressee list. Fixes issue ietf-tools#1097.
- Legacy-Id: 6659
1 parent 89904c9 commit 71d797b

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

ietf/submit/views.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from django.shortcuts import get_object_or_404
99
from django.shortcuts import render_to_response
1010
from django.template import RequestContext
11+
from django.utils.text import get_text_list
12+
from django.utils.html import escape
1113

1214
from ietf.group.models import Group
1315
from ietf.utils.mail import send_mail
@@ -18,6 +20,8 @@
1820
from ietf.submit.utils import is_secretariat, get_approvable_submissions, get_preapprovals, get_recently_approved, get_person_for_user, perform_post, remove_docs, request_full_url
1921
from ietf.submit.utils import DraftValidation
2022

23+
import debug
24+
2125
def submit_index(request):
2226
if request.method == 'POST':
2327
try:
@@ -112,6 +116,18 @@ def draft_status(request, submission_id, submission_hash=None, message=None):
112116
else:
113117
replaces = None
114118

119+
def get_submitter(details):
120+
submitter = details.tempidauthors_set.filter(author_order=0)
121+
if submitter:
122+
return submitter[0]
123+
elif details.submitter_tag:
124+
try:
125+
return PersonOrOrgInfo.objects.get(pk=details.submitter_tag)
126+
except PersonOrOrgInfo.DoesNotExist:
127+
return False
128+
return None
129+
130+
115131
if request.method == 'POST' and allow_edit:
116132
if request.POST.get('autopost', False):
117133
auto_post_form = AutoPostForm(draft=detail, validation=validation, replaces=replaces, data=request.POST)
@@ -138,14 +154,29 @@ def draft_status(request, submission_id, submission_hash=None, message=None):
138154
else:
139155
auto_post_form.save(request)
140156
detail = get_object_or_404(IdSubmissionDetail, submission_id=submission_id)
157+
submitter = get_submitter(detail)
141158
validation = DraftValidation(detail)
142159
is_valid = validation.is_valid()
143160
status = detail.status
144161
can_force_post = _can_force_post(request.user, detail)
145162
can_approve = _can_approve(request.user, detail)
146163
can_cancel = _can_cancel(request.user, detail, submission_hash)
147164
allow_edit = None
148-
message = ('success', 'Your submission is pending email authentication. An email has been sent to %s with instructions.'%', '.join(detail.confirmation_email_list()))
165+
confirmation_email_addresses = get_text_list(detail.confirmation_email_list(), "and")
166+
submitter_email_address = "<%s>" % submitter.email_address
167+
if submitter_email_address in confirmation_email_addresses:
168+
message = ('success', 'Your submission is pending email authentication. An email has been sent to %s with instructions.' % escape(confirmation_email_addresses) )
169+
else:
170+
message = ('warning',
171+
"""Your submission is pending email authentication. An email has been sent to %s with instructions.
172+
<br/><br/>
173+
Please note that since the database does not have your email address in the list of authors of previous
174+
revisions of the document, you are <b>not</b> receiving a confirmation email yourself; one of the
175+
addressees above will have to send a confirmation in order to complete the submission. This is done
176+
to avoid document hijacking. If none of the known previous authors will be able to confirm the
177+
submission, please contact <a href="mailto:ietf-action@ietf.org">the secretariat</a> for action.
178+
""" % escape(confirmation_email_addresses) )
179+
149180
else:
150181
submission_hash = detail.get_hash()
151182
if submission_hash:

ietf/templates/submit/draft_status.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{{ block.super }}
77
div.metadata-errors { border: 1px solid red; background-color: #ffeebb; padding: 5px 10px; margin: 1em 0px; }
88
div.info-message-error { border: 1px solid red; background-color: #ffeebb; padding: 5px 10px; margin: 1em 0px; color: red; }
9+
div.info-message-warning { border: 1px solid orange; background-color: #ffffaa; padding: 5px 10px; margin: 1em 0px; color: black; }
910
div.info-message-success { border: 1px solid green; background-color: #eeffbb; padding: 5px 10px; margin: 1em 0px; color: green; }
1011
table.metadata-table th { white-space: nowrap; font-weight: bold; }
1112
table.metadata-table #id_first_name, table.metadata-table #id_last_name { width: 200px; }
@@ -82,7 +83,7 @@ <h2>Status of the submission: {{ status.status_value }}</h2>
8283
{% endif %}
8384

8485
{% if message %}
85-
<div class="info-message-{{ message.0 }}">{{ message.1 }}</div>
86+
<div class="info-message-{{ message.0 }}">{{ message.1|safe }}</div>
8687
{% endif %}
8788

8889
{% if auto_post_form.errors %}

0 commit comments

Comments
 (0)