incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#6906] Handle new format and non-post message IDs
Date Mon, 25 Nov 2013 17:56:47 GMT
Updated Branches:
  refs/heads/cj/6906 [created] d570aa232


[#6906] Handle new format and non-post message IDs

The format of the message ID in the In-Reply-To header changed in
[#6328] (commit 734bf8a), as well as possibly referring to the
artifact instead of a parent post.

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d570aa23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d570aa23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d570aa23

Branch: refs/heads/cj/6906
Commit: d570aa23215e8566f0cae81b745a08a8a052d845
Parents: b9cb65b
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Mon Nov 25 17:36:34 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Mon Nov 25 17:36:40 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/mail_util.py        | 2 +-
 Allura/allura/model/notification.py   | 2 +-
 Allura/allura/tests/test_mail_util.py | 8 ++++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d570aa23/Allura/allura/lib/mail_util.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/mail_util.py b/Allura/allura/lib/mail_util.py
index 92ca47a..d7d0b4b 100644
--- a/Allura/allura/lib/mail_util.py
+++ b/Allura/allura/lib/mail_util.py
@@ -34,7 +34,7 @@ from allura.lib import helpers as h
 
 log = logging.getLogger(__name__)
 
-RE_MESSAGE_ID = re.compile(r'<(.*)>')
+RE_MESSAGE_ID = re.compile(r'<(?:[^>]*/)?([^>]*)>')
 config = ConfigProxy(
     common_suffix='forgemail.domain',
     return_path='forgemail.return_path')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d570aa23/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 5da7fd3..5743ffe 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -242,7 +242,7 @@ class Notification(MappedClass):
     @classmethod
     def _references(cls, artifact, post):
         msg_ids = []
-        while post.parent_id:
+        while post and post.parent_id:
             msg_ids.append(artifact.url() + post.parent_id)
             post = post.parent
         msg_ids.append(artifact.message_id())

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d570aa23/Allura/allura/tests/test_mail_util.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_mail_util.py b/Allura/allura/tests/test_mail_util.py
index 8cd044f..f88b46c 100644
--- a/Allura/allura/tests/test_mail_util.py
+++ b/Allura/allura/tests/test_mail_util.py
@@ -35,6 +35,7 @@ from allura.lib.mail_util import (
         Header,
         is_autoreply,
         identify_sender,
+        _parse_message_id,
     )
 from allura.lib.exceptions import AddressException
 from allura.tests import decorators as td
@@ -212,3 +213,10 @@ class TestIdentifySender(object):
         EA.query.get.side_effect = [None, None]
         assert_equal(identify_sender(None, 'arg', {'From': 'from'}, None), anon)
         assert_equal(EA.query.get.call_args_list, [mock.call(_id='arg'), mock.call(_id='from')])
+
+
+def test_parse_message_id():
+    assert_equal(_parse_message_id('<de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net>,
</p/libjpeg-turbo/patches/54/de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net>'),
[
+            'de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net',
+            'de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net',
+        ])


Mime
View raw message