summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9976de4)
raw | patch | inline | side by side (parent: 9976de4)
author | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 19 Oct 2011 13:20:22 +0000 (13:20 +0000) | ||
committer | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 19 Oct 2011 13:20:22 +0000 (13:20 +0000) |
of config: This will send a message to the author only in the case where
the author is on the nosy-list (either added earlier or via the
add_author setting). Current config-options for this setting will send /
not send to author without considering the nosy list.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4659 57a73879-2fb5-44c3-a270-3262357dd7e2
the author is on the nosy-list (either added earlier or via the
add_author setting). Current config-options for this setting will send /
not send to author without considering the nosy list.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4659 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/configuration.py | patch | blob | history | |
roundup/roundupdb.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index e89fdfa31c01d76a8a1458d37ada58c345b77ead..88aef984422b62cee6aa3bba95377f5d6c18898a 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
translation as it used to be (Ralf)
- Sending of PGP-Encrypted mail to all users or selected users (via
roles) is now working. (Ralf)
translation as it used to be (Ralf)
- Sending of PGP-Encrypted mail to all users or selected users (via
roles) is now working. (Ralf)
+- Add config-option "nosy" to messages_to_author setting in [nosy]
+ section of config: This will send a message to the author only
+ in the case where the author is on the nosy-list (either added
+ earlier or via the add_author setting). Current config-options
+ for this setting will send / not send to author without considering
+ the nosy list. (Ralf)
Fixed:
Fixed:
index 6b9d05a7a2d8a0174c6df089b7b6c45629c49c67..f7ae9d7743605ea10d08d91655c7b20e357b0355 100644 (file)
--- a/roundup/configuration.py
+++ b/roundup/configuration.py
"turned on."),
), "OpenPGP mail processing options"),
("nosy", (
"turned on."),
), "OpenPGP mail processing options"),
("nosy", (
- (RunDetectorOption, "messages_to_author", "no",
- "Send nosy messages to the author of the message.",
+ (Option, "messages_to_author", "no",
+ "Send nosy messages to the author of the message.\n"
+ "Allowed values: yes, no, new, nosy -- if yes, messages\n"
+ "are sent to the author even if not on the nosy list, same\n"
+ "for new (but only for new messages). When set to nosy,\n"
+ "the nosy list controls sending messages to the author.",
["MESSAGES_TO_AUTHOR"]),
(Option, "signature_position", "bottom",
"Where to place the email signature.\n"
["MESSAGES_TO_AUTHOR"]),
(Option, "signature_position", "bottom",
"Where to place the email signature.\n"
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index ddcf0c37ccaa092ee7b64156a10165036808f7bd..1ce6772f6088ade6d766936008acee08f7ff806c 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
# anonymous
if (good_recipient(authid) and
(self.db.config.MESSAGES_TO_AUTHOR == 'yes' or
# anonymous
if (good_recipient(authid) and
(self.db.config.MESSAGES_TO_AUTHOR == 'yes' or
- (self.db.config.MESSAGES_TO_AUTHOR == 'new' and not oldvalues))):
+ (self.db.config.MESSAGES_TO_AUTHOR == 'new' and not oldvalues) or
+ (self.db.config.MESSAGES_TO_AUTHOR == 'nosy' and authid in
+ self.get(issueid, whichnosy)))):
add_recipient(authid, sendto)
if authid:
add_recipient(authid, sendto)
if authid:
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index fde8c460c3846d3bf2ce9403a619b4c6e69c26d2..9c3936c3f6c2062b3a344b2b28aa64a2d2c2d9cd 100644 (file)
--- a/test/test_mailgw.py
+++ b/test/test_mailgw.py
self.assertEqual(self.db.issue.get(nodeid, 'status'), '3')
self.assertEqual(self.db.issue.get(nodeid, 'priority'), '1')
self.assertEqual(self.db.issue.get(nodeid, 'status'), '3')
self.assertEqual(self.db.issue.get(nodeid, 'priority'), '1')
- def doNewIssue(self):
- nodeid = self._handle_mail('''Content-Type: text/plain;
+ newmsg = '''Content-Type: text/plain;
charset="iso-8859-1"
From: Chef <chef@bork.bork.bork>
To: issue_tracker@your.tracker.email.domain.example
charset="iso-8859-1"
From: Chef <chef@bork.bork.bork>
To: issue_tracker@your.tracker.email.domain.example
Subject: [issue] Testing...
This is a test submission of a new issue.
Subject: [issue] Testing...
This is a test submission of a new issue.
-''')
+'''
+
+ def doNewIssue(self):
+ nodeid = self._handle_mail(self.newmsg)
assert not os.path.exists(SENDMAILDEBUG)
l = self.db.issue.get(nodeid, 'nosy')
l.sort()
assert not os.path.exists(SENDMAILDEBUG)
l = self.db.issue.get(nodeid, 'nosy')
l.sort()
def testNewIssueNosy(self):
self.instance.config.ADD_AUTHOR_TO_NOSY = 'yes'
def testNewIssueNosy(self):
self.instance.config.ADD_AUTHOR_TO_NOSY = 'yes'
- nodeid = self._handle_mail('''Content-Type: text/plain;
- charset="iso-8859-1"
-From: Chef <chef@bork.bork.bork>
-To: issue_tracker@your.tracker.email.domain.example
-Cc: richard@test.test
-Message-Id: <dummy_test_message_id>
-Subject: [issue] Testing...
+ nodeid = self.doNewIssue()
+ m = self.db.issue.get(nodeid, 'messages')
+ self.assertEqual(len(m), 1)
+ recv = self.db.msg.get(m[0], 'recipients')
+ self.assertEqual(recv, [self.richard_id])
-This is a test submission of a new issue.
-''')
+ def testNewIssueNosyAuthor(self):
+ self.instance.config.ADD_AUTHOR_TO_NOSY = 'no'
+ self.instance.config.MESSAGES_TO_AUTHOR = 'nosy'
+ nodeid = self._handle_mail(self.newmsg)
assert not os.path.exists(SENDMAILDEBUG)
l = self.db.issue.get(nodeid, 'nosy')
l.sort()
assert not os.path.exists(SENDMAILDEBUG)
l = self.db.issue.get(nodeid, 'nosy')
l.sort()
- self.assertEqual(l, [self.chef_id, self.richard_id])
+ self.assertEqual(l, [self.richard_id])
+ m = self.db.issue.get(nodeid, 'messages')
+ self.assertEqual(len(m), 1)
+ recv = self.db.msg.get(m[0], 'recipients')
+ recv.sort()
+ self.assertEqual(recv, [self.richard_id])
def testAlternateAddress(self):
self._handle_mail('''Content-Type: text/plain;
def testAlternateAddress(self):
self._handle_mail('''Content-Type: text/plain;
assert not os.path.exists(SENDMAILDEBUG)
def testNewIssueAuthMsg(self):
assert not os.path.exists(SENDMAILDEBUG)
def testNewIssueAuthMsg(self):
- # TODO: fix the damn config - this is apalling
self.db.config.MESSAGES_TO_AUTHOR = 'yes'
self._handle_mail('''Content-Type: text/plain;
charset="iso-8859-1"
self.db.config.MESSAGES_TO_AUTHOR = 'yes'
self._handle_mail('''Content-Type: text/plain;
charset="iso-8859-1"
This is a followup
'''), nodeid)
This is a followup
'''), nodeid)
-
- def testFollowupNosyAuthor(self):
- self.doNewIssue()
- self.db.config.ADD_AUTHOR_TO_NOSY = 'yes'
- self._handle_mail('''Content-Type: text/plain;
+ simple_followup = '''Content-Type: text/plain;
charset="iso-8859-1"
From: john@test.test
To: issue_tracker@your.tracker.email.domain.example
charset="iso-8859-1"
From: john@test.test
To: issue_tracker@your.tracker.email.domain.example
Subject: [issue1] Testing...
This is a followup
Subject: [issue1] Testing...
This is a followup
-''')
+'''
+ def testFollowupNosyAuthor(self):
+ self.doNewIssue()
+ self.db.config.ADD_AUTHOR_TO_NOSY = 'yes'
+ self._handle_mail(self.simple_followup)
self.compareMessages(self._get_mail(),
'''FROM: roundup-admin@your.tracker.email.domain.example
TO: chef@bork.bork.bork, richard@test.test
self.compareMessages(self._get_mail(),
'''FROM: roundup-admin@your.tracker.email.domain.example
TO: chef@bork.bork.bork, richard@test.test
self.doNewIssue()
self.db.config.ADD_RECIPIENTS_TO_NOSY = 'yes'
self._handle_mail('''Content-Type: text/plain;
self.doNewIssue()
self.db.config.ADD_RECIPIENTS_TO_NOSY = 'yes'
self._handle_mail('''Content-Type: text/plain;
- charset="iso-8859-1"
+ charset="iso-8859-1"
From: richard@test.test
To: issue_tracker@your.tracker.email.domain.example
Cc: john@test.test
From: richard@test.test
To: issue_tracker@your.tracker.email.domain.example
Cc: john@test.test
self.doNewIssue()
self.db.config.ADD_AUTHOR_TO_NOSY = 'yes'
self.db.config.MESSAGES_TO_AUTHOR = 'yes'
self.doNewIssue()
self.db.config.ADD_AUTHOR_TO_NOSY = 'yes'
self.db.config.MESSAGES_TO_AUTHOR = 'yes'
- self._handle_mail('''Content-Type: text/plain;
- charset="iso-8859-1"
-From: john@test.test
-To: issue_tracker@your.tracker.email.domain.example
+ self._handle_mail(self.simple_followup)
+ self.compareMessages(self._get_mail(),
+'''FROM: roundup-admin@your.tracker.email.domain.example
+TO: chef@bork.bork.bork, john@test.test, richard@test.test
+Content-Type: text/plain; charset="utf-8"
+Subject: [issue1] Testing...
+To: chef@bork.bork.bork, john@test.test, richard@test.test
+From: John Doe <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>
Message-Id: <followup_dummy_id>
In-Reply-To: <dummy_test_message_id>
-Subject: [issue1] Testing...
+X-Roundup-Name: Roundup issue tracker
+X-Roundup-Loop: hello
+X-Roundup-Issue-Status: chatting
+Content-Transfer-Encoding: quoted-printable
+
+
+John Doe <john@test.test> added the comment:
This is a followup
This is a followup
+
+----------
+nosy: +john
+status: unread -> chatting
+
+_______________________________________________________________________
+Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
+<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
+_______________________________________________________________________
+
''')
''')
+
+ def testFollowupNosyAuthorNosyCopy(self):
+ self.doNewIssue()
+ self.db.config.ADD_AUTHOR_TO_NOSY = 'yes'
+ self.db.config.MESSAGES_TO_AUTHOR = 'nosy'
+ self._handle_mail(self.simple_followup)
self.compareMessages(self._get_mail(),
'''FROM: roundup-admin@your.tracker.email.domain.example
TO: chef@bork.bork.bork, john@test.test, richard@test.test
self.compareMessages(self._get_mail(),
'''FROM: roundup-admin@your.tracker.email.domain.example
TO: chef@bork.bork.bork, john@test.test, richard@test.test
def testFollowupNoNosyAuthor(self):
self.doNewIssue()
self.instance.config.ADD_AUTHOR_TO_NOSY = 'no'
def testFollowupNoNosyAuthor(self):
self.doNewIssue()
self.instance.config.ADD_AUTHOR_TO_NOSY = 'no'
- self._handle_mail('''Content-Type: text/plain;
- charset="iso-8859-1"
-From: john@test.test
-To: issue_tracker@your.tracker.email.domain.example
+ self._handle_mail(self.simple_followup)
+ self.compareMessages(self._get_mail(),
+'''FROM: roundup-admin@your.tracker.email.domain.example
+TO: chef@bork.bork.bork, richard@test.test
+Content-Type: text/plain; charset="utf-8"
+Subject: [issue1] Testing...
+To: chef@bork.bork.bork, richard@test.test
+From: John Doe <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>
Message-Id: <followup_dummy_id>
In-Reply-To: <dummy_test_message_id>
-Subject: [issue1] Testing...
+X-Roundup-Name: Roundup issue tracker
+X-Roundup-Loop: hello
+X-Roundup-Issue-Status: chatting
+Content-Transfer-Encoding: quoted-printable
+
+
+John Doe <john@test.test> added the comment:
This is a followup
This is a followup
+
+----------
+status: unread -> chatting
+
+_______________________________________________________________________
+Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
+<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
+_______________________________________________________________________
+
''')
''')
+
+ def testFollowupNoNosyAuthorNoCopy(self):
+ self.doNewIssue()
+ self.instance.config.ADD_AUTHOR_TO_NOSY = 'no'
+ self.instance.config.MESSAGES_TO_AUTHOR = 'nosy'
+ self._handle_mail(self.simple_followup)
self.compareMessages(self._get_mail(),
'''FROM: roundup-admin@your.tracker.email.domain.example
TO: chef@bork.bork.bork, richard@test.test
self.compareMessages(self._get_mail(),
'''FROM: roundup-admin@your.tracker.email.domain.example
TO: chef@bork.bork.bork, richard@test.test
Content-Transfer-Encoding: quoted-printable
Content-Transfer-Encoding: quoted-printable
+John Doe <john@test.test> added the comment:
+
+This is a followup
+
+----------
+status: unread -> chatting
+
+_______________________________________________________________________
+Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
+<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
+_______________________________________________________________________
+
+''')
+
+ # this is a pathological case where the author is *not* on the nosy
+ # list but gets the message; test documents existing behaviour
+ def testFollowupNoNosyAuthorButCopy(self):
+ self.doNewIssue()
+ self.instance.config.ADD_AUTHOR_TO_NOSY = 'no'
+ self.instance.config.MESSAGES_TO_AUTHOR = 'yes'
+ self._handle_mail(self.simple_followup)
+ self.compareMessages(self._get_mail(),
+'''FROM: roundup-admin@your.tracker.email.domain.example
+TO: chef@bork.bork.bork, john@test.test, richard@test.test
+Content-Type: text/plain; charset="utf-8"
+Subject: [issue1] Testing...
+To: chef@bork.bork.bork, john@test.test, richard@test.test
+From: John Doe <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
+
+
John Doe <john@test.test> added the comment:
This is a followup
John Doe <john@test.test> added the comment:
This is a followup