mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 07:52:19 +00:00
Remove duplication in message validation
NB: this does change which error will be flagged if multiple conditions apply. (imported from commit 080bf7d764f1f16ad57b365ad9aa6bc48f3cff72)
This commit is contained in:
@@ -231,11 +231,6 @@ function validate_stream_message() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exports.message_content() === "") {
|
|
||||||
compose_error("You have nothing to send!", $("#new_message_content"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!subs.have(stream_name)) {
|
if (!subs.have(stream_name)) {
|
||||||
if (!check_stream_for_send(stream_name)) {
|
if (!check_stream_for_send(stream_name)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -259,17 +254,17 @@ function validate_huddle_message() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exports.message_content() === "") {
|
|
||||||
compose_error("You have nothing to send!", $("#new_message_content"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.validate = function () {
|
exports.validate = function () {
|
||||||
$("#compose-send-button").attr('disabled', 'disabled').blur();
|
$("#compose-send-button").attr('disabled', 'disabled').blur();
|
||||||
|
|
||||||
|
if (exports.message_content() === "") {
|
||||||
|
compose_error("You have nothing to send!", $("#new_message_content"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (exports.composing() === 'huddle') {
|
if (exports.composing() === 'huddle') {
|
||||||
return validate_huddle_message();
|
return validate_huddle_message();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user