Merge lp:~allenap/launchpad/prune-bug-notification-recipients into lp:launchpad
- prune-bug-notification-recipients
- Merge into devel
Proposed by
Gavin Panella
on 2010-12-07
| Status: | Merged |
|---|---|
| Approved by: | Māris Fogels on 2010-12-07 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 12025 |
| Proposed branch: | lp:~allenap/launchpad/prune-bug-notification-recipients |
| Merge into: | lp:launchpad |
| Diff against target: |
554 lines (+205/-232) 2 files modified
lib/lp/bugs/doc/bugnotificationrecipients.txt (+205/-206) lib/lp/bugs/mail/bugnotificationrecipients.py (+0/-26) |
| To merge this branch: | bzr merge lp:~allenap/launchpad/prune-bug-notification-recipients |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Māris Fogels (community) | 2010-12-07 | Approve on 2010-12-07 | |
|
Review via email:
|
|||
Commit Message
[r=mars]
Description of the Change
Remove a couple of unused methods in BugNotification
I have a lint fix for the doctest. I'll land that with the branch but I haven't pushed it yet so that the diff isn't noisy.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'lib/lp/bugs/doc/bugnotificationrecipients.txt' |
| 2 | --- lib/lp/bugs/doc/bugnotificationrecipients.txt 2010-10-18 22:24:59 +0000 |
| 3 | +++ lib/lp/bugs/doc/bugnotificationrecipients.txt 2010-12-07 17:03:30 +0000 |
| 4 | @@ -4,55 +4,62 @@ |
| 5 | the INotificationRecipientSet interface for bug notifications. (See |
| 6 | notification-recipient-set.txt for the details.) |
| 7 | |
| 8 | -== How it's used == |
| 9 | +How it's used |
| 10 | +============= |
| 11 | |
| 12 | The IBug.getBugNotificationRecipients() implementation creates and uses |
| 13 | BugNotificationRecipients instances. Here's an example of this in |
| 14 | action: |
| 15 | |
| 16 | - >>> from lp.bugs.model.bug import Bug |
| 17 | - >>> from lp.registry.model.distribution import Distribution |
| 18 | - >>> from lp.registry.model.product import Product |
| 19 | - >>> bug_one = Bug.get(1) |
| 20 | - >>> recipients = bug_one.getBugNotificationRecipients() |
| 21 | + >>> from lp.bugs.model.bug import Bug |
| 22 | + >>> from lp.registry.model.distribution import Distribution |
| 23 | + >>> from lp.registry.model.product import Product |
| 24 | + >>> bug_one = Bug.get(1) |
| 25 | + >>> recipients = bug_one.getBugNotificationRecipients() |
| 26 | |
| 27 | The instance of BugNotificationRecipients we get back correctly |
| 28 | implements INotificationRecipientSet: |
| 29 | |
| 30 | - >>> from canonical.launchpad.interfaces.launchpad import INotificationRecipientSet |
| 31 | - >>> from canonical.launchpad.webapp.testing import verifyObject |
| 32 | - >>> verifyObject(INotificationRecipientSet, recipients) |
| 33 | - True |
| 34 | + >>> from canonical.launchpad.interfaces.launchpad import ( |
| 35 | + ... INotificationRecipientSet, |
| 36 | + ... ) |
| 37 | + >>> from canonical.launchpad.webapp.testing import verifyObject |
| 38 | + >>> verifyObject(INotificationRecipientSet, recipients) |
| 39 | + True |
| 40 | |
| 41 | This instance contains email addresses and rationales. Let's define a |
| 42 | helper function so we can format this output: |
| 43 | |
| 44 | - >>> def print_rationales(rationale): |
| 45 | - ... for address in rationale.getEmails(): |
| 46 | - ... text, header = rationale.getReason(address) |
| 47 | - ... print address |
| 48 | - ... print " %s" % header |
| 49 | - ... print " %s" % text |
| 50 | + >>> def print_rationales(rationale): |
| 51 | + ... for address in rationale.getEmails(): |
| 52 | + ... text, header = rationale.getReason(address) |
| 53 | + ... print address |
| 54 | + ... print " %s" % header |
| 55 | + ... print " %s" % text |
| 56 | |
| 57 | And print them out. The first line is the email address; second is the |
| 58 | text appropriate to be used in an X- header, and the last is the text |
| 59 | appropriate for an email footer. |
| 60 | |
| 61 | - >>> print_rationales(recipients) |
| 62 | - foo.bar@canonical.com |
| 63 | - Subscriber (mozilla-firefox in ubuntu) |
| 64 | - You received this bug notification because you are subscribed to mozilla-firefox in ubuntu. |
| 65 | - mark@example.com |
| 66 | - Assignee |
| 67 | - You received this bug notification because you are a bug assignee. |
| 68 | - support@ubuntu.com |
| 69 | - Registrant (Ubuntu) @ubuntu-team |
| 70 | - You received this bug notification because you are a member of Ubuntu Team, which is the registrant for Ubuntu. |
| 71 | - test@canonical.com |
| 72 | - Subscriber |
| 73 | - You received this bug notification because you are a direct subscriber of the bug. |
| 74 | + >>> print_rationales(recipients) |
| 75 | + foo.bar@canonical.com |
| 76 | + Subscriber (mozilla-firefox in ubuntu) |
| 77 | + You received this bug notification because you are subscribed |
| 78 | + to mozilla-firefox in ubuntu. |
| 79 | + mark@example.com |
| 80 | + Assignee |
| 81 | + You received this bug notification because you are a bug assignee. |
| 82 | + support@ubuntu.com |
| 83 | + Registrant (Ubuntu) @ubuntu-team |
| 84 | + You received this bug notification because you are a member of |
| 85 | + Ubuntu Team, which is the registrant for Ubuntu. |
| 86 | + test@canonical.com |
| 87 | + Subscriber |
| 88 | + You received this bug notification because you are a direct |
| 89 | + subscriber of the bug. |
| 90 | |
| 91 | -== The Bug-BugNotificationRecipients API == |
| 92 | +The Bug-BugNotificationRecipients API |
| 93 | +===================================== |
| 94 | |
| 95 | Most of the API of BugNotificationRecipients is actually kept private |
| 96 | between the Bug class and itself. Let's now demonstrate the API that Bug |
| 97 | @@ -62,125 +69,111 @@ |
| 98 | |
| 99 | Let's up some data for our test: |
| 100 | |
| 101 | - >>> from lp.registry.interfaces.person import IPersonSet |
| 102 | - >>> from lp.bugs.mail.bugnotificationrecipients import ( |
| 103 | - ... BugNotificationRecipients) |
| 104 | - >>> debian = Distribution.selectOneBy(name="debian") |
| 105 | - >>> pmount = debian.getSourcePackage("pmount") |
| 106 | - >>> alsa_utils = Product.selectOneBy(name="alsa-utils") |
| 107 | - >>> gnomebaker = Product.selectOneBy(name="gnomebaker") |
| 108 | - >>> personset = getUtility(IPersonSet) |
| 109 | + >>> from lp.registry.interfaces.person import IPersonSet |
| 110 | + >>> from lp.bugs.mail.bugnotificationrecipients import ( |
| 111 | + ... BugNotificationRecipients) |
| 112 | + >>> debian = Distribution.selectOneBy(name="debian") |
| 113 | + >>> pmount = debian.getSourcePackage("pmount") |
| 114 | + >>> alsa_utils = Product.selectOneBy(name="alsa-utils") |
| 115 | + >>> gnomebaker = Product.selectOneBy(name="gnomebaker") |
| 116 | + >>> personset = getUtility(IPersonSet) |
| 117 | |
| 118 | Here's where getBugNotificationRecipients() starts off. First, a |
| 119 | BugNotificationRecipients instance is created: |
| 120 | |
| 121 | - >>> recipients = BugNotificationRecipients() |
| 122 | + >>> recipients = BugNotificationRecipients() |
| 123 | |
| 124 | Then, subscribers of various types are added: |
| 125 | |
| 126 | - >>> foo_bar = personset.getByEmail("foo.bar@canonical.com") |
| 127 | - >>> recipients.addDupeSubscriber(foo_bar) |
| 128 | - |
| 129 | - >>> test = personset.getByEmail("test@canonical.com") |
| 130 | - >>> recipients.addDirectSubscriber(test) |
| 131 | - |
| 132 | - >>> no_priv = personset.getByEmail("no-priv@canonical.com") |
| 133 | - >>> recipients.addAssignee(no_priv) |
| 134 | - |
| 135 | - >>> daf = personset.getByEmail("daf@canonical.com") |
| 136 | - >>> recipients.addDistroBugSupervisor(daf, debian) |
| 137 | - |
| 138 | - >>> carlos = personset.getByEmail("carlos@canonical.com") |
| 139 | - >>> recipients.addStructuralSubscriber(carlos, pmount) |
| 140 | - |
| 141 | - >>> marilize = personset.getByEmail("marilize@hbd.com") |
| 142 | - >>> recipients.addUpstreamBugSupervisor(marilize, alsa_utils) |
| 143 | - |
| 144 | - >>> testtest = personset.getByEmail("testtest@canonical.com") |
| 145 | - >>> recipients.addRegistrant(testtest, gnomebaker) |
| 146 | + >>> foo_bar = personset.getByEmail("foo.bar@canonical.com") |
| 147 | + >>> recipients.addDupeSubscriber(foo_bar) |
| 148 | + |
| 149 | + >>> test = personset.getByEmail("test@canonical.com") |
| 150 | + >>> recipients.addDirectSubscriber(test) |
| 151 | + |
| 152 | + >>> no_priv = personset.getByEmail("no-priv@canonical.com") |
| 153 | + >>> recipients.addAssignee(no_priv) |
| 154 | + |
| 155 | + >>> carlos = personset.getByEmail("carlos@canonical.com") |
| 156 | + >>> recipients.addStructuralSubscriber(carlos, pmount) |
| 157 | + |
| 158 | + >>> testtest = personset.getByEmail("testtest@canonical.com") |
| 159 | + >>> recipients.addRegistrant(testtest, gnomebaker) |
| 160 | |
| 161 | If we print out the recipients and rationales, here's what we get: |
| 162 | |
| 163 | - >>> print_rationales(recipients) |
| 164 | - carlos@canonical.com |
| 165 | - Subscriber (pmount in debian) |
| 166 | - You received this bug notification because you are subscribed to pmount in debian. |
| 167 | - daf@canonical.com |
| 168 | - Bug Supervisor (Debian) |
| 169 | - You received this bug notification because you are the bug supervisor for Debian. |
| 170 | - foo.bar@canonical.com |
| 171 | - Subscriber of Duplicate |
| 172 | - You received this bug notification because you are a direct subscriber of a duplicate bug. |
| 173 | - marilize@hbd.com |
| 174 | - Bug Supervisor (alsa-utils) |
| 175 | - You received this bug notification because you are the bug supervisor for alsa-utils. |
| 176 | - no-priv@canonical.com |
| 177 | - Assignee |
| 178 | - You received this bug notification because you are a bug assignee. |
| 179 | - test@canonical.com |
| 180 | - Subscriber |
| 181 | - You received this bug notification because you are a direct subscriber of the bug. |
| 182 | + >>> print_rationales(recipients) |
| 183 | + carlos@canonical.com |
| 184 | + Subscriber (pmount in debian) |
| 185 | + You received this bug notification because you are subscribed |
| 186 | + to pmount in debian. |
| 187 | + foo.bar@canonical.com |
| 188 | + Subscriber of Duplicate |
| 189 | + You received this bug notification because you are a direct |
| 190 | + subscriber of a duplicate bug. |
| 191 | + no-priv@canonical.com |
| 192 | + Assignee |
| 193 | + You received this bug notification because you are a bug |
| 194 | + assignee. |
| 195 | + test@canonical.com |
| 196 | + Subscriber |
| 197 | + You received this bug notification because you are a direct |
| 198 | + subscriber of the bug. |
| 199 | |
| 200 | Note how we account for every important variation in bug subscriptions |
| 201 | here: bug supervisors, subscribers, dupe subscribers and more. |
| 202 | |
| 203 | -== A duplicate bug modification notifies its main bug == |
| 204 | +A duplicate bug modification notifies its main bug |
| 205 | +================================================== |
| 206 | |
| 207 | If the bug we are changing is actually a duplicate of another bug, an |
| 208 | additional step is involved. A BugNotificationRecipients instance is |
| 209 | created, annotating that it represents a master bug (of which we are a |
| 210 | duplicate of). |
| 211 | |
| 212 | - >>> bug_two = Bug.get(2) |
| 213 | - >>> recipients = BugNotificationRecipients(duplicateof=bug_two) |
| 214 | - |
| 215 | - >>> foo_bar = personset.getByEmail("foo.bar@canonical.com") |
| 216 | - >>> recipients.addDupeSubscriber(foo_bar) |
| 217 | - |
| 218 | - >>> test = personset.getByEmail("test@canonical.com") |
| 219 | - >>> recipients.addDirectSubscriber(test) |
| 220 | - |
| 221 | - >>> no_priv = personset.getByEmail("no-priv@canonical.com") |
| 222 | - >>> recipients.addAssignee(no_priv) |
| 223 | - |
| 224 | - >>> daf = personset.getByEmail("daf@canonical.com") |
| 225 | - >>> recipients.addDistroBugSupervisor(daf, debian) |
| 226 | - |
| 227 | - >>> carlos = personset.getByEmail("carlos@canonical.com") |
| 228 | - >>> recipients.addStructuralSubscriber(carlos, pmount) |
| 229 | - |
| 230 | - >>> marilize = personset.getByEmail("marilize@hbd.com") |
| 231 | - >>> recipients.addUpstreamBugSupervisor(marilize, alsa_utils) |
| 232 | - |
| 233 | - >>> testtest = personset.getByEmail("testtest@canonical.com") |
| 234 | - >>> recipients.addRegistrant(testtest, gnomebaker) |
| 235 | + >>> bug_two = Bug.get(2) |
| 236 | + >>> recipients = BugNotificationRecipients(duplicateof=bug_two) |
| 237 | + |
| 238 | + >>> foo_bar = personset.getByEmail("foo.bar@canonical.com") |
| 239 | + >>> recipients.addDupeSubscriber(foo_bar) |
| 240 | + |
| 241 | + >>> test = personset.getByEmail("test@canonical.com") |
| 242 | + >>> recipients.addDirectSubscriber(test) |
| 243 | + |
| 244 | + >>> no_priv = personset.getByEmail("no-priv@canonical.com") |
| 245 | + >>> recipients.addAssignee(no_priv) |
| 246 | + |
| 247 | + >>> carlos = personset.getByEmail("carlos@canonical.com") |
| 248 | + >>> recipients.addStructuralSubscriber(carlos, pmount) |
| 249 | + |
| 250 | + >>> testtest = personset.getByEmail("testtest@canonical.com") |
| 251 | + >>> recipients.addRegistrant(testtest, gnomebaker) |
| 252 | |
| 253 | If you print out rationales in this situation, you'll see that the |
| 254 | message says "via Bug 2". The reason for this is that the people being |
| 255 | notified here are actually subscribed to bug 2, and they may be asking |
| 256 | themselves why the hell they are getting email for bug 1. |
| 257 | |
| 258 | - >>> print_rationales(recipients) |
| 259 | - carlos@canonical.com |
| 260 | - Subscriber (pmount in debian) via Bug 2 |
| 261 | - You received this bug notification because you are subscribed to pmount in debian (via bug 2). |
| 262 | - daf@canonical.com |
| 263 | - Bug Supervisor (Debian) via Bug 2 |
| 264 | - You received this bug notification because you are the bug supervisor for Debian (via bug 2). |
| 265 | - foo.bar@canonical.com |
| 266 | - Subscriber of Duplicate via Bug 2 |
| 267 | - You received this bug notification because you are a direct subscriber of a duplicate bug (via bug 2). |
| 268 | - marilize@hbd.com |
| 269 | - Bug Supervisor (alsa-utils) via Bug 2 |
| 270 | - You received this bug notification because you are the bug supervisor for alsa-utils (via bug 2). |
| 271 | - no-priv@canonical.com |
| 272 | - Assignee via Bug 2 |
| 273 | - You received this bug notification because you are a bug assignee (via bug 2). |
| 274 | - test@canonical.com |
| 275 | - Subscriber via Bug 2 |
| 276 | - You received this bug notification because you are a direct subscriber of the bug (via bug 2). |
| 277 | + >>> print_rationales(recipients) |
| 278 | + carlos@canonical.com |
| 279 | + Subscriber (pmount in debian) via Bug 2 |
| 280 | + You received this bug notification because you are subscribed |
| 281 | + to pmount in debian (via bug 2). |
| 282 | + foo.bar@canonical.com |
| 283 | + Subscriber of Duplicate via Bug 2 |
| 284 | + You received this bug notification because you are a direct |
| 285 | + subscriber of a duplicate bug (via bug 2). |
| 286 | + no-priv@canonical.com |
| 287 | + Assignee via Bug 2 |
| 288 | + You received this bug notification because you are a bug |
| 289 | + assignee (via bug 2). |
| 290 | + test@canonical.com |
| 291 | + Subscriber via Bug 2 |
| 292 | + You received this bug notification because you are a direct |
| 293 | + subscriber of the bug (via bug 2). |
| 294 | |
| 295 | -== Team subscribers are special == |
| 296 | +Team subscribers are special |
| 297 | +============================ |
| 298 | |
| 299 | In the case where the teams are subscribers, things vary according to |
| 300 | whether the team has a contact email address or not. When there is no |
| 301 | @@ -190,71 +183,72 @@ |
| 302 | |
| 303 | Here's an example of this situation: |
| 304 | |
| 305 | - >>> recipients = BugNotificationRecipients() |
| 306 | - >>> testing_spanish_team = personset.getByName("testing-spanish-team") |
| 307 | - >>> recipients.addDupeSubscriber(testing_spanish_team) |
| 308 | - |
| 309 | - >>> guadamen = personset.getByName("guadamen") |
| 310 | - >>> recipients.addAssignee(guadamen) |
| 311 | - |
| 312 | - >>> name20 = personset.getByName("name20") |
| 313 | - >>> recipients.addStructuralSubscriber(name20, pmount) |
| 314 | - |
| 315 | - >>> name18 = personset.getByName("name18") |
| 316 | - >>> recipients.addUpstreamBugSupervisor(name18, alsa_utils) |
| 317 | - |
| 318 | - >>> vcs_imports = personset.getByName("vcs-imports") |
| 319 | - >>> recipients.addRegistrant(vcs_imports, gnomebaker) |
| 320 | - |
| 321 | - >>> shipit_admins = personset.getByName("shipit-admins") |
| 322 | - >>> recipients.addDirectSubscriber(shipit_admins) |
| 323 | - |
| 324 | - >>> launchpad_buildd_admins = personset.getByName("launchpad-buildd-admins") |
| 325 | - >>> recipients.addDistroBugSupervisor(launchpad_buildd_admins, debian) |
| 326 | + >>> recipients = BugNotificationRecipients() |
| 327 | + >>> testing_spanish_team = personset.getByName("testing-spanish-team") |
| 328 | + >>> recipients.addDupeSubscriber(testing_spanish_team) |
| 329 | + |
| 330 | + >>> guadamen = personset.getByName("guadamen") |
| 331 | + >>> recipients.addAssignee(guadamen) |
| 332 | + |
| 333 | + >>> name20 = personset.getByName("name20") |
| 334 | + >>> recipients.addStructuralSubscriber(name20, pmount) |
| 335 | + |
| 336 | + >>> vcs_imports = personset.getByName("vcs-imports") |
| 337 | + >>> recipients.addRegistrant(vcs_imports, gnomebaker) |
| 338 | + |
| 339 | + >>> shipit_admins = personset.getByName("shipit-admins") |
| 340 | + >>> recipients.addDirectSubscriber(shipit_admins) |
| 341 | |
| 342 | You'll notice that the rationales this time state clearly which team |
| 343 | membership is causing us to send mail. |
| 344 | |
| 345 | - >>> print_rationales(recipients) |
| 346 | - andrew.bennetts@ubuntulinux.com |
| 347 | - Bug Supervisor (alsa-utils) @name18 |
| 348 | - You received this bug notification because you are a member of Ubuntu Gnome Team, which is the bug supervisor for alsa-utils. |
| 349 | - carlos@canonical.com |
| 350 | - Subscriber of Duplicate @testing-spanish-team |
| 351 | - You received this bug notification because you are a member of testing Spanish team, which is a subscriber of a duplicate bug. |
| 352 | - celso.providelo@canonical.com |
| 353 | - Bug Supervisor (Debian) @launchpad-buildd-admins |
| 354 | - You received this bug notification because you are a member of Launchpad Buildd Admins, which is the bug supervisor for Debian. |
| 355 | - david.allouche@canonical.com |
| 356 | - Registrant (gnomebaker) @vcs-imports |
| 357 | - You received this bug notification because you are a member of VCS imports, which is the registrant for gnomebaker. |
| 358 | - foo.bar@canonical.com |
| 359 | - Subscriber of Duplicate @testing-spanish-team |
| 360 | - You received this bug notification because you are a member of testing Spanish team, which is a subscriber of a duplicate bug. |
| 361 | - kurem@debian.cz |
| 362 | - Subscriber of Duplicate @testing-spanish-team |
| 363 | - You received this bug notification because you are a member of testing Spanish team, which is a subscriber of a duplicate bug. |
| 364 | - limi@plone.org |
| 365 | - Bug Supervisor (alsa-utils) @name18 |
| 366 | - You received this bug notification because you are a member of Ubuntu Gnome Team, which is the bug supervisor for alsa-utils. |
| 367 | - marilize@hbd.com |
| 368 | - Subscriber @shipit-admins |
| 369 | - You received this bug notification because you are a member of ShipIt Administrators, which is a direct subscriber. |
| 370 | - mark@example.com |
| 371 | - Subscriber of Duplicate @testing-spanish-team |
| 372 | - You received this bug notification because you are a member of testing Spanish team, which is a subscriber of a duplicate bug. |
| 373 | - robertc@robertcollins.net |
| 374 | - Registrant (gnomebaker) @vcs-imports |
| 375 | - You received this bug notification because you are a member of VCS imports, which is the registrant for gnomebaker. |
| 376 | - support@ubuntu.com |
| 377 | - Assignee @guadamen |
| 378 | - You received this bug notification because you are a member of GuadaMen, which is a bug assignee. |
| 379 | - test@canonical.com |
| 380 | - Subscriber (pmount in debian) @name20 |
| 381 | - You received this bug notification because you are a member of Warty Security Team, which is subscribed to pmount in debian. |
| 382 | - tsukimi@quaqua.net |
| 383 | - Subscriber of Duplicate @testing-spanish-team |
| 384 | - You received this bug notification because you are a member of testing Spanish team, which is a subscriber of a duplicate bug. |
| 385 | + >>> print_rationales(recipients) |
| 386 | + carlos@canonical.com |
| 387 | + Subscriber of Duplicate @testing-spanish-team |
| 388 | + You received this bug notification because you are a member |
| 389 | + of testing Spanish team, which is a subscriber of a |
| 390 | + duplicate bug. |
| 391 | + david.allouche@canonical.com |
| 392 | + Registrant (gnomebaker) @vcs-imports |
| 393 | + You received this bug notification because you are a member |
| 394 | + of VCS imports, which is the registrant for gnomebaker. |
| 395 | + foo.bar@canonical.com |
| 396 | + Subscriber of Duplicate @testing-spanish-team |
| 397 | + You received this bug notification because you are a member |
| 398 | + of testing Spanish team, which is a subscriber of a |
| 399 | + duplicate bug. |
| 400 | + kurem@debian.cz |
| 401 | + Subscriber of Duplicate @testing-spanish-team |
| 402 | + You received this bug notification because you are a member |
| 403 | + of testing Spanish team, which is a subscriber of a |
| 404 | + duplicate bug. |
| 405 | + marilize@hbd.com |
| 406 | + Subscriber @shipit-admins |
| 407 | + You received this bug notification because you are a member |
| 408 | + of ShipIt Administrators, which is a direct subscriber. |
| 409 | + mark@example.com |
| 410 | + Subscriber of Duplicate @testing-spanish-team |
| 411 | + You received this bug notification because you are a member |
| 412 | + of testing Spanish team, which is a subscriber of a |
| 413 | + duplicate bug. |
| 414 | + robertc@robertcollins.net |
| 415 | + Registrant (gnomebaker) @vcs-imports |
| 416 | + You received this bug notification because you are a member |
| 417 | + of VCS imports, which is the registrant for gnomebaker. |
| 418 | + support@ubuntu.com |
| 419 | + Assignee @guadamen |
| 420 | + You received this bug notification because you are a member |
| 421 | + of GuadaMen, which is a bug assignee. |
| 422 | + test@canonical.com |
| 423 | + Subscriber (pmount in debian) @name20 |
| 424 | + You received this bug notification because you are a member |
| 425 | + of Warty Security Team, which is subscribed to pmount in |
| 426 | + debian. |
| 427 | + tsukimi@quaqua.net |
| 428 | + Subscriber of Duplicate @testing-spanish-team |
| 429 | + You received this bug notification because you are a member |
| 430 | + of testing Spanish team, which is a subscriber of a |
| 431 | + duplicate bug. |
| 432 | |
| 433 | This doesn't help the end-user too much if he's a member of this team |
| 434 | indirectly (for instance, if he's a member of a team which is in turn a |
| 435 | @@ -262,47 +256,52 @@ |
| 436 | the team page and see the membership graph directly. This may be worth |
| 437 | fixing in the future. |
| 438 | |
| 439 | -== First impressions stick == |
| 440 | +First impressions stick |
| 441 | +======================= |
| 442 | |
| 443 | Another important property of BugNotificationRecipients is that the |
| 444 | first rationale presented to it is the one that is presented -- even if |
| 445 | the recipient has multiple reasons for which he might be emailed. Here's |
| 446 | a pathological example: |
| 447 | |
| 448 | - >>> recipients = BugNotificationRecipients() |
| 449 | - >>> recipients.addDirectSubscriber(test) |
| 450 | - >>> recipients.addAssignee(test) |
| 451 | - >>> recipients.addRegistrant(test, gnomebaker) |
| 452 | - >>> recipients.addDirectSubscriber(foo_bar) |
| 453 | + >>> recipients = BugNotificationRecipients() |
| 454 | + >>> recipients.addDirectSubscriber(test) |
| 455 | + >>> recipients.addAssignee(test) |
| 456 | + >>> recipients.addRegistrant(test, gnomebaker) |
| 457 | + >>> recipients.addDirectSubscriber(foo_bar) |
| 458 | |
| 459 | This guy is emailed because he's a direct subscriber, an assignee and an |
| 460 | upstream registrant. However, if we ask the rationales instance: |
| 461 | |
| 462 | - >>> print_rationales(recipients) |
| 463 | - foo.bar@canonical.com |
| 464 | - Subscriber |
| 465 | - You received this bug notification because you are a direct subscriber of the bug. |
| 466 | - test@canonical.com |
| 467 | - Subscriber |
| 468 | - You received this bug notification because you are a direct subscriber of the bug. |
| 469 | + >>> print_rationales(recipients) |
| 470 | + foo.bar@canonical.com |
| 471 | + Subscriber |
| 472 | + You received this bug notification because you are a direct |
| 473 | + subscriber of the bug. |
| 474 | + test@canonical.com |
| 475 | + Subscriber |
| 476 | + You received this bug notification because you are a direct |
| 477 | + subscriber of the bug. |
| 478 | |
| 479 | Only the first rationale is presented. This is the case even if we |
| 480 | update this set of recipients with another one: |
| 481 | |
| 482 | - >>> recipients2 = BugNotificationRecipients() |
| 483 | - >>> recipients2.addDupeSubscriber(test) |
| 484 | - >>> recipients2.update(recipients) |
| 485 | + >>> recipients2 = BugNotificationRecipients() |
| 486 | + >>> recipients2.addDupeSubscriber(test) |
| 487 | + >>> recipients2.update(recipients) |
| 488 | |
| 489 | The rationales for test@canonical.com in the 'recipients' instance just |
| 490 | don't matter: |
| 491 | |
| 492 | - >>> print_rationales(recipients2) |
| 493 | - foo.bar@canonical.com |
| 494 | - Subscriber |
| 495 | - You received this bug notification because you are a direct subscriber of the bug. |
| 496 | - test@canonical.com |
| 497 | - Subscriber of Duplicate |
| 498 | - You received this bug notification because you are a direct subscriber of a duplicate bug. |
| 499 | + >>> print_rationales(recipients2) |
| 500 | + foo.bar@canonical.com |
| 501 | + Subscriber |
| 502 | + You received this bug notification because you are a direct |
| 503 | + subscriber of the bug. |
| 504 | + test@canonical.com |
| 505 | + Subscriber of Duplicate |
| 506 | + You received this bug notification because you are a direct |
| 507 | + subscriber of a duplicate bug. |
| 508 | |
| 509 | This may be seen as a limitation, but you don't want a 10-line rationale |
| 510 | footer for people who are central to Launchpad, so for now it's the way |
| 511 | |
| 512 | === modified file 'lib/lp/bugs/mail/bugnotificationrecipients.py' |
| 513 | --- lib/lp/bugs/mail/bugnotificationrecipients.py 2010-10-23 16:25:51 +0000 |
| 514 | +++ lib/lp/bugs/mail/bugnotificationrecipients.py 2010-12-07 17:03:30 +0000 |
| 515 | @@ -207,21 +207,6 @@ |
| 516 | text = "are a bug assignee" |
| 517 | self._addReason(person, text, reason) |
| 518 | |
| 519 | - def addDistroBugSupervisor(self, person, distro): |
| 520 | - """Registers a distribution bug supervisor for this bug.""" |
| 521 | - reason = "Bug Supervisor (%s)" % distro.displayname |
| 522 | - # All displaynames in these reasons should be changed to bugtargetname |
| 523 | - # (as part of bug 113262) once bugtargetname is finalized for packages |
| 524 | - # (bug 113258). Changing it before then would be excessively |
| 525 | - # disruptive. |
| 526 | - if person.isTeam(): |
| 527 | - text = ("are a member of %s, which is the bug supervisor for %s" % |
| 528 | - (person.displayname, distro.displayname)) |
| 529 | - reason += " @%s" % person.name |
| 530 | - else: |
| 531 | - text = "are the bug supervisor for %s" % distro.displayname |
| 532 | - self._addReason(person, text, reason) |
| 533 | - |
| 534 | def addStructuralSubscriber(self, person, target): |
| 535 | """Registers a structural subscriber to this bug's target.""" |
| 536 | reason = "Subscriber (%s)" % target.displayname |
| 537 | @@ -233,17 +218,6 @@ |
| 538 | text = "are subscribed to %s" % target.displayname |
| 539 | self._addReason(person, text, reason) |
| 540 | |
| 541 | - def addUpstreamBugSupervisor(self, person, upstream): |
| 542 | - """Registers an upstream bug supervisor for this bug.""" |
| 543 | - reason = "Bug Supervisor (%s)" % upstream.displayname |
| 544 | - if person.isTeam(): |
| 545 | - text = ("are a member of %s, which is the bug supervisor for %s" % |
| 546 | - (person.displayname, upstream.displayname)) |
| 547 | - reason += " @%s" % person.name |
| 548 | - else: |
| 549 | - text = "are the bug supervisor for %s" % upstream.displayname |
| 550 | - self._addReason(person, text, reason) |
| 551 | - |
| 552 | def addRegistrant(self, person, upstream): |
| 553 | """Registers an upstream product registrant for this bug.""" |
| 554 | reason = "Registrant (%s)" % upstream.displayname |

Hi Gavin,
This looks good. I am glad to see the API surface shrink a bit. +1
Maris