mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
Manually validate before send
Validation was happening, but was not preventing sending. We now just manually call the validation function in compose.finish() instead of relying on jquery.form's beforeSubmit option. (imported from commit e094832bf8948f4c6f58cc0d0923bf0fd09db4b1)
This commit is contained in:
@@ -57,7 +57,6 @@ $(function () {
|
||||
|
||||
send_options = {
|
||||
dataType: 'json', // This seems to be ignored. We still get back an xhr.
|
||||
beforeSubmit: function () { compose.validate(); },
|
||||
success: function (resp, statusText, xhr, form) {
|
||||
form.find('textarea').val('');
|
||||
send_status.hide();
|
||||
@@ -92,9 +91,13 @@ $(function () {
|
||||
});
|
||||
|
||||
exports.finish = function () {
|
||||
if (! compose.validate()) {
|
||||
return false;
|
||||
}
|
||||
$("#compose form").ajaxSubmit(send_options);
|
||||
is_composing_message = false;
|
||||
$(document).trigger($.Event('compose_finished.zephyr'));
|
||||
return true;
|
||||
};
|
||||
|
||||
$(function () {
|
||||
|
||||
Reference in New Issue
Block a user