mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
Don't send tutorial timeout message if we're no longer running.
If the system was waiting for you to reply and you replied 'exit', the tutorial would stop -- but our thing that was waiting for you to reply would continue waiting. It would eventually timeout and send you the heartbroken "I didn't hear from you so I stopped waiting" message. Chances are, you were unsubscribed so you didn't see it, but we should still just not send it. (imported from commit 694e442bc29b32efd59f08b4b8b5f573768aea21)
This commit is contained in:
@@ -48,6 +48,8 @@ function stream_message(subject, message) {
|
||||
// populated later -- should be e.g. tutorial-wdaher
|
||||
var my_tutorial_stream;
|
||||
|
||||
var tutorial_running = false;
|
||||
|
||||
function stream_to_me(message) {
|
||||
return message.type === 'stream' && message.to === my_tutorial_stream;
|
||||
}
|
||||
@@ -87,6 +89,10 @@ function wait_for_message(time_to_wait_sec, condition) {
|
||||
return $.Deferred(function (deferred) {
|
||||
var numCalls = 0;
|
||||
var intervalId = setInterval(function () {
|
||||
if (!tutorial_running) {
|
||||
clearInterval(intervalId);
|
||||
deferred.fail();
|
||||
}
|
||||
numCalls += 1;
|
||||
if (numCalls > time_to_wait_sec * (1000 / POLL_INTERVAL_MS)) {
|
||||
clearInterval(intervalId);
|
||||
@@ -164,8 +170,6 @@ function pick_hello_stream() {
|
||||
return hello_stream;
|
||||
}
|
||||
|
||||
var tutorial_running = false;
|
||||
|
||||
function run_tutorial(stepNumber) {
|
||||
if (stepNumber >= script.length) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user