mirror of https://github.com/zulip/zulip.git
Add ui_state.home_tab_obscured() shim.
This commit is contained in:
parent
ab34b5ee9f
commit
5b2407bb22
|
@ -25,6 +25,7 @@
|
|||
"popovers": false,
|
||||
"server_events": false,
|
||||
"ui": false,
|
||||
"ui_state": false,
|
||||
"lightbox": false,
|
||||
"stream_color": false,
|
||||
"people": false,
|
||||
|
|
|
@ -116,7 +116,7 @@ function stubbing(func_name_to_stub, test_function) {
|
|||
_.each([return_true, return_false], function (is_settings_page) {
|
||||
_.each([return_true, return_false], function (home_tab_obscured) {
|
||||
hotkey.is_settings_page = is_settings_page;
|
||||
set_global('ui', {home_tab_obscured: home_tab_obscured});
|
||||
set_global('ui_state', {home_tab_obscured: home_tab_obscured});
|
||||
|
||||
test_normal_typing();
|
||||
});
|
||||
|
|
|
@ -272,7 +272,7 @@ $(function () {
|
|||
});
|
||||
|
||||
$(".brand").on('click', function (e) {
|
||||
if (ui.home_tab_obscured()) {
|
||||
if (ui_state.home_tab_obscured()) {
|
||||
ui.change_tab_to('#home');
|
||||
} else {
|
||||
narrow.restore_home_state();
|
||||
|
|
|
@ -379,7 +379,7 @@ exports.process_hotkey = function (e, hotkey) {
|
|||
return exports.process_shift_tab_key();
|
||||
}
|
||||
|
||||
if (hotkey.message_view_only && ui.home_tab_obscured()) {
|
||||
if (hotkey.message_view_only && ui_state.home_tab_obscured()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -530,7 +530,7 @@ exports.restore_home_state = function () {
|
|||
// If we click on the Home link from another nav pane, just go
|
||||
// back to the state you were in (possibly still narrowed) before
|
||||
// you left the Home pane.
|
||||
if (!ui.home_tab_obscured()) {
|
||||
if (!ui_state.home_tab_obscured()) {
|
||||
exports.deactivate();
|
||||
}
|
||||
navigate.maybe_scroll_to_selected();
|
||||
|
|
|
@ -13,6 +13,9 @@ var compose_actions = {};
|
|||
compose_actions.start = compose.start;
|
||||
compose_actions.cancel = compose.cancel;
|
||||
|
||||
var ui_state = {};
|
||||
ui_state.home_tab_obscured = ui.home_tab_obscured;
|
||||
|
||||
var compose_state = {};
|
||||
compose_state.has_message_content = compose.has_message_content;
|
||||
compose_state.recipient = compose.recipient;
|
||||
|
|
|
@ -473,7 +473,7 @@ $(function () {
|
|||
if (e.metaKey || e.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
if (ui.home_tab_obscured()) {
|
||||
if (ui_state.home_tab_obscured()) {
|
||||
ui.change_tab_to('#home');
|
||||
}
|
||||
var stream = $(e.target).parents('li').attr('data-name');
|
||||
|
@ -534,7 +534,7 @@ function maybe_select_stream(e) {
|
|||
var topStream = $('#stream_filters li.narrow-filter').first().data('name');
|
||||
if (topStream !== undefined) {
|
||||
// undefined if there are no results
|
||||
if (ui.home_tab_obscured()) {
|
||||
if (ui_state.home_tab_obscured()) {
|
||||
ui.change_tab_to('#home');
|
||||
}
|
||||
exports.clear_and_hide_search();
|
||||
|
|
|
@ -132,7 +132,7 @@ function update_in_home_view(sub, value) {
|
|||
var msg_offset;
|
||||
var saved_ypos;
|
||||
// Save our current scroll position
|
||||
if (ui.home_tab_obscured()) {
|
||||
if (ui_state.home_tab_obscured()) {
|
||||
saved_ypos = message_viewport.scrollTop();
|
||||
} else if (home_msg_list === current_msg_list &&
|
||||
current_msg_list.selected_row().offset() !== null) {
|
||||
|
@ -145,7 +145,7 @@ function update_in_home_view(sub, value) {
|
|||
message_store.add_messages(message_list.all.all_messages(), home_msg_list);
|
||||
|
||||
// Ensure we're still at the same scroll position
|
||||
if (ui.home_tab_obscured()) {
|
||||
if (ui_state.home_tab_obscured()) {
|
||||
message_viewport.scrollTop(saved_ypos);
|
||||
} else if (home_msg_list === current_msg_list) {
|
||||
// We pass use_closest to handle the case where the
|
||||
|
|
|
@ -210,7 +210,7 @@ exports.set_click_handlers = function (callbacks) {
|
|||
|
||||
// In a more componentized world, we would delegate some
|
||||
// of this stuff back up to our parents.
|
||||
if (ui.home_tab_obscured()) {
|
||||
if (ui_state.home_tab_obscured()) {
|
||||
ui.change_tab_to('#home');
|
||||
}
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ function welcome() {
|
|||
}
|
||||
|
||||
exports.start = function () {
|
||||
if (ui.home_tab_obscured()) {
|
||||
if (ui_state.home_tab_obscured()) {
|
||||
ui.change_tab_to('#home');
|
||||
}
|
||||
narrow.deactivate();
|
||||
|
|
|
@ -68,7 +68,7 @@ $(function () {
|
|||
});
|
||||
|
||||
message_viewport.message_pane.mousewheel(function (e, delta) {
|
||||
if (!ui.home_tab_obscured()) {
|
||||
if (!ui_state.home_tab_obscured()) {
|
||||
// In the message view, we use a throttled mousewheel handler.
|
||||
throttled_mousewheelhandler(e, delta);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue