Commit 7b5ec7f5 authored by Jérome Perrin's avatar Jérome Perrin

add message-id and in-reply-to headers for threading

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8076 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7ef80e65
...@@ -79,9 +79,22 @@ to_address = portal.getProperty(\'email_to_address\', \'yo@nexedi.com\')\n ...@@ -79,9 +79,22 @@ to_address = portal.getProperty(\'email_to_address\', \'yo@nexedi.com\')\n
if not to_address:\n if not to_address:\n
return\n return\n
\n \n
# compute Message-ID and In-Reply-To header, for threading on MUAs\n
history = portal.portal_workflow.getInfoFor(ob=bug,\n
name=\'history\',\n
wf_id=\'bug_workflow\',\n
default=())\n
comment_count = len([item for item in history\n
if str(item[\'action\']).endswith(\'_action\')])\n
message_id = "<%s-%s.%s>" % (bug.getId(), comment_count+1, from_address)\n
in_reply_to = "<%s-%s.%s>" % (bug.getId(), comment_count, from_address)\n
\n
\n
text="""From: "%s" <%s>\n text="""From: "%s" <%s>\n
To: %s\n To: %s\n
Subject: [Bug #%s] %s\n Subject: [Bug #%s] %s\n
Message-Id: %s\n
In-Reply-To: %s\n
MIME-Version: 1.0\n MIME-Version: 1.0\n
Content-Type: text/plain;\n Content-Type: text/plain;\n
charset="utf-8"\n charset="utf-8"\n
...@@ -99,8 +112,8 @@ Path: %s\n ...@@ -99,8 +112,8 @@ Path: %s\n
Follow-ups:\n Follow-ups:\n
\n \n
%s\n %s\n
""" % (from_name, from_address, to_address, bug.getId(), bug.getTitle(), \n """ % (from_name, from_address, to_address, bug.getId(), bug.getTitle(), message_id, in_reply_to,\n
bug.getTitle(), bug.getSourceTitle(), bug.getDestinationTitle(),\n bug.getTitle(), bug.getSourceTitle() or \'\', bug.getDestinationTitle() or \'\',\n
bug.getValidationStateTitle(), bug.getPath(),\n bug.getValidationStateTitle(), bug.getPath(),\n
\'\\n\'.join([\' \' + x for x in bug.getDescription().split(\'\\n\')]),\n \'\\n\'.join([\' \' + x for x in bug.getDescription().split(\'\\n\')]),\n
\'\\n\'.join([\' \' + x for x in bug.Bug_getFollowUpListAsText().split(\'\\n\')]),\n \'\\n\'.join([\' \' + x for x in bug.Bug_getFollowUpListAsText().split(\'\\n\')]),\n
...@@ -163,9 +176,16 @@ portal.MailHost.send(text)\n ...@@ -163,9 +176,16 @@ portal.MailHost.send(text)\n
<string>from_name</string> <string>from_name</string>
<string>from_address</string> <string>from_address</string>
<string>to_address</string> <string>to_address</string>
<string>history</string>
<string>len</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>item</string>
<string>str</string>
<string>comment_count</string>
<string>message_id</string>
<string>in_reply_to</string>
<string>x</string> <string>x</string>
<string>text</string> <string>text</string>
</tuple> </tuple>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment