Merge ~twom/launchpad:email-ppa-changes into launchpad:master

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: c5ff0d5f7010b3d0ffd364cc6fad330f1b435e61
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~twom/launchpad:email-ppa-changes
Merge into: launchpad:master
Diff against target: 78 lines (+55/-1)
2 files modified
lib/lp/soyuz/mail/packageupload.py (+1/-1)
lib/lp/soyuz/mail/tests/test_packageupload.py (+54/-0)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+405108@code.launchpad.net

Commit message

Don't send packageupload mails to non main archive lists

lp: #1929243

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
~twom/launchpad:email-ppa-changes updated
44c5569... by Tom Wardill

Drop redundant is_ppa check

c5ff0d5... by Tom Wardill

Move tests to a better location

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/lib/lp/soyuz/mail/packageupload.py b/lib/lp/soyuz/mail/packageupload.py
index a5686a1..e6986aa 100644
--- a/lib/lp/soyuz/mail/packageupload.py
+++ b/lib/lp/soyuz/mail/packageupload.py
@@ -391,7 +391,7 @@ class PackageUploadMailer(BaseMailer):
391 # announce if possible. Avoid announcing backports, binary-only391 # announce if possible. Avoid announcing backports, binary-only
392 # security uploads, or autosync uploads.392 # security uploads, or autosync uploads.
393 if (action == 'accepted' and distroseries.changeslist393 if (action == 'accepted' and distroseries.changeslist
394 and not archive.is_ppa394 and archive.is_main
395 and pocket != PackagePublishingPocket.BACKPORTS395 and pocket != PackagePublishingPocket.BACKPORTS
396 and not (396 and not (
397 pocket == PackagePublishingPocket.SECURITY and spr is None)397 pocket == PackagePublishingPocket.SECURITY and spr is None)
diff --git a/lib/lp/soyuz/mail/tests/test_packageupload.py b/lib/lp/soyuz/mail/tests/test_packageupload.py
index 3e9c0b1..c7378f9 100644
--- a/lib/lp/soyuz/mail/tests/test_packageupload.py
+++ b/lib/lp/soyuz/mail/tests/test_packageupload.py
@@ -484,6 +484,60 @@ class TestNotification(TestCaseWithFactory):
484 [blamer, changer], changes, blamer, maintainer, changer,484 [blamer, changer], changes, blamer, maintainer, changer,
485 purpose=ArchivePurpose.PPA)485 purpose=ArchivePurpose.PPA)
486486
487 def test_getRecipientsForAction_primary(self):
488 blamer, maintainer, changer = self._setup_recipients()
489 changes = {
490 'Date': b'2001-01-01',
491 'Changed-By': b'Changer <changer@example.com>',
492 'Maintainer': b'Maintainer <maintainer@example.com>',
493 'Changes': b' * Foo!',
494 }
495 distribution = self.factory.makeDistribution()
496 archive = self.factory.makeArchive(
497 distribution=distribution, purpose=ArchivePurpose.PRIMARY)
498 distroseries = self.factory.makeDistroSeries(distribution=distribution)
499 distroseries.changeslist = "blah@example.com"
500 # Now set the uploaders.
501 component = getUtility(IComponentSet).ensure('main')
502 if component not in distroseries.components:
503 self.factory.makeComponentSelection(
504 distroseries=distroseries, component=component)
505 distribution.main_archive.newComponentUploader(maintainer, component)
506 distribution.main_archive.newComponentUploader(changer, component)
507 info = fetch_information(None, None, changes)
508 observed, _ = PackageUploadMailer.getRecipientsForAction(
509 'accepted', info, blamer, None, [], archive, distroseries,
510 PackagePublishingPocket.RELEASE)
511 email_addresses = [x.preferredemail.email for x in observed.keys()]
512 self.assertIn("blah@example.com", email_addresses)
513
514 def test_getRecipientsForAction_copy(self):
515 blamer, maintainer, changer = self._setup_recipients()
516 changes = {
517 'Date': b'2001-01-01',
518 'Changed-By': b'Changer <changer@example.com>',
519 'Maintainer': b'Maintainer <maintainer@example.com>',
520 'Changes': b' * Foo!',
521 }
522 distribution = self.factory.makeDistribution()
523 archive = self.factory.makeArchive(
524 distribution=distribution, purpose=ArchivePurpose.COPY)
525 distroseries = self.factory.makeDistroSeries(distribution=distribution)
526 distroseries.changeslist = "blah@example.com"
527 # Now set the uploaders.
528 component = getUtility(IComponentSet).ensure('main')
529 if component not in distroseries.components:
530 self.factory.makeComponentSelection(
531 distroseries=distroseries, component=component)
532 distribution.main_archive.newComponentUploader(maintainer, component)
533 distribution.main_archive.newComponentUploader(changer, component)
534 info = fetch_information(None, None, changes)
535 observed, _ = PackageUploadMailer.getRecipientsForAction(
536 'accepted', info, blamer, None, [], archive, distroseries,
537 PackagePublishingPocket.RELEASE)
538 email_addresses = [x.preferredemail.email for x in observed.keys()]
539 self.assertNotIn("blah@example.com", email_addresses)
540
487 def test__getHeaders_primary(self):541 def test__getHeaders_primary(self):
488 # _getHeaders returns useful values for headers used for filtering.542 # _getHeaders returns useful values for headers used for filtering.
489 # For a primary archive, this includes the maintainer and changer.543 # For a primary archive, this includes the maintainer and changer.

Subscribers

People subscribed via source and target branches

to status/vote changes: