Skip to content

Commit 8c10b31

Browse files
committed
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.
1 parent 2a457bf commit 8c10b31

File tree

4 files changed

+73
-2
lines changed

4 files changed

+73
-2
lines changed

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ Features:
124124
the retire action. Created while implementing fix for
125125
issue2550831. Requires restore permission in the schema. See
126126
upgrading.txt for migrating to 1.6.0 for details. (John Rouillard)
127+
- issue2550751: Email Header Issue. Noel Garces requested the ability
128+
to suppress email headers like "x-roundup-issue-files". With Ralf's
129+
addition of the Link/Multilink property attribute
130+
'msg_header_property' we can do this easily. Setting the
131+
'msg_header_property' to the empty string '' (not to None) will
132+
suppress the header for that property. (John Rouillard)
127133

128134
Fixed:
129135

doc/customizing.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,11 @@ behaviour:
703703

704704
X-Roundup-issue-assigned_to: joe_user
705705

706-
for issues where joe_user is the username of the person responsible
707-
for this issue.
706+
for issues where joe_user is the username of the person
707+
responsible for this issue.
708+
709+
If this property is set to the empty string "", it will prevent
710+
the header from being generated on outgoing mail.
708711

709712
All Classes automatically have a number of properties by default:
710713

roundup/roundupdb.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,12 @@ def send_message(self, issueid, msgid, note, sendto, from_address=None,
562562
label = 'name'
563563
if prop.msg_header_property in cl.getprops():
564564
label = prop.msg_header_property
565+
if prop.msg_header_property == "":
566+
# if msg_header_property is set to empty string
567+
# suppress the header entirely. You can't use
568+
# 'msg_header_property == None'. None is the
569+
# default value.
570+
label = None
565571
if not label:
566572
continue
567573
if isinstance(prop, hyperdb.Link):

test/test_mailgw.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3397,6 +3397,62 @@ def testSpacesAroundMultilinkPropertyValue(self):
33973397
_______________________________________________________________________
33983398
''')
33993399

3400+
def testmsgHeaderPropertyEmptyString(self):
3401+
''' Test that setting the msg_header_property to an empty string
3402+
suppresses the X-Roundup-issue-prop header in generated email.
3403+
'''
3404+
reference_email = '''FROM: [email protected]
3405+
3406+
Content-Type: text/plain; charset="utf-8"
3407+
Subject: [issue1] set keyword
3408+
3409+
From: "Bork, Chef" <[email protected]>
3410+
Reply-To: Roundup issue tracker
3411+
3412+
MIME-Version: 1.0
3413+
Message-Id: <followup_dummy_id>
3414+
In-Reply-To: <dummy_test_message_id>
3415+
X-Roundup-Name: Roundup issue tracker
3416+
X-Roundup-Loop: hello
3417+
X-Roundup-Issue-Status: chatting
3418+
Content-Transfer-Encoding: quoted-printable
3419+
3420+
Bork, Chef <[email protected]> added the comment:
3421+
3422+
Set the Foo and Baz This keywords along with mary for nosy.
3423+
3424+
----------
3425+
keyword: +Baz This, Foo
3426+
nosy: +mary
3427+
status: unread -> chatting
3428+
title: Testing... -> set keyword
3429+
3430+
_______________________________________________________________________
3431+
Roundup issue tracker <[email protected]>
3432+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
3433+
_______________________________________________________________________
3434+
'''
3435+
self.db.keyword.create(name='Foo')
3436+
self.db.keyword.create(name='Bar')
3437+
self.db.keyword.create(name='Baz This')
3438+
3439+
self.db.issue.properties['keyword'].msg_header_property=''
3440+
3441+
nodeid1 = self.doNewIssue()
3442+
nodeid2 = self._handle_mail('''Content-Type: text/plain;
3443+
charset="iso-8859-1"
3444+
From: "Bork, Chef" <[email protected]>
3445+
3446+
Message-Id: <followup_dummy_id>
3447+
In-Reply-To: <dummy_test_message_id>
3448+
Subject: [issue1] set keyword [ keyword =+ Foo,Baz This ; nosy =+ mary ]
3449+
3450+
Set the Foo and Baz This keywords along with mary for nosy.
3451+
''')
3452+
assert os.path.exists(SENDMAILDEBUG)
3453+
self.compareMessages(self._get_mail(), reference_email)
3454+
3455+
34003456
def testOutlookAttachment(self):
34013457
message = '''X-MimeOLE: Produced By Microsoft Exchange V6.5
34023458
Content-class: urn:content-classes:message

0 commit comments

Comments
 (0)