Merge lp:~abentley/launchpad/fix-branch-precondition2 into lp:launchpad

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 12853
Proposed branch: lp:~abentley/launchpad/fix-branch-precondition2
Merge into: lp:launchpad
Diff against target: 39 lines (+7/-3)
1 file modified
lib/lp/translations/javascript/sourcepackage_sharing_details.js (+7/-3)
To merge this branch: bzr merge lp:~abentley/launchpad/fix-branch-precondition2
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+57945@code.launchpad.net

Commit message

Fix 412 precondition error from selecting branch repeatedly.

Description of the change

= Summary =
Fix bug #758919: 412 Precondition failed error using the selecting upstream source branch in translations sharing page

== Proposed fix ==
Reload the productseries after setting the branch.

== Pre-implementation notes ==
None

== Implementation details ==
None

== Tests ==
None

== Demo and Q/A ==
Go to the +sharing-details page for a sourcepackage. Select a branch. Then select another branch. The second time should not give a 412 precondition failed error.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/translations/javascript/sourcepackage_sharing_details.js

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/translations/javascript/sourcepackage_sharing_details.js'
--- lib/lp/translations/javascript/sourcepackage_sharing_details.js 2011-04-13 17:39:32 +0000
+++ lib/lp/translations/javascript/sourcepackage_sharing_details.js 2011-04-15 19:49:43 +0000
@@ -381,6 +381,7 @@
381 var that = this;381 var that = this;
382 var lp_client = new Y.lp.client.Launchpad();382 var lp_client = new Y.lp.client.Launchpad();
383 var branch_check = that.get('tsconfig').get('branch');383 var branch_check = that.get('tsconfig').get('branch');
384 var productseries = that.get('productseries');
384385
385 /* Here begin a series of methods which each represent a step in386 /* Here begin a series of methods which each represent a step in
386 * setting the branch. They each take a config to use in an lp_client387 * setting the branch. They each take a config to use in an lp_client
@@ -391,21 +392,24 @@
391 * closure, such as "that" and "branch_summary".392 * closure, such as "that" and "branch_summary".
392 */393 */
393 function save_branch(config) {394 function save_branch(config) {
394 var productseries = that.get('productseries');
395 productseries.set('branch_link', branch_summary.api_uri);395 productseries.set('branch_link', branch_summary.api_uri);
396 productseries.lp_save(config);396 productseries.lp_save(config);
397 }397 }
398 function get_branch(config){398 function get_branch(config){
399 lp_client.get(branch_summary.api_uri, config);399 lp_client.get(branch_summary.api_uri, config);
400 }400 }
401 function set_link(branch){401 function set_link(config, branch){
402 that.set_branch(branch);402 that.set_branch(branch);
403 lp_client.get(productseries.get('self_link'), config);
404 }
405 function finish(new_productseries){
406 that.replace_productseries(new_productseries);
403 that.update();407 that.update();
404 that.flash_check_green(branch_check);408 that.flash_check_green(branch_check);
405 }409 }
406 css_selector = that.visible_check_selector(branch_check);410 css_selector = that.visible_check_selector(branch_check);
407 var io_handler = new IOHandler(css_selector);411 var io_handler = new IOHandler(css_selector);
408 save_branch(io_handler.chain_config(get_branch, set_link));412 save_branch(io_handler.chain_config(get_branch, set_link, finish));
409 },413 },
410 /**414 /**
411 * Update the display of all checklist items.415 * Update the display of all checklist items.