Async subscriber portlet means more API calls from subscriber.js

Bug #491297 reported by Gavin Panella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

The subscriber portlet on a bug page is now loaded asynchronously. This now means that certain DOM nodes that Subscriber.get_display_name_from_node() (in subscriber.js) relies upon are not available at page load time. Specifically, it looks for a node with the class "subscriber-$username", and tries to extract the display name from an child <a> node.

The Subscriber class does not give up though, and instead falls back to doing an API call to obtain the user's display name. This means there's no visible error. However, by instrumenting get_display_name_from_api(), I can see that this happens 3 times for any given bug page. So, 3 extra HTTP calls.

The following diff reduces this to 0, but may have other repercussions that I'm not aware of yet:

--- lib/lp/bugs/templates/bug-portlet-subscribers.pt 2009-11-25 13:22:01 +0000
+++ lib/lp/bugs/templates/bug-portlet-subscribers.pt 2009-12-02 09:38:46 +0000
@@ -24,6 +24,10 @@
        style="text-align: center; display: none">
     <img src="/@@/spinner" />
   </div>
+ <div tal:attributes="class string:subscriber-${view/user/name}"
+ tal:condition="view/user">
+ <a tal:attributes="name view/user/fmt:displayname"></a>
+ </div>
   <script type="text/javascript">
     YUI().use('io-base', 'node', 'bugs.bugtask_index', function(Y) {
         // Must be done inline here to ensure the load event fires.

Curtis Hovey (sinzui)
Changed in launchpad:
importance: Medium → Low
tags: added: bugs javascript subscribers
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.