From 15602ee6bbab2d56f09ad75b93f3c67793c46ad1 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 25 Oct 2016 12:50:14 -0700 Subject: [PATCH] Stop using /json/streams on the client. We no longer need to fetch streams from the server when we render the settings page. The name populate_and_fill() may not be a great name any more. --- static/js/subs.js | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/static/js/subs.js b/static/js/subs.js index 6962a8cb77..cef1220dcc 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -516,11 +516,8 @@ function actually_filter_streams() { var filter_streams = _.throttle(actually_filter_streams, 50); exports.setup_page = function () { - loading.make_indicator($('#subs_page_loading_indicator')); - - function _populate_and_fill(public_streams) { - // TODO: stop fetching public_streams + function _populate_and_fill() { var sub_rows = stream_data.get_streams_for_settings_page(); $('#subscriptions_table').empty(); @@ -538,34 +535,19 @@ exports.setup_page = function () { add_email_hint(row, email_address_hint_content); }); - loading.destroy_indicator($('#subs_page_loading_indicator')); $("#create_or_filter_stream_row input[type='text']").on("input", filter_streams); $(document).trigger($.Event('subs_page_loaded.zulip')); } - function populate_and_fill(public_streams) { + function populate_and_fill() { i18n.ensure_i18n(function () { - _populate_and_fill(public_streams); + _populate_and_fill(); }); } - function failed_listing(xhr, error) { - loading.destroy_indicator($('#subs_page_loading_indicator')); - ui.report_error(i18n.t("Error listing streams or subscriptions"), xhr, - $("#subscriptions-status"), 'subscriptions-status'); - } + populate_and_fill(); - if (should_list_all_streams()) { - var req = channel.get({ - url: '/json/streams', - data: {"include_subscribed": false}, - idempotent: true, - timeout: 10*1000, - success: populate_and_fill, - error: failed_listing - }); - } else { - populate_and_fill({streams: []}); + if (!should_list_all_streams()) { $('#create_stream_button').val(i18n.t("Subscribe")); } };