mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 22:19:48 +00:00
Simply compose.check_stream_existence now that one of its return values isn't used
(imported from commit 8c910032e8ffd12b9691138ce03ceb096156e3f2)
This commit is contained in:
@@ -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"));
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user