379
379
>>> linux_source_bug.getSubscribersFromDuplicates()
382
When a bug is marked private, all its indirect subscribers become direct
382
When a bug is marked private, specific people like the bugtask bug supervisors
383
will be automatically subscribed, and only specifically allowed existing
384
direct subscribers (eg bugtask pillar maintainers) will remain subscribed.
386
We current use a feature flag to control who is subscribed when a bug is made
389
>>> from lp.services.features.testing import FeatureFixture
390
>>> feature_flag = {'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
391
>>> flags = FeatureFixture(feature_flag)
385
394
>>> from zope.event import notify
403
412
>>> print_displayname(linux_source_bug.getDirectSubscribers())
405
414
Mark Shuttleworth
412
A private bug never has indirect subscribers. Since all our indirect
413
subscribers have been made into direct subscribers, let's add another
414
indirect subscriber to show that they still aren't included in the
415
indirect subscriptions.
418
A private bug never has indirect subscribers. Let's add an indirect subscriber
419
to show that they still aren't included in the indirect subscriptions.
417
421
>>> linux_source_bug.bugtasks[0].transitionToAssignee(
418
422
... personset.getByName("martin-pitt"))
423
427
>>> linux_source_bug.getSubscribersFromDuplicates()
426
Direct subscriptions always take precedence over indirect
427
subscriptions. So, if we unmark the above bug as private,
428
indirect_subscribers will include only martin-pitt.
430
Direct subscriptions always take precedence over indirect subscriptions.
431
So, if we unmark the above bug as private, indirect_subscribers will include
432
any subscribers not converted to direct subscribers.
430
434
>>> linux_source_bug.setPrivate(False, getUtility(ILaunchBag).user)
434
438
>>> print_displayname(linux_source_bug.getDirectSubscribers())
436
440
Mark Shuttleworth
443
442
>>> print_displayname(linux_source_bug.getIndirectSubscribers())
446
450
>>> print_displayname(linux_source_bug.getAlsoNotifiedSubscribers())
458
Clean up the feature flag.
449
462
To find out which email addresses should receive a notification email on
450
463
a bug, and why, IBug.getBugNotificationRecipients() assembles an
458
471
>>> [(address, recipients.getReason(address)[1]) for address in addresses]
459
472
[('foo.bar@canonical.com', 'Subscriber'),
460
473
('mark@example.com', 'Subscriber'),
461
('no-priv@canonical.com', 'Subscriber'),
462
('robertc@robertcollins.net', 'Subscriber'),
463
('support@ubuntu.com', u'Subscriber @ubuntu-team'),
464
('test@canonical.com', 'Subscriber')]
474
('no-priv@canonical.com', u'Subscriber (linux-source-2.6.15 in Ubuntu)'),
475
('robertc@robertcollins.net', u'Subscriber (Mozilla Firefox)'),
476
('support@ubuntu.com', u'Subscriber (Ubuntu) @ubuntu-team'),
477
('test@canonical.com', 'Assignee')]
466
479
If IBug.getBugNotificationRecipients() is passed a BugNotificationLevel
467
480
in its `level` parameter, only structural subscribers with that
468
notification level or higher will be returned. When the linux_source_bug
469
was temporarily set to "private", the structural subscriber Sample Person
470
was directly subscribed, thus he is returned by
471
getBugNotificationRecipients() even if the parameter level is larger than
472
his structural subscription setting.
481
notification level or higher will be returned.
474
483
>>> recipients = linux_source_bug.getBugNotificationRecipients(
475
484
... level=BugNotificationLevel.COMMENTS)
477
486
>>> [(address, recipients.getReason(address)[1]) for address in addresses]
478
487
[('foo.bar@canonical.com', 'Subscriber'),
479
488
('mark@example.com', 'Subscriber'),
480
('no-priv@canonical.com', 'Subscriber'),
481
('robertc@robertcollins.net', 'Subscriber'),
482
('support@ubuntu.com', u'Subscriber @ubuntu-team'),
483
('test@canonical.com', 'Subscriber')]
489
('robertc@robertcollins.net', u'Subscriber (Mozilla Firefox)'),
490
('support@ubuntu.com', u'Subscriber (Ubuntu) @ubuntu-team'),
491
('test@canonical.com', 'Assignee')]
485
493
When Sample Person is unsubscribed from linux_source_bug, he is no
486
494
longer included in the result of getBugNotificationRecipients() for
493
501
>>> [(address, recipients.getReason(address)[1]) for address in addresses]
494
502
[('foo.bar@canonical.com', 'Subscriber'),
495
503
('mark@example.com', 'Subscriber'),
496
('robertc@robertcollins.net', 'Subscriber'),
497
('support@ubuntu.com', u'Subscriber @ubuntu-team'),
498
('test@canonical.com', 'Subscriber')]
504
('robertc@robertcollins.net', u'Subscriber (Mozilla Firefox)'),
505
('support@ubuntu.com', u'Subscriber (Ubuntu) @ubuntu-team'),
506
('test@canonical.com', 'Assignee')]
500
508
...but remains included for the level LIFECYCLE.
507
515
[('foo.bar@canonical.com', 'Subscriber'),
508
516
('mark@example.com', 'Subscriber'),
509
517
('no-priv@canonical.com', u'Subscriber (linux-source-2.6.15 in Ubuntu)'),
510
('robertc@robertcollins.net', 'Subscriber'),
511
('support@ubuntu.com', u'Subscriber @ubuntu-team'),
512
('test@canonical.com', 'Subscriber')]
518
('robertc@robertcollins.net', u'Subscriber (Mozilla Firefox)'),
519
('support@ubuntu.com', u'Subscriber (Ubuntu) @ubuntu-team'),
520
('test@canonical.com', 'Assignee')]
514
522
To find out if someone is already directly subscribed to a bug, call
515
523
IBug.isSubscribed, passing in an IPerson:
517
525
>>> linux_source_bug.isSubscribed(personset.getByName("debonzi"))
519
>>> linux_source_bug.isSubscribed(sample_person)
527
>>> name16 = personset.getByName("name16")
528
>>> linux_source_bug.isSubscribed(name16)
522
531
Call isSubscribedToDupes to see if a user is directly subscribed to