~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/doc/bugsubscription.txt

Undo rename. Again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
379
379
    >>> linux_source_bug.getSubscribersFromDuplicates()
380
380
    ()
381
381
 
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.
385
 
 
386
 
We current use a feature flag to control who is subscribed when a bug is made
387
 
private.
388
 
 
389
 
    >>> from lp.services.features.testing import FeatureFixture
390
 
    >>> feature_flag = {'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
391
 
    >>> flags = FeatureFixture(feature_flag)
392
 
    >>> flags.setUp()
 
382
When a bug is marked private, all its indirect subscribers become direct
 
383
subscribers.
393
384
 
394
385
    >>> from zope.event import notify
395
386
 
412
403
    >>> print_displayname(linux_source_bug.getDirectSubscribers())
413
404
    Foo Bar
414
405
    Mark Shuttleworth
 
406
    No Privileges Person
415
407
    Robert Collins
 
408
    Sample Person
 
409
    Scott James Remnant
416
410
    Ubuntu Team
417
411
 
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.
 
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.
420
416
 
421
417
    >>> linux_source_bug.bugtasks[0].transitionToAssignee(
422
418
    ...     personset.getByName("martin-pitt"))
427
423
    >>> linux_source_bug.getSubscribersFromDuplicates()
428
424
    ()
429
425
 
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.
 
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.
433
429
 
434
430
    >>> linux_source_bug.setPrivate(False, getUtility(ILaunchBag).user)
435
431
    True
438
434
    >>> print_displayname(linux_source_bug.getDirectSubscribers())
439
435
    Foo Bar
440
436
    Mark Shuttleworth
 
437
    No Privileges Person
 
438
    Robert Collins
 
439
    Sample Person
 
440
    Scott James Remnant
 
441
    Ubuntu Team
441
442
 
442
443
    >>> print_displayname(linux_source_bug.getIndirectSubscribers())
443
444
    Martin Pitt
444
 
    No Privileges Person
445
 
    Robert Collins
446
 
    Sample Person
447
 
    Scott James Remnant
448
 
    Ubuntu Team
449
445
 
450
446
    >>> print_displayname(linux_source_bug.getAlsoNotifiedSubscribers())
451
447
    Martin Pitt
452
 
    No Privileges Person
453
 
    Robert Collins
454
 
    Sample Person
455
 
    Scott James Remnant
456
 
    Ubuntu Team
457
 
 
458
 
Clean up the feature flag.
459
 
 
460
 
    >>> flags.cleanUp()
461
448
 
462
449
To find out which email addresses should receive a notification email on
463
450
a bug, and why, IBug.getBugNotificationRecipients() assembles an
471
458
    >>> [(address, recipients.getReason(address)[1]) for address in addresses]
472
459
    [('foo.bar@canonical.com', 'Subscriber'),
473
460
     ('mark@example.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')]
 
461
     ('no-priv@canonical.com', 'Subscriber'),
 
462
     ('robertc@robertcollins.net', 'Subscriber'),
 
463
     ('support@ubuntu.com', u'Subscriber @ubuntu-team'),
 
464
     ('test@canonical.com', 'Subscriber')]
478
465
 
479
466
If IBug.getBugNotificationRecipients() is passed a  BugNotificationLevel
480
467
in its `level` parameter, only structural subscribers with that
481
 
notification level or higher will be returned.
 
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.
482
473
 
483
474
    >>> recipients = linux_source_bug.getBugNotificationRecipients(
484
475
    ...     level=BugNotificationLevel.COMMENTS)
486
477
    >>> [(address, recipients.getReason(address)[1]) for address in addresses]
487
478
    [('foo.bar@canonical.com', 'Subscriber'),
488
479
     ('mark@example.com', 'Subscriber'),
489
 
     ('robertc@robertcollins.net', u'Subscriber (Mozilla Firefox)'),
490
 
     ('support@ubuntu.com', u'Subscriber (Ubuntu) @ubuntu-team'),
491
 
     ('test@canonical.com', 'Assignee')]
 
480
     ('no-priv@canonical.com', 'Subscriber'),
 
481
     ('robertc@robertcollins.net', 'Subscriber'),
 
482
     ('support@ubuntu.com', u'Subscriber @ubuntu-team'),
 
483
     ('test@canonical.com', 'Subscriber')]
492
484
 
493
485
When Sample Person is unsubscribed from linux_source_bug, he is no
494
486
longer included in the result of getBugNotificationRecipients() for
501
493
    >>> [(address, recipients.getReason(address)[1]) for address in addresses]
502
494
    [('foo.bar@canonical.com', 'Subscriber'),
503
495
     ('mark@example.com', 'Subscriber'),
504
 
     ('robertc@robertcollins.net', u'Subscriber (Mozilla Firefox)'),
505
 
     ('support@ubuntu.com', u'Subscriber (Ubuntu) @ubuntu-team'),
506
 
     ('test@canonical.com', 'Assignee')]
 
496
     ('robertc@robertcollins.net', 'Subscriber'),
 
497
     ('support@ubuntu.com', u'Subscriber @ubuntu-team'),
 
498
     ('test@canonical.com', 'Subscriber')]
507
499
 
508
500
...but remains included for the level LIFECYCLE.
509
501
 
515
507
    [('foo.bar@canonical.com', 'Subscriber'),
516
508
     ('mark@example.com', 'Subscriber'),
517
509
     ('no-priv@canonical.com', u'Subscriber (linux-source-2.6.15 in Ubuntu)'),
518
 
     ('robertc@robertcollins.net', u'Subscriber (Mozilla Firefox)'),
519
 
     ('support@ubuntu.com', u'Subscriber (Ubuntu) @ubuntu-team'),
520
 
     ('test@canonical.com', 'Assignee')]
 
510
     ('robertc@robertcollins.net', 'Subscriber'),
 
511
     ('support@ubuntu.com', u'Subscriber @ubuntu-team'),
 
512
     ('test@canonical.com', 'Subscriber')]
521
513
 
522
514
To find out if someone is already directly subscribed to a bug, call
523
515
IBug.isSubscribed, passing in an IPerson:
524
516
 
525
517
    >>> linux_source_bug.isSubscribed(personset.getByName("debonzi"))
526
518
    False
527
 
    >>> name16 = personset.getByName("name16")
528
 
    >>> linux_source_bug.isSubscribed(name16)
 
519
    >>> linux_source_bug.isSubscribed(sample_person)
529
520
    True
530
521
 
531
522
Call isSubscribedToDupes to see if a user is directly subscribed to