subs: Prepend new streams to top of stream list.

This prepends new streams that are created to the top of the list so
that they are more visible when being created.
This commit is contained in:
Brock Whittaker 2017-02-17 15:03:43 -08:00 committed by Tim Abbott
parent 8801158dfd
commit 022aeca085
1 changed files with 10 additions and 1 deletions

View File

@ -287,12 +287,21 @@ function add_email_hint(row, email_address_hint_content) {
});
}
// The `meta.stream_created` flag tells us whether the stream was just
// created in this browser window; it's a hack to work around the
// server_events code flow not having a good way to associate with
// this request. These should be appended to the top of the list so
// they are more visible.
function add_sub_to_table(sub) {
sub = stream_data.add_admin_options(sub);
stream_data.update_subscribers_count(sub);
var html = templates.render('subscription', sub);
var settings_html = templates.render('subscription_settings', sub);
$(".streams-list").append(html);
if (meta.stream_created) {
$(".streams-list").prepend(html).scrollTop(0);
} else {
$(".streams-list").append(html);
}
$(".subscriptions .settings").append($(settings_html));
var email_address_hint_content = templates.render('email_address_hint', { page_params: page_params });