~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=allenap, rvb][bug=850500] [r=allenap,
 rvb][bug=850500] Ensure the bug subscribers portlet is updated when
 the privacy/security settings change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
from lp.app.errors import NotFoundError
90
90
from lp.app.widgets.itemswidgets import LaunchpadRadioWidgetWithDescription
91
91
from lp.app.widgets.project import ProjectScopeWidget
 
92
from lp.bugs.browser.bugsubscription import BugPortletSubscribersWithDetails
92
93
from lp.bugs.browser.widgets.bug import BugTagsWidget
93
94
from lp.bugs.enum import BugNotificationLevel
94
95
from lp.bugs.interfaces.bug import (
103
104
from lp.bugs.interfaces.bugtask import (
104
105
    BugTaskSearchParams,
105
106
    BugTaskStatus,
 
107
    IBugTask,
106
108
    IFrontPageBugTaskSearch,
107
109
    )
108
110
from lp.bugs.interfaces.bugwatch import IBugWatchSet
870
872
            notify(ObjectModifiedEvent(
871
873
                    bug, bug_before_modification, changed_fields))
872
874
        if self.request.is_ajax:
873
 
            if private_changed:
 
875
            if private_changed or security_related_changed:
874
876
                return self._getSubscriptionDetails()
875
877
            else:
876
878
                return ''
877
879
 
878
880
    def _getSubscriptionDetails(self):
879
881
        cache = dict()
 
882
        # The subscription details for the current user.
880
883
        self.extractBugSubscriptionDetails(self.user, self.context.bug, cache)
881
 
        return dumps(
 
884
 
 
885
        # The subscription details for other users to populate the subscribers
 
886
        # list in the portlet.
 
887
        if IBugTask.providedBy(self.context):
 
888
            bug = self.context.bug
 
889
        else:
 
890
            bug = self.context
 
891
        subscribers_portlet = BugPortletSubscribersWithDetails(
 
892
            bug, self.request)
 
893
        subscription_data = subscribers_portlet()
 
894
        cache_data = dumps(
882
895
            cache, cls=ResourceJSONEncoder,
883
896
            media_type=EntryResource.JSON_TYPE)
884
897
 
 
898
        return """{
 
899
            "cache_data": %s,
 
900
            "subscription_data": %s}
 
901
            """ % (cache_data, subscription_data)
 
902
 
885
903
    def _handlePrivacyChanged(self, user_will_be_subscribed):
886
904
        """Handle the case where the privacy of the bug has been changed.
887
905