← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/avoid-copy-archive-spam-2 into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/avoid-copy-archive-spam-2 into lp:launchpad.

Commit message:
Don't notify the changer for unsigned uploads to copy archives (almost certainly builds).

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/avoid-copy-archive-spam-2/+merge/144727

== Summary ==

https://code.launchpad.net/~cjwatson/launchpad/avoid-copy-archive-spam/+merge/144611 was incomplete because I failed to notice a case where the changer is explicitly added as a recipient for unsigned uploads, which of course is a condition that holds for build uploads.  This change fixes that too; I'll repeat the same QA for it.

== Tests ==

bin/test -vvct lp.soyuz.adapters.tests.test_notification
-- 
https://code.launchpad.net/~cjwatson/launchpad/avoid-copy-archive-spam-2/+merge/144727
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/avoid-copy-archive-spam-2 into lp:launchpad.
=== modified file 'lib/lp/soyuz/adapters/notification.py'
--- lib/lp/soyuz/adapters/notification.py	2013-01-23 23:52:39 +0000
+++ lib/lp/soyuz/adapters/notification.py	2013-01-24 15:30:17 +0000
@@ -477,7 +477,7 @@
     changer = email_to_person(info['changedby'])
     maintainer = email_to_person(info['maintainer'])
 
-    if blamer is None:
+    if blamer is None and not archive.is_copy:
         debug(logger, "Changes file is unsigned; adding changer as recipient.")
         candidate_recipients.append(changer)
 

=== modified file 'lib/lp/soyuz/adapters/tests/test_notification.py'
--- lib/lp/soyuz/adapters/tests/test_notification.py	2013-01-23 23:52:39 +0000
+++ lib/lp/soyuz/adapters/tests/test_notification.py	2013-01-24 15:30:17 +0000
@@ -417,10 +417,10 @@
         self.assertRecipientsEqual(
             [blamer, maintainer], changes, blamer, maintainer, changer)
 
-    def test_get_upload_notification_recipients_copy_archive(self):
-        # Notifications for uploads to copy archives only go to the archive
-        # owner.
-        blamer, maintainer, changer = self._setup_recipients()
+    def test_get_upload_notification_recipients_unsigned_copy_archive(self):
+        # Notifications for unsigned build uploads to copy archives only go
+        # to the archive owner.
+        _, maintainer, changer = self._setup_recipients()
         changes = {
             'Date': '2001-01-01',
             'Changed-By': 'Changer <changer@xxxxxxxxxxx>',
@@ -428,7 +428,7 @@
             'Changes': ' * Foo!',
             }
         self.assertRecipientsEqual(
-            [blamer], changes, blamer, maintainer, changer,
+            [], changes, None, maintainer, changer,
             purpose=ArchivePurpose.COPY)
 
     def test_assemble_body_handles_no_preferred_email_for_changer(self):