Prevent race condition during inline gilding

The gold-button submits the form at the same time that setGildingProperties is
called, so this disables the submit function and manually calls submit for
buttons that have a form parent (creddits and PayPal). This should prevent the
locked payment blob errors.
This commit is contained in:
MelissaCole
2015-02-23 13:32:31 -08:00
parent ea5aa9c538
commit 6cf527235c
2 changed files with 5 additions and 3 deletions

View File

@@ -168,7 +168,9 @@ r.gold = {
r.analytics.fireFunnelEvent('gold', 'checkout', vendor);
}
$.request('modify_payment_blob.json', {code: code, signed: signed, message: giftmessage})
$.request('modify_payment_blob.json', {code: code, signed: signed, message: giftmessage}, function() {
$button.parents('form').submit();
});
},
// When spending creddits, update the templates we use to generate the gilding form to display the

View File

@@ -123,7 +123,7 @@
data-vendor="creddits">
<input type="hidden" name="months" value="${thing.months}">
<input type="hidden" name="passthrough" value="${thing.passthrough}" class="passthrough">
<button class="btn gold-button"><span class="snoo-head"></span>${_("creddits")}</button>
<button class="btn gold-button" type="button"><span class="snoo-head"></span>${_("creddits")}</button>
<span class="status">
<span class="remaining" data-current="${thing.months}" data-total="${thing.user_creddits}" data-template="${websafe(_ws('(use %(current)s of your %(total)s creddits)')) % dict(current='<%- current %>', total='<%- total %>')}">
</span>
@@ -141,7 +141,7 @@
<input type="hidden" name="quantity" value="${thing.quantity}">
%endif
<input type="hidden" name="hosted_button_id" value="${thing.paypal_buttonid}">
<button type="submit" class="btn gold-button">${_("PayPal")}</button>
<button type="submit" class="btn gold-button" type="button">${_("PayPal")}</button>
</form>
</%def>