Skip to content

Commit 9921976

Browse files
author
Erik Forsberg
committed
Make addition of line about new submission/comment at top of each message...
...configurable Make presence of e-mail address in the added line configurable.
1 parent e3cd392 commit 9921976

File tree

3 files changed

+99
-7
lines changed

3 files changed

+99
-7
lines changed

roundup/configuration.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Roundup Issue Tracker configuration support
22
#
3-
# $Id: configuration.py,v 1.43 2007-05-12 16:14:54 forsberg Exp $
3+
# $Id: configuration.py,v 1.44 2007-09-01 16:30:11 forsberg Exp $
44
#
55
__docformat__ = "restructuredtext"
66

@@ -635,6 +635,12 @@ def str2value(self, value):
635635
"messages to this file *instead* of sending them.\n"
636636
"This option has the same effect as environment variable"
637637
" SENDMAILDEBUG.\nEnvironment variable takes precedence."),
638+
(BooleanOption, "add_authorinfo", "yes",
639+
"Add a line with author information at top of all messages\n"
640+
"sent by roundup"),
641+
(BooleanOption, "add_authoremail", "yes",
642+
"Add the mail address of the author to the author information at\n"
643+
"added if add_authorinfo is true."),
638644
), "Outgoing email options.\nUsed for nozy messages and approval requests"),
639645
("mailgw", (
640646
(BooleanOption, "keep_quoted_text", "yes",

roundup/roundupdb.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: roundupdb.py,v 1.128 2006-12-18 11:34:41 a1s Exp $
19+
# $Id: roundupdb.py,v 1.129 2007-09-01 16:30:11 forsberg Exp $
2020

2121
"""Extending hyperdb with types specific to issue-tracking.
2222
"""
@@ -292,8 +292,10 @@ def send_message(self, nodeid, msgid, note, sendto, from_address=None,
292292
authname = 'admin'
293293
authaddr = self.db.config.ADMIN_EMAIL
294294

295-
if authaddr:
295+
if authaddr and self.db.config.MAIL_ADD_AUTHOREMAIL:
296296
authaddr = " <%s>" % straddr( ('',authaddr) )
297+
elif authaddr:
298+
authaddr = ""
297299

298300
# make the message body
299301
m = ['']
@@ -303,16 +305,18 @@ def send_message(self, nodeid, msgid, note, sendto, from_address=None,
303305
m.append(self.email_signature(nodeid, msgid))
304306

305307
# add author information
306-
if authid:
308+
if authid and self.db.config.MAIL_ADD_AUTHORINFO:
307309
if len(self.get(nodeid,'messages')) == 1:
310+
308311
m.append(_("New submission from %(authname)s%(authaddr)s:")
309312
% locals())
310313
else:
311314
m.append(_("%(authname)s%(authaddr)s added the comment:")
312315
% locals())
313-
else:
316+
m.append('')
317+
elif self.db.config.MAIL_ADD_AUTHORINFO:
314318
m.append(_("System message:"))
315-
m.append('')
319+
m.append('')
316320

317321
# add the content
318322
if msgid is not None:

test/test_mailgw.py

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# but WITHOUT ANY WARRANTY; without even the implied warranty of
99
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010
#
11-
# $Id: test_mailgw.py,v 1.86 2007-09-01 16:14:21 forsberg Exp $
11+
# $Id: test_mailgw.py,v 1.87 2007-09-01 16:30:11 forsberg Exp $
1212

1313
# TODO: test bcc
1414

@@ -258,6 +258,88 @@ def testNewIssueAuthMsg(self):
258258
_______________________________________________________________________
259259
''')
260260

261+
def testNewIssueNoAuthorInfo(self):
262+
self.db.config.MAIL_ADD_AUTHORINFO = 'no'
263+
self._handle_mail('''Content-Type: text/plain;
264+
charset="iso-8859-1"
265+
From: Chef <[email protected]>
266+
267+
Message-Id: <dummy_test_message_id>
268+
Subject: [issue] Testing... [nosy=mary; assignedto=richard]
269+
270+
This is a test submission of a new issue.
271+
''')
272+
self.compareMessages(self._get_mail(),
273+
274+
TO: [email protected], mary@test, richard@test
275+
Content-Type: text/plain; charset=utf-8
276+
Subject: [issue1] Testing...
277+
To: mary@test, richard@test
278+
From: "Bork, Chef" <[email protected]>
279+
Reply-To: Roundup issue tracker <[email protected]>
280+
MIME-Version: 1.0
281+
Message-Id: <dummy_test_message_id>
282+
X-Roundup-Name: Roundup issue tracker
283+
X-Roundup-Loop: hello
284+
Content-Transfer-Encoding: quoted-printable
285+
286+
This is a test submission of a new issue.
287+
288+
----------
289+
assignedto: richard
290+
messages: 1
291+
nosy: Chef, mary, richard
292+
status: unread
293+
title: Testing...
294+
295+
_______________________________________________________________________
296+
Roundup issue tracker <[email protected]>
297+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
298+
_______________________________________________________________________
299+
''')
300+
301+
def testNewIssueNoAuthorEmail(self):
302+
self.db.config.MAIL_ADD_AUTHOREMAIL = 'no'
303+
self._handle_mail('''Content-Type: text/plain;
304+
charset="iso-8859-1"
305+
From: Chef <[email protected]>
306+
307+
Message-Id: <dummy_test_message_id>
308+
Subject: [issue] Testing... [nosy=mary; assignedto=richard]
309+
310+
This is a test submission of a new issue.
311+
''')
312+
self.compareMessages(self._get_mail(),
313+
314+
TO: [email protected], mary@test, richard@test
315+
Content-Type: text/plain; charset=utf-8
316+
Subject: [issue1] Testing...
317+
To: mary@test, richard@test
318+
From: "Bork, Chef" <[email protected]>
319+
Reply-To: Roundup issue tracker <[email protected]>
320+
MIME-Version: 1.0
321+
Message-Id: <dummy_test_message_id>
322+
X-Roundup-Name: Roundup issue tracker
323+
X-Roundup-Loop: hello
324+
Content-Transfer-Encoding: quoted-printable
325+
326+
New submission from Bork, Chef:
327+
328+
This is a test submission of a new issue.
329+
330+
----------
331+
assignedto: richard
332+
messages: 1
333+
nosy: Chef, mary, richard
334+
status: unread
335+
title: Testing...
336+
337+
_______________________________________________________________________
338+
Roundup issue tracker <[email protected]>
339+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
340+
_______________________________________________________________________
341+
''')
342+
261343
# BUG
262344
# def testMultipart(self):
263345
# '''With more than one part'''

0 commit comments

Comments
 (0)