← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bug-830676 into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/bug-830676 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #830676 in Launchpad itself: "PPA AJAX build status indicators don't update properly"
  https://bugs.launchpad.net/launchpad/+bug/830676

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-830676/+merge/79772

This branch unbreaks the AJAX PPA build status updater, fixing bug #830676. r13303.10.6 taught the JS API client to map subobjects of results into real Entry objects, which broke the (not tested, or perhaps only by the late Windmill?) Archive:+packages JS.

I also fixed some unsafe element construction ("<a>" + arch_tag + "</a>"), and added a space between each element to match the TAL rendering.

To test, run "UPDATE buildfarmjob SET status=0 WHERE id=26;", visit https://launchpad.dev/~cprov/+archive/ppa, then run "UPDATE buildfarmjob SET status=2 WHERE id=26;" and wait up to a minute for the top build status to turn into a nasty red X.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-830676/+merge/79772
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-830676 into lp:launchpad.
=== modified file 'lib/lp/soyuz/javascript/update_archive_build_statuses.js'
--- lib/lp/soyuz/javascript/update_archive_build_statuses.js	2011-08-09 14:18:02 +0000
+++ lib/lp/soyuz/javascript/update_archive_build_statuses.js	2011-10-19 06:19:24 +0000
@@ -191,13 +191,11 @@
                     // fullybuilt:
                     if (build_summary.status != "FULLYBUILT") {
                         Y.each(build_summary.builds, function(build){
-                            // Create the web-link href from the api link:
-                            var build_href = build.self_link.replace(
-                                /\/api\/[^\/]*\//, '/');
-                            var new_link = Y.Node.create(
-                                "<a>" + build.arch_tag + "</a>");
-                            new_link.setAttribute("href", build_href);
-                            new_link.setAttribute("title", build.title);
+                            var new_link = Y.Node.create('<a/>')
+                                .set('text', build.get('arch_tag'))
+                                .setAttribute('href', build.get('web_link'))
+                                .setAttribute('title', build.get('title'));
+                            td_elem.appendChild(document.createTextNode(' '));
                             td_elem.appendChild(new_link);
                         });
                     }