Simply compose.check_stream_existence now that one of its return values isn't used

(imported from commit 8c910032e8ffd12b9691138ce03ceb096156e3f2)
This commit is contained in:
Zev Benjamin
2013-03-11 18:13:37 -04:00
parent 054d377709
commit fb0dd60857
2 changed files with 4 additions and 7 deletions

View File

@@ -334,7 +334,6 @@ exports.recipient = get_or_set('private_message_recipient');
// *Synchronously* check if a stream exists. // *Synchronously* check if a stream exists.
exports.check_stream_existence = function (stream_name) { exports.check_stream_existence = function (stream_name) {
var result = "error"; var result = "error";
var error_xhr = "";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/json/subscriptions/exists", url: "/json/subscriptions/exists",
@@ -351,18 +350,16 @@ exports.check_stream_existence = function (stream_name) {
}, },
error: function (xhr) { error: function (xhr) {
result = "error"; result = "error";
error_xhr = xhr;
} }
}); });
return [result, error_xhr]; return result;
}; };
// Checks if a stream exists. If not, displays an error and returns // Checks if a stream exists. If not, displays an error and returns
// false. // false.
function check_stream_for_send(stream_name) { function check_stream_for_send(stream_name) {
var stream_check = exports.check_stream_existence(stream_name); var result = exports.check_stream_existence(stream_name);
var result = stream_check[0];
if (result === "error") { if (result === "error") {
compose_error("Error checking subscription", $("#stream")); compose_error("Error checking subscription", $("#stream"));

View File

@@ -587,7 +587,7 @@ function ajaxSubscribeForCreation(stream, principals, invite_only) {
// The tutorial bot needs this function to add you to the // The tutorial bot needs this function to add you to the
// tutorial-yourname stream. // tutorial-yourname stream.
exports.tutorial_subscribe_or_add_me_to = function (stream_name) { exports.tutorial_subscribe_or_add_me_to = function (stream_name) {
var stream_status = compose.check_stream_existence(stream_name)[0]; var stream_status = compose.check_stream_existence(stream_name);
if (stream_status === 'does-not-exist') { if (stream_status === 'does-not-exist') {
ajaxSubscribeForCreation(stream_name, [email], false); ajaxSubscribeForCreation(stream_name, [email], false);
} else { } else {
@@ -645,7 +645,7 @@ $(function () {
} }
var stream = $.trim($("#create_stream_name").val()); var stream = $.trim($("#create_stream_name").val());
var stream_status = compose.check_stream_existence(stream)[0]; var stream_status = compose.check_stream_existence(stream);
if (stream_status === "does-not-exist") { if (stream_status === "does-not-exist") {
$("#stream_name").text(stream); $("#stream_name").text(stream);
show_new_stream_modal(); show_new_stream_modal();