tutorial: fix race that could cause you to not see the goodbye message.

(imported from commit 52afce208890dbd863fc1661729e4351160d09ac)
This commit is contained in:
Jessica McKellar 2013-04-12 22:09:57 -04:00
parent 3945335e6e
commit 6b4196a74a
1 changed files with 4 additions and 3 deletions

View File

@ -67,12 +67,13 @@ exports.message_was_sent = function(message) {
(trimmed_content === 'exit' || trimmed_content === 'stop')) {
sleep(1000).then(function () {
var text = "OK, cool, we'll stop the tutorial here. If you have any questions, you can always email support@humbughq.com!";
var deferred;
if (pm_to_me(message)) {
pm(text);
deferred = pm(text);
} else {
stream_message(message.subject, text);
deferred = stream_message(message.subject, text);
}
exports.stop();
deferred.always(exports.stop);
});
return;
}