Rename add_for_send to subscribe_for_send.

(imported from commit 19f6a0710a84bf8204b81957ca49b09ec9174188)
This commit is contained in:
Tim Abbott 2012-10-31 18:15:27 -04:00
parent aca815d727
commit 27867b0022
2 changed files with 6 additions and 6 deletions

View File

@ -53,13 +53,13 @@ exports.fetch = function () {
});
};
function add_for_send_success(stream_name, prompt_button) {
function subscribe_for_send_success(stream_name, prompt_button) {
add_to_stream_list(stream_name);
compose.finish();
prompt_button.stop(true).fadeOut(500);
}
exports.add_for_send = function (stream, prompt_button) {
exports.subscribe_for_send = function (stream, prompt_button) {
$.ajax({
type: 'POST',
url: '/json/subscriptions/add',
@ -67,14 +67,14 @@ exports.add_for_send = function (stream, prompt_button) {
dataType: 'json',
timeout: 10*60*1000, // 10 minutes in ms
success: function (response) {
add_for_send_success(response.data, prompt_button);
subscribe_for_send_success(response.data, prompt_button);
},
error: function (xhr, error_type, exn) {
if ($.parseJSON(xhr.responseText).msg === "Subscription already exists") {
// If we're already subscribed, the issue here was
// actually that the client didn't know we were
// already subscribed -- so just send the message.
add_for_send_success(stream, prompt_button);
subscribe_for_send_success(stream, prompt_button);
} else {
report_error("Unable to subscribe", xhr, $("#home-error"));
}

View File

@ -309,12 +309,12 @@ $(function () {
// Prepare the click handler for subbing to a new stream to which
// you have composed a message.
$('#create-it').click(function () {
subs.add_for_send(compose.stream_name(), $('#stream-dne'));
subs.subscribe_for_send(compose.stream_name(), $('#stream-dne'));
});
// Prepare the click handler for subbing to an existing stream.
$('#sub-it').click(function () {
subs.add_for_send(compose.stream_name(), $('#stream-nosub'));
subs.subscribe_for_send(compose.stream_name(), $('#stream-nosub'));
});
var throttled_scrollhandler = $.throttle(50, function(e) {