Mercurial > p > roundup > code
changeset 5124:a927f9549af0
Fix issue2550751: Email Header Issue.
Noel Garces requested the ability to suppress email headers like
"x-roundup-issue-files". With Ralf's addition of the Link/Multilink
property attribute 'msg_header_property' we can do this
easily. Setting the 'msg_header_property' to the empty string '' (not
to None) will suppress the header for that property.
3 line code change, single test, doc updated and change note.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 03 Jul 2016 19:29:50 -0400 |
| parents | 226052e0cc4c |
| children | 410e565b5c1f |
| files | CHANGES.txt doc/customizing.txt roundup/roundupdb.py test/test_mailgw.py |
| diffstat | 4 files changed, 73 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Sun Jul 03 18:54:18 2016 -0400 +++ b/CHANGES.txt Sun Jul 03 19:29:50 2016 -0400 @@ -124,6 +124,12 @@ the retire action. Created while implementing fix for issue2550831. Requires restore permission in the schema. See upgrading.txt for migrating to 1.6.0 for details. (John Rouillard) +- issue2550751: Email Header Issue. Noel Garces requested the ability + to suppress email headers like "x-roundup-issue-files". With Ralf's + addition of the Link/Multilink property attribute + 'msg_header_property' we can do this easily. Setting the + 'msg_header_property' to the empty string '' (not to None) will + suppress the header for that property. (John Rouillard) Fixed:
--- a/doc/customizing.txt Sun Jul 03 18:54:18 2016 -0400 +++ b/doc/customizing.txt Sun Jul 03 19:29:50 2016 -0400 @@ -703,8 +703,11 @@ X-Roundup-issue-assigned_to: joe_user - for issues where joe_user is the username of the person responsible - for this issue. + for issues where joe_user is the username of the person + responsible for this issue. + + If this property is set to the empty string "", it will prevent + the header from being generated on outgoing mail. All Classes automatically have a number of properties by default:
--- a/roundup/roundupdb.py Sun Jul 03 18:54:18 2016 -0400 +++ b/roundup/roundupdb.py Sun Jul 03 19:29:50 2016 -0400 @@ -562,6 +562,12 @@ label = 'name' if prop.msg_header_property in cl.getprops(): label = prop.msg_header_property + if prop.msg_header_property == "": + # if msg_header_property is set to empty string + # suppress the header entirely. You can't use + # 'msg_header_property == None'. None is the + # default value. + label = None if not label: continue if isinstance(prop, hyperdb.Link):
--- a/test/test_mailgw.py Sun Jul 03 18:54:18 2016 -0400 +++ b/test/test_mailgw.py Sun Jul 03 19:29:50 2016 -0400 @@ -3397,6 +3397,62 @@ _______________________________________________________________________ ''') + def testmsgHeaderPropertyEmptyString(self): + ''' Test that setting the msg_header_property to an empty string + suppresses the X-Roundup-issue-prop header in generated email. + ''' + reference_email = '''FROM: roundup-admin@your.tracker.email.domain.example +TO: mary@test.test, richard@test.test +Content-Type: text/plain; charset="utf-8" +Subject: [issue1] set keyword +To: mary@test.test, richard@test.test +From: "Bork, Chef" <issue_tracker@your.tracker.email.domain.example> +Reply-To: Roundup issue tracker + <issue_tracker@your.tracker.email.domain.example> +MIME-Version: 1.0 +Message-Id: <followup_dummy_id> +In-Reply-To: <dummy_test_message_id> +X-Roundup-Name: Roundup issue tracker +X-Roundup-Loop: hello +X-Roundup-Issue-Status: chatting +Content-Transfer-Encoding: quoted-printable + +Bork, Chef <chef@bork.bork.bork> added the comment: + +Set the Foo and Baz This keywords along with mary for nosy. + +---------- +keyword: +Baz This, Foo +nosy: +mary +status: unread -> chatting +title: Testing... -> set keyword + +_______________________________________________________________________ +Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> +<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1> +_______________________________________________________________________ +''' + self.db.keyword.create(name='Foo') + self.db.keyword.create(name='Bar') + self.db.keyword.create(name='Baz This') + + self.db.issue.properties['keyword'].msg_header_property='' + + nodeid1 = self.doNewIssue() + nodeid2 = self._handle_mail('''Content-Type: text/plain; + charset="iso-8859-1" +From: "Bork, Chef" <chef@bork.bork.bork> +To: issue_tracker@your.tracker.email.domain.example +Message-Id: <followup_dummy_id> +In-Reply-To: <dummy_test_message_id> +Subject: [issue1] set keyword [ keyword =+ Foo,Baz This ; nosy =+ mary ] + +Set the Foo and Baz This keywords along with mary for nosy. +''') + assert os.path.exists(SENDMAILDEBUG) + self.compareMessages(self._get_mail(), reference_email) + + def testOutlookAttachment(self): message = '''X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message
