From 8a6d9c22c7e4f768704c070e831de28434c7fb31 Mon Sep 17 00:00:00 2001 From: schlatterbeck Date: Wed, 4 Aug 2010 10:01:23 +0000 Subject: [PATCH] new mailgw config option subject_updates_title, see discussion http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/10169 git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4511 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 5 ++ roundup/configuration.py | 4 ++ roundup/mailgw.py | 3 ++ test/test_mailgw.py | 105 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 06cb7c7..e87e499 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,6 +7,11 @@ Features: - allow trackers to override the classes used to render properties in templating per issue2550659 (thanks Ezio Melotti) +- new mailgw configuration item "subject_updates_title": If set to "no" + a changed subject in a reply to an issue will not update the issue + title with the changed subject. Thanks to Arkadiusz Kita and Peter + Funk for requesting the feature and discussing the implementation. + http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/10169 Fixed: diff --git a/roundup/configuration.py b/roundup/configuration.py index 3ad193d..f010842 100644 --- a/roundup/configuration.py +++ b/roundup/configuration.py @@ -725,6 +725,10 @@ SETTINGS = ( "will match an issue for the interval after the issue's\n" "creation or last activity. The interval is a standard\n" "Roundup interval."), + (BooleanOption, "subject_updates_title", "yes", + "Update issue title if incoming subject of email is different.\n" + "Setting this to \"no\" will ignore the title part of" + " the subject\nof incoming email messages.\n"), (RegExpOption, "refwd_re", "(\s*\W?\s*(fw|fwd|re|aw|sv|ang)\W)+", "Regular expression matching a single reply or forward\n" "prefix prepended by the mailer. This is explicitly\n" diff --git a/roundup/mailgw.py b/roundup/mailgw.py index 61f3cdf..38b3e37 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -1230,6 +1230,9 @@ Subject was: "%(subject)s" if (title and properties.has_key('title') and not issue_props.has_key('title')): issue_props['title'] = title + if (nodeid and properties.has_key('title') and not + config['MAILGW_SUBJECT_UPDATES_TITLE']): + issue_props['title'] = cl.get(nodeid,'title') # # handle message-id and in-reply-to diff --git a/test/test_mailgw.py b/test/test_mailgw.py index 295d06a..b4a8f95 100644 --- a/test/test_mailgw.py +++ b/test/test_mailgw.py @@ -579,6 +579,111 @@ assignedto: -> mary nosy: +john, mary status: unread -> chatting +_______________________________________________________________________ +Roundup issue tracker + +_______________________________________________________________________ +''') + + def testFollowupNoSubjectChange(self): + self.db.config.MAILGW_SUBJECT_UPDATES_TITLE = 'no' + self.doNewIssue() + + self._handle_mail('''Content-Type: text/plain; + charset="iso-8859-1" +From: richard +To: issue_tracker@your.tracker.email.domain.example +Message-Id: +In-Reply-To: +Subject: [issue1] Wrzlbrmft... [assignedto=mary; nosy=+john] + +This is a followup +''') + l = self.db.issue.get('1', 'nosy') + l.sort() + self.assertEqual(l, [self.chef_id, self.richard_id, self.mary_id, + self.john_id]) + + self.compareMessages(self._get_mail(), +'''FROM: roundup-admin@your.tracker.email.domain.example +TO: chef@bork.bork.bork, john@test.test, mary@test.test +Content-Type: text/plain; charset="utf-8" +Subject: [issue1] Testing... +To: chef@bork.bork.bork, john@test.test, mary@test.test +From: richard +Reply-To: Roundup issue tracker + +MIME-Version: 1.0 +Message-Id: +In-Reply-To: +X-Roundup-Name: Roundup issue tracker +X-Roundup-Loop: hello +X-Roundup-Issue-Status: chatting +Content-Transfer-Encoding: quoted-printable + + +richard added the comment: + +This is a followup + +---------- +assignedto: -> mary +nosy: +john, mary +status: unread -> chatting + +_______________________________________________________________________ +Roundup issue tracker + +_______________________________________________________________________ +''') + self.assertEqual(self.db.issue.get('1','title'), 'Testing...') + + def testFollowupExplicitSubjectChange(self): + self.doNewIssue() + + self._handle_mail('''Content-Type: text/plain; + charset="iso-8859-1" +From: richard +To: issue_tracker@your.tracker.email.domain.example +Message-Id: +In-Reply-To: +Subject: [issue1] Wrzlbrmft... [assignedto=mary; nosy=+john; title=new title] + +This is a followup +''') + l = self.db.issue.get('1', 'nosy') + l.sort() + self.assertEqual(l, [self.chef_id, self.richard_id, self.mary_id, + self.john_id]) + + self.compareMessages(self._get_mail(), +'''FROM: roundup-admin@your.tracker.email.domain.example +TO: chef@bork.bork.bork, john@test.test, mary@test.test +Content-Type: text/plain; charset="utf-8" +Subject: [issue1] new title +To: chef@bork.bork.bork, john@test.test, mary@test.test +From: richard +Reply-To: Roundup issue tracker + +MIME-Version: 1.0 +Message-Id: +In-Reply-To: +X-Roundup-Name: Roundup issue tracker +X-Roundup-Loop: hello +X-Roundup-Issue-Status: chatting +Content-Transfer-Encoding: quoted-printable + + +richard added the comment: + +This is a followup + +---------- +assignedto: -> mary +nosy: +john, mary +status: unread -> chatting +title: Testing... -> new title + _______________________________________________________________________ Roundup issue tracker -- 2.30.2