~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/bugsubscription.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-06-17 15:12:34 UTC
  • mfrom: (13251.1.3 anon-subscribers-list)
  • Revision ID: launchpad@pqm.canonical.com-20110617151234-lepwpmxwj3b8rzxe
[r=adeuring][bug=798622] Fix loading of bug subscribers for anonymous
        visitors of a bug page.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    action,
44
44
    LaunchpadFormView,
45
45
    )
46
 
from lp.bugs.browser.bug import BugViewMixin
47
46
from lp.bugs.browser.structuralsubscription import (
48
47
    expose_structural_subscription_data_to_js,
49
48
    )
50
49
from lp.bugs.enum import BugNotificationLevel
 
50
from lp.bugs.interfaces.bug import IBug
51
51
from lp.bugs.interfaces.bugsubscription import IBugSubscription
 
52
from lp.bugs.interfaces.bugtask import IBugTask
52
53
from lp.bugs.model.personsubscriptioninfo import PersonSubscriptions
53
54
from lp.bugs.model.structuralsubscription import (
54
55
    get_structural_subscriptions_for_bug,
532
533
    def subscriber_data_js(self):
533
534
        """Return subscriber_ids in a form suitable for JavaScript use."""
534
535
        data = []
535
 
        details = list(self.context.getDirectSubscribersWithDetails())
 
536
        if IBug.providedBy(self.context):
 
537
            bug = self.context
 
538
        elif IBugTask.providedBy(self.context):
 
539
            bug = self.context.bug
 
540
        details = list(bug.getDirectSubscribersWithDetails())
536
541
        api_request = IWebServiceClientRequest(self.request)
537
542
        for person, subscription in details:
538
543
            can_edit = self.user is not None and self.user.inTeam(person)
556
561
                }
557
562
            data.append(record)
558
563
 
559
 
        others = list(self.context.getIndirectSubscribers())
 
564
        others = list(bug.getIndirectSubscribers())
560
565
        for person in others:
561
566
            if person == self.user:
562
567
                # Skip the current user viewing the page.