Automatically subscribe on send when lurking

(imported from commit 636c07346e766615a0012e4532f35d328bb7984d)
This commit is contained in:
Reid Barton
2013-01-16 14:03:33 -05:00
parent 64ebbc6c73
commit 2797a41fd8
2 changed files with 11 additions and 1 deletions

View File

@@ -302,6 +302,15 @@ function validate_stream_message() {
// browser window doesn't know it. // browser window doesn't know it.
return true; return true;
case "not-subscribed": case "not-subscribed":
if (lurk_stream.toLowerCase() === stream_name.toLowerCase()) {
// Just subscribe them.
subs.subscribe_for_send(stream_name);
// When the subscription request completes,
// subscribe_for_send will send our message (like when
// the user clicks on subscribe-and-send).
return false;
}
$('#send-status').removeClass(status_classes); $('#send-status').removeClass(status_classes);
$('#stream-nosub-name').text(stream_name); $('#stream-nosub-name').text(stream_name);
$('#stream-nosub').show(); $('#stream-nosub').show();

View File

@@ -183,6 +183,7 @@ exports.subscribe_for_send = function (stream, prompt_button) {
success: function (response) { success: function (response) {
add_to_stream_list(stream); add_to_stream_list(stream);
compose.finish(); compose.finish();
if (prompt_button !== undefined)
prompt_button.stop(true).fadeOut(500); prompt_button.stop(true).fadeOut(500);
}, },
error: function (xhr, error_type, exn) { error: function (xhr, error_type, exn) {