mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	refactor: Initialize stream list code in stream_list.js.
This code was in subs.js for historical reasons.
This commit is contained in:
		@@ -280,7 +280,7 @@ run_test('zoom_in_and_zoom_out', () => {
 | 
			
		||||
        f.call(elem(stream_li1));
 | 
			
		||||
        f.call(elem(stream_li2));
 | 
			
		||||
    };
 | 
			
		||||
    stream_list.initialize();
 | 
			
		||||
    stream_list.set_event_handlers();
 | 
			
		||||
 | 
			
		||||
    stream_list.zoom_in_topics({stream_id: 42});
 | 
			
		||||
 | 
			
		||||
@@ -337,7 +337,7 @@ run_test('narrowing', () => {
 | 
			
		||||
 | 
			
		||||
    assert(!$('<devel sidebar row html>').hasClass('active-filter'));
 | 
			
		||||
 | 
			
		||||
    stream_list.initialize();
 | 
			
		||||
    stream_list.set_event_handlers();
 | 
			
		||||
 | 
			
		||||
    var filter;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -468,6 +468,15 @@ function actually_update_streams_for_search() {
 | 
			
		||||
var update_streams_for_search = _.throttle(actually_update_streams_for_search, 50);
 | 
			
		||||
 | 
			
		||||
exports.initialize = function () {
 | 
			
		||||
    stream_list.create_initial_sidebar_rows();
 | 
			
		||||
 | 
			
		||||
    // We build the stream_list now.  It may get re-built again very shortly
 | 
			
		||||
    // when new messages come in, but it's fairly quick.
 | 
			
		||||
    stream_list.build_stream_list();
 | 
			
		||||
    exports.set_event_handlers();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.set_event_handlers = function () {
 | 
			
		||||
    $(document).on('subscription_add_done.zulip', function (event) {
 | 
			
		||||
        exports.create_sidebar_row(event.sub);
 | 
			
		||||
        exports.build_stream_list();
 | 
			
		||||
 
 | 
			
		||||
@@ -828,12 +828,6 @@ exports.sub_or_unsub = function (sub) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
exports.initialize = function () {
 | 
			
		||||
    stream_list.create_initial_sidebar_rows();
 | 
			
		||||
 | 
			
		||||
    // We build the stream_list now.  It may get re-built again very shortly
 | 
			
		||||
    // when new messages come in, but it's fairly quick.
 | 
			
		||||
    stream_list.build_stream_list();
 | 
			
		||||
 | 
			
		||||
    add_email_hint_handler();
 | 
			
		||||
 | 
			
		||||
    $("#subscriptions_table").on("click", ".create_stream_button", function (e) {
 | 
			
		||||
 
 | 
			
		||||
@@ -286,6 +286,7 @@ exports.initialize_everything = function () {
 | 
			
		||||
    stream_data.initialize();
 | 
			
		||||
    muting.initialize();
 | 
			
		||||
    subs.initialize();
 | 
			
		||||
    stream_list.initialize();
 | 
			
		||||
    condense.initialize();
 | 
			
		||||
    lightbox.initialize();
 | 
			
		||||
    click_handlers.initialize();
 | 
			
		||||
@@ -324,7 +325,6 @@ exports.initialize_everything = function () {
 | 
			
		||||
    emoji_picker.initialize();
 | 
			
		||||
    compose_fade.initialize();
 | 
			
		||||
    pm_list.initialize();
 | 
			
		||||
    stream_list.initialize();
 | 
			
		||||
    topic_list.initialize();
 | 
			
		||||
    topic_zoom.initialize();
 | 
			
		||||
    drafts.initialize();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user