mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 15:58:06 -05:00
update js to prevent duplicate form submissions
This commit is contained in:
@@ -130,6 +130,8 @@ $.request = function(op, parameters, worker_in, block) {
|
||||
|
||||
parameters = $.with_default(parameters, {});
|
||||
worker_in = $.with_default(worker_in, handleResponse(action));
|
||||
if (typeof(worker_in) != 'function')
|
||||
worker_in = handleResponse(action);
|
||||
var worker = function(r) {
|
||||
release_ajax_lock(action);
|
||||
return worker_in(r);
|
||||
|
||||
@@ -47,13 +47,13 @@ function post_form(form, where, statusfunc, nametransformfunc, block) {
|
||||
/* set the submitted state */
|
||||
$(form).find(".error").not(".status").hide();
|
||||
$(form).find(".status").html(statusfunc(form)).show();
|
||||
return simple_post_form(form, where, {});
|
||||
return simple_post_form(form, where, {}, block);
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function simple_post_form(form, where, fields) {
|
||||
function simple_post_form(form, where, fields, block) {
|
||||
fields = fields || {};
|
||||
/* consolidate the form's inputs for submission */
|
||||
$(form).find("select, input, textarea").not(".gray").each(function() {
|
||||
@@ -66,7 +66,7 @@ function simple_post_form(form, where, fields) {
|
||||
fields.id = $(form).attr("id") ? ("#" + $(form).attr("id")) : "";
|
||||
}
|
||||
|
||||
$.request(where, fields);
|
||||
$.request(where, fields, null, block);
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user