mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
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:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user