Make add_messages do everything relating to message adding

Now that it's only called from get_updates_longpoll, we don't need to break out
specific parts that are only needed there.

(imported from commit 60d1cb25d0044ed1b2325d977b869617587e6a0f)
This commit is contained in:
Keegan McAllister 2012-09-26 14:28:22 -04:00
parent 017c5e87bd
commit 1e02fc140b

View File

@ -764,6 +764,12 @@ function add_messages(zephyrs) {
// Even when narrowed, add messages to the home view so they exist when we un-narrow.
add_to_table(zephyrs, 'zhome', function () { return true; });
$.each(zephyrs, function () {
zephyr_array.push(this);
if (this.id === initial_pointer)
select_and_show_by_id(initial_pointer);
});
if (autocomplete_needs_update)
update_autocomplete();
}
@ -788,11 +794,6 @@ function get_updates_longpoll() {
if (data && data.zephyrs) {
add_messages(data.zephyrs);
$.each(data.zephyrs, function () {
zephyr_array.push(this);
if (this.id === initial_pointer)
select_and_show_by_id(initial_pointer);
});
}
setTimeout(get_updates_longpoll, 0);
},