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
1=== modified file 'lib/lp/translations/javascript/sourcepackage_sharing_details.js'
2--- lib/lp/translations/javascript/sourcepackage_sharing_details.js 2011-04-13 17:39:32 +0000
3+++ lib/lp/translations/javascript/sourcepackage_sharing_details.js 2011-04-15 19:49:43 +0000
4@@ -381,6 +381,7 @@
5 var that = this;
6 var lp_client = new Y.lp.client.Launchpad();
7 var branch_check = that.get('tsconfig').get('branch');
8+ var productseries = that.get('productseries');
9
10 /* Here begin a series of methods which each represent a step in
11 * setting the branch. They each take a config to use in an lp_client
12@@ -391,21 +392,24 @@
13 * closure, such as "that" and "branch_summary".
14 */
15 function save_branch(config) {
16- var productseries = that.get('productseries');
17 productseries.set('branch_link', branch_summary.api_uri);
18 productseries.lp_save(config);
19 }
20 function get_branch(config){
21 lp_client.get(branch_summary.api_uri, config);
22 }
23- function set_link(branch){
24+ function set_link(config, branch){
25 that.set_branch(branch);
26+ lp_client.get(productseries.get('self_link'), config);
27+ }
28+ function finish(new_productseries){
29+ that.replace_productseries(new_productseries);
30 that.update();
31 that.flash_check_green(branch_check);
32 }
33 css_selector = that.visible_check_selector(branch_check);
34 var io_handler = new IOHandler(css_selector);
35- save_branch(io_handler.chain_config(get_branch, set_link));
36+ save_branch(io_handler.chain_config(get_branch, set_link, finish));
37 },
38 /**
39 * Update the display of all checklist items.