mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	hotkeys: Expand collapsed sidebars when sidebar searches are initiated.
Fixes #7351.
This commit is contained in:
		@@ -42,6 +42,20 @@ set_global('blueslip', {
 | 
				
			|||||||
    log: function () {},
 | 
					    log: function () {},
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set_global('popovers', {
 | 
				
			||||||
 | 
					    hide_all: function () {},
 | 
				
			||||||
 | 
					    show_userlist_sidebar: function () {
 | 
				
			||||||
 | 
					        $('.column-right').addClass('expanded');
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set_global('stream_popover', {
 | 
				
			||||||
 | 
					    show_streamlist_sidebar: function () {
 | 
				
			||||||
 | 
					        $('.column-left').addClass('expanded');
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_global('reload', {
 | 
					set_global('reload', {
 | 
				
			||||||
    is_in_progress: function () {return false;},
 | 
					    is_in_progress: function () {return false;},
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
@@ -583,7 +597,19 @@ $('.user-list-filter').is = function (sel) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
(function test_initiate_search() {
 | 
					(function test_initiate_search() {
 | 
				
			||||||
    $('.user-list-filter').blur();
 | 
					    $('.user-list-filter').blur();
 | 
				
			||||||
 | 
					    $('.user-list-filter').closest = function (selector) {
 | 
				
			||||||
 | 
					        assert.equal(selector, ".app-main [class^='column-']");
 | 
				
			||||||
 | 
					        return $.create('right-sidebar').addClass('column-right');
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
    activity.initiate_search();
 | 
					    activity.initiate_search();
 | 
				
			||||||
 | 
					    assert.equal($('.column-right').hasClass('expanded'), true);
 | 
				
			||||||
 | 
					    assert.equal($('.user-list-filter').is_focused(), true);
 | 
				
			||||||
 | 
					    $('.user-list-filter').closest = function (selector) {
 | 
				
			||||||
 | 
					        assert.equal(selector, ".app-main [class^='column-']");
 | 
				
			||||||
 | 
					        return $.create('left-sidebar').addClass('column-left');
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    activity.initiate_search();
 | 
				
			||||||
 | 
					    assert.equal($('.column-left').hasClass('expanded'), true);
 | 
				
			||||||
    assert.equal($('.user-list-filter').is_focused(), true);
 | 
					    assert.equal($('.user-list-filter').is_focused(), true);
 | 
				
			||||||
}());
 | 
					}());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -536,6 +536,15 @@ exports.escape_search = function () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
exports.initiate_search = function () {
 | 
					exports.initiate_search = function () {
 | 
				
			||||||
    var filter = $('.user-list-filter').expectOne();
 | 
					    var filter = $('.user-list-filter').expectOne();
 | 
				
			||||||
 | 
					    var column = $('.user-list-filter').closest(".app-main [class^='column-']");
 | 
				
			||||||
 | 
					    if (!column.hasClass("expanded")) {
 | 
				
			||||||
 | 
					        popovers.hide_all();
 | 
				
			||||||
 | 
					        if (column.hasClass('column-left')) {
 | 
				
			||||||
 | 
					            stream_popover.show_streamlist_sidebar();
 | 
				
			||||||
 | 
					        } else if (column.hasClass('column-right')) {
 | 
				
			||||||
 | 
					            popovers.show_userlist_sidebar();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    filter.focus();
 | 
					    filter.focus();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -507,8 +507,12 @@ exports.clear_search = function () {
 | 
				
			|||||||
exports.initiate_search = function () {
 | 
					exports.initiate_search = function () {
 | 
				
			||||||
    var filter = $('.stream-list-filter').expectOne();
 | 
					    var filter = $('.stream-list-filter').expectOne();
 | 
				
			||||||
    filter.parent().removeClass('notdisplayed');
 | 
					    filter.parent().removeClass('notdisplayed');
 | 
				
			||||||
    filter.focus();
 | 
					 | 
				
			||||||
    $('#clear_search_stream_button').prop('disabled', false);
 | 
					    $('#clear_search_stream_button').prop('disabled', false);
 | 
				
			||||||
 | 
					    if (!$(".app-main .column-left").hasClass("expanded")) {
 | 
				
			||||||
 | 
					        popovers.hide_all();
 | 
				
			||||||
 | 
					        stream_popover.show_streamlist_sidebar();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    filter.focus();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.clear_and_hide_search = function () {
 | 
					exports.clear_and_hide_search = function () {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user