Display composebox again upon server errors

Also removed .show()s for the alert on does-not-exist and not-subscribed, where
a blank error would display. This should fix the underlying issue with #166:
that hiding the composebox before send_message() was called would hide server
errors.

(imported from commit a8a50cdf82ddf1d15f1e405432ff3bbfdb7a491a)
This commit is contained in:
Tyler Hallada
2013-01-02 18:14:48 -05:00
parent 168ee1345c
commit b6e1024b69

View File

@@ -140,6 +140,7 @@ function send_message() {
// a nice response.
response += ": " + $.parseJSON(xhr.responseText).msg;
}
show(is_composing_message, $("#new_message_content"));
send_status.removeClass(status_classes)
.addClass('alert-error')
.text(response)
@@ -243,7 +244,7 @@ function check_stream_for_send(stream_name) {
if (!data.exists) {
// The stream doesn't exist
result = "does-not-exist";
$('#send-status').removeClass(status_classes).show();
$('#send-status').removeClass(status_classes);
$('#stream-dne-name').text(stream_name);
$('#stream-dne').show();
$("#compose-send-button").removeAttr('disabled');
@@ -288,7 +289,7 @@ function validate_stream_message() {
// browser window doesn't know it.
return true;
case "not-subscribed":
$('#send-status').removeClass(status_classes).show();
$('#send-status').removeClass(status_classes);
$('#stream-nosub-name').text(stream_name);
$('#stream-nosub').show();
$("#compose-send-button").removeAttr('disabled');