Include from in the list of messages when completing a review and
searching for the review email, redo layout somewhat to accommodate this and improve the presentation of the message date. - Legacy-Id: 12163
This commit is contained in:
parent
4450ff192c
commit
e11a911d86
|
@ -397,7 +397,7 @@ class ReviewTests(TestCase):
|
|||
|
||||
# plain text
|
||||
msg = email.mime.text.MIMEText("Hello,\n\nI have reviewed the document and did not find any problems.\n\nJohn Doe")
|
||||
msg["From"] = "johndoe@example.com"
|
||||
msg["From"] = "John Doe <johndoe@example.com>"
|
||||
msg["To"] = review_req.team.list_email
|
||||
msg["Subject"] = "Review of {}-01".format(review_req.doc.name)
|
||||
msg["Message-ID"] = email.utils.make_msgid()
|
||||
|
@ -408,7 +408,7 @@ class ReviewTests(TestCase):
|
|||
|
||||
# plain text + HTML
|
||||
msg = email.mime.multipart.MIMEMultipart('alternative')
|
||||
msg["From"] = "johndoe2@example.com"
|
||||
msg["From"] = "John Doe II <johndoe2@example.com>"
|
||||
msg["To"] = review_req.team.list_email
|
||||
msg["Subject"] = "Review of {}".format(review_req.doc.name)
|
||||
msg["Message-ID"] = email.utils.make_msgid()
|
||||
|
@ -453,14 +453,20 @@ class ReviewTests(TestCase):
|
|||
messages = json.loads(r.content)["messages"]
|
||||
self.assertEqual(len(messages), 2)
|
||||
|
||||
today = datetime.date.today()
|
||||
|
||||
self.assertEqual(messages[0]["url"], "https://www.example.com/testmessage")
|
||||
self.assertTrue("John Doe" in messages[0]["content"])
|
||||
self.assertEqual(messages[0]["subject"], "Review of {}-01".format(review_req.doc.name))
|
||||
self.assertEqual(messages[0]["splitfrom"], ["John Doe", "johndoe@example.com"])
|
||||
self.assertEqual(messages[0]["utcdate"][0], today.isoformat())
|
||||
|
||||
self.assertEqual(messages[1]["url"], "https://www.example.com/testmessage2")
|
||||
self.assertTrue("Looks OK" in messages[1]["content"])
|
||||
self.assertTrue("<html>" not in messages[1]["content"])
|
||||
self.assertEqual(messages[1]["subject"], "Review of {}".format(review_req.doc.name))
|
||||
self.assertEqual(messages[1]["splitfrom"], ["John Doe II", "johndoe2@example.com"])
|
||||
self.assertEqual(messages[1]["utcdate"][0], "")
|
||||
finally:
|
||||
ietf.review.mailarch.construct_query_urls = real_fn
|
||||
|
||||
|
|
|
@ -66,13 +66,21 @@ def retrieve_messages_from_mbox(mbox_fileobj):
|
|||
charset = part.get_content_charset() or "utf-8"
|
||||
content += part.get_payload(decode=True).decode(charset, "ignore")
|
||||
|
||||
# parse a couple of things for the front end
|
||||
utcdate = None
|
||||
d = email.utils.parsedate_tz(msg["Date"])
|
||||
if d:
|
||||
utcdate = datetime.datetime.fromtimestamp(email.utils.mktime_tz(d))
|
||||
|
||||
res.append({
|
||||
"from": msg["From"],
|
||||
"splitfrom": email.utils.parseaddr(msg["From"]),
|
||||
"subject": msg["Subject"],
|
||||
"content": content.replace("\r\n", "\n").replace("\r", "\n").strip("\n"),
|
||||
"message_id": email.utils.unquote(msg["Message-ID"]),
|
||||
"url": email.utils.unquote(msg["Archived-At"]),
|
||||
"date": msg["Date"],
|
||||
"utcdate": (utcdate.date().isoformat(), utcdate.time().isoformat()) if utcdate else ("", ""),
|
||||
})
|
||||
|
||||
return res
|
||||
|
|
|
@ -487,6 +487,16 @@ form.complete-review .mail-archive-search .results .list-group {
|
|||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
form.complete-review .mail-archive-search-result .from {
|
||||
width: 9em;
|
||||
padding-left: 0.4em;
|
||||
}
|
||||
|
||||
form.complete-review .mail-archive-search-result .date {
|
||||
width: 6em;
|
||||
padding-left: 0.4em;
|
||||
}
|
||||
|
||||
.closed-review-filter {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,8 @@ $(document).ready(function () {
|
|||
var msg = data.messages[i];
|
||||
var row = $(mailArchiveSearchResultTemplate).attr("title", "Click to fill in link and content from this message");
|
||||
row.find(".subject").text(msg.subject);
|
||||
row.find(".date").text(msg.date);
|
||||
row.find(".date").text(msg.utcdate[0]);
|
||||
row.find(".from").text(msg.splitfrom[0]);
|
||||
row.data("url", msg.url);
|
||||
row.data("content", msg.content);
|
||||
results.append(row);
|
||||
|
|
|
@ -61,12 +61,15 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% spaceless %}
|
||||
<div class="template" style="display:none">
|
||||
<button type="button" class="mail-archive-search-result list-group-item">
|
||||
<span class="date badge"></span>
|
||||
<small class="date pull-right"></small>
|
||||
<small class="from pull-right"></small>
|
||||
<span class="subject"></span>
|
||||
</button>
|
||||
</div>
|
||||
{% endspaceless %}
|
||||
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Reference in a new issue