Skip to content

Commit ab41148

Browse files
author
Ralf Schlatterbeck
committed
new mailgw config option subject_updates_title...
...see discussion http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/10169
1 parent c3d368d commit ab41148

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-0
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Features:
77

88
- allow trackers to override the classes used to render properties in
99
templating per issue2550659 (thanks Ezio Melotti)
10+
- new mailgw configuration item "subject_updates_title": If set to "no"
11+
a changed subject in a reply to an issue will not update the issue
12+
title with the changed subject. Thanks to Arkadiusz Kita and Peter
13+
Funk for requesting the feature and discussing the implementation.
14+
http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/10169
1015

1116
Fixed:
1217

roundup/configuration.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,10 @@ def str2value(self, value):
725725
"will match an issue for the interval after the issue's\n"
726726
"creation or last activity. The interval is a standard\n"
727727
"Roundup interval."),
728+
(BooleanOption, "subject_updates_title", "yes",
729+
"Update issue title if incoming subject of email is different.\n"
730+
"Setting this to \"no\" will ignore the title part of"
731+
" the subject\nof incoming email messages.\n"),
728732
(RegExpOption, "refwd_re", "(\s*\W?\s*(fw|fwd|re|aw|sv|ang)\W)+",
729733
"Regular expression matching a single reply or forward\n"
730734
"prefix prepended by the mailer. This is explicitly\n"

roundup/mailgw.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,9 @@ def _handle_message(self, message):
12301230
if (title and properties.has_key('title') and not
12311231
issue_props.has_key('title')):
12321232
issue_props['title'] = title
1233+
if (nodeid and properties.has_key('title') and not
1234+
config['MAILGW_SUBJECT_UPDATES_TITLE']):
1235+
issue_props['title'] = cl.get(nodeid,'title')
12331236

12341237
#
12351238
# handle message-id and in-reply-to

test/test_mailgw.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,111 @@ def testFollowup(self):
579579
nosy: +john, mary
580580
status: unread -> chatting
581581
582+
_______________________________________________________________________
583+
Roundup issue tracker <[email protected]>
584+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
585+
_______________________________________________________________________
586+
''')
587+
588+
def testFollowupNoSubjectChange(self):
589+
self.db.config.MAILGW_SUBJECT_UPDATES_TITLE = 'no'
590+
self.doNewIssue()
591+
592+
self._handle_mail('''Content-Type: text/plain;
593+
charset="iso-8859-1"
594+
From: richard <[email protected]>
595+
596+
Message-Id: <followup_dummy_id>
597+
In-Reply-To: <dummy_test_message_id>
598+
Subject: [issue1] Wrzlbrmft... [assignedto=mary; nosy=+john]
599+
600+
This is a followup
601+
''')
602+
l = self.db.issue.get('1', 'nosy')
603+
l.sort()
604+
self.assertEqual(l, [self.chef_id, self.richard_id, self.mary_id,
605+
self.john_id])
606+
607+
self.compareMessages(self._get_mail(),
608+
609+
610+
Content-Type: text/plain; charset="utf-8"
611+
Subject: [issue1] Testing...
612+
613+
From: richard <[email protected]>
614+
Reply-To: Roundup issue tracker
615+
616+
MIME-Version: 1.0
617+
Message-Id: <followup_dummy_id>
618+
In-Reply-To: <dummy_test_message_id>
619+
X-Roundup-Name: Roundup issue tracker
620+
X-Roundup-Loop: hello
621+
X-Roundup-Issue-Status: chatting
622+
Content-Transfer-Encoding: quoted-printable
623+
624+
625+
richard <[email protected]> added the comment:
626+
627+
This is a followup
628+
629+
----------
630+
assignedto: -> mary
631+
nosy: +john, mary
632+
status: unread -> chatting
633+
634+
_______________________________________________________________________
635+
Roundup issue tracker <[email protected]>
636+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
637+
_______________________________________________________________________
638+
''')
639+
self.assertEqual(self.db.issue.get('1','title'), 'Testing...')
640+
641+
def testFollowupExplicitSubjectChange(self):
642+
self.doNewIssue()
643+
644+
self._handle_mail('''Content-Type: text/plain;
645+
charset="iso-8859-1"
646+
From: richard <[email protected]>
647+
648+
Message-Id: <followup_dummy_id>
649+
In-Reply-To: <dummy_test_message_id>
650+
Subject: [issue1] Wrzlbrmft... [assignedto=mary; nosy=+john; title=new title]
651+
652+
This is a followup
653+
''')
654+
l = self.db.issue.get('1', 'nosy')
655+
l.sort()
656+
self.assertEqual(l, [self.chef_id, self.richard_id, self.mary_id,
657+
self.john_id])
658+
659+
self.compareMessages(self._get_mail(),
660+
661+
662+
Content-Type: text/plain; charset="utf-8"
663+
Subject: [issue1] new title
664+
665+
From: richard <[email protected]>
666+
Reply-To: Roundup issue tracker
667+
668+
MIME-Version: 1.0
669+
Message-Id: <followup_dummy_id>
670+
In-Reply-To: <dummy_test_message_id>
671+
X-Roundup-Name: Roundup issue tracker
672+
X-Roundup-Loop: hello
673+
X-Roundup-Issue-Status: chatting
674+
Content-Transfer-Encoding: quoted-printable
675+
676+
677+
richard <[email protected]> added the comment:
678+
679+
This is a followup
680+
681+
----------
682+
assignedto: -> mary
683+
nosy: +john, mary
684+
status: unread -> chatting
685+
title: Testing... -> new title
686+
582687
_______________________________________________________________________
583688
Roundup issue tracker <[email protected]>
584689
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>

0 commit comments

Comments
 (0)