Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

gear_menu: Delete unused Bootstrap tabs code.

Tim Abbott2a3f708e9af6
diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.js
index 4aa98cec2ea..b124fb2f087 100644
--- a/frontend_tests/node_tests/hashchange.js
+++ b/frontend_tests/node_tests/hashchange.js
@@ -137,10 +137,6 @@ function test_helper({override, change_tab}) {
stub(ui_report, "error");
if (change_tab) {
- override(ui_util, "change_tab_to", (hash) => {
- events.push("change_tab_to " + hash);
- });
-
override(narrow, "activate", (terms) => {
narrow_terms = terms;
events.push("narrow.activate");
@@ -190,7 +186,6 @@ run_test("hash_interactions", ({override}) => {
helper.assert_events([
[overlays, "close_for_hash_change"],
[message_viewport, "stop_auto_scrolling"],
- "change_tab_to #message_feed_container",
[narrow, "deactivate"],
[floating_recipient_bar, "update"],
]);
@@ -200,7 +195,6 @@ run_test("hash_interactions", ({override}) => {
helper.assert_events([
[overlays, "close_for_hash_change"],
[message_viewport, "stop_auto_scrolling"],
- "change_tab_to #message_feed_container",
[narrow, "deactivate"],
[floating_recipient_bar, "update"],
]);
@@ -225,7 +219,6 @@ run_test("hash_interactions", ({override}) => {
helper.assert_events([
[overlays, "close_for_hash_change"],
[message_viewport, "stop_auto_scrolling"],
- "change_tab_to #message_feed_container",
"narrow.activate",
[floating_recipient_bar, "update"],
]);
@@ -239,7 +232,6 @@ run_test("hash_interactions", ({override}) => {
helper.assert_events([
[overlays, "close_for_hash_change"],
[message_viewport, "stop_auto_scrolling"],
- "change_tab_to #message_feed_container",
"narrow.activate",
[floating_recipient_bar, "update"],
]);
@@ -254,7 +246,6 @@ run_test("hash_interactions", ({override}) => {
helper.assert_events([
[overlays, "close_for_hash_change"],
[message_viewport, "stop_auto_scrolling"],
- "change_tab_to #message_feed_container",
[ui_report, "error"],
]);
diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js
index e52a74c2c18..7e49ce09e32 100644
--- a/frontend_tests/node_tests/narrow_activate.js
+++ b/frontend_tests/node_tests/narrow_activate.js
@@ -35,7 +35,6 @@ const search = mock_esm("../../static/js/search");
const stream_list = mock_esm("../../static/js/stream_list");
const top_left_corner = mock_esm("../../static/js/top_left_corner");
const typing_events = mock_esm("../../static/js/typing_events");
-const ui_util = mock_esm("../../static/js/ui_util");
const unread_ops = mock_esm("../../static/js/unread_ops");
mock_esm("../../static/js/recent_topics_util", {
is_visible() {},
@@ -90,7 +89,6 @@ function test_helper() {
stub(top_left_corner, "handle_narrow_activated");
stub(typing_events, "render_notifications_for_narrow");
stub(compose_actions, "update_narrow_to_recipient_visibility");
- stub(ui_util, "change_tab_to");
stub(unread_ops, "process_visible");
stub(compose_closed_ui, "update_buttons_for_stream");
stub(compose_closed_ui, "update_buttons_for_private");
@@ -192,7 +190,6 @@ run_test("basics", () => {
[message_scroll, "hide_indicators"],
[notifications, "clear_compose_notifications"],
[notifications, "redraw_title"],
- [ui_util, "change_tab_to"],
[unread_ops, "process_visible"],
[hashchange, "save_narrow"],
[compose_closed_ui, "update_buttons_for_stream"],
diff --git a/frontend_tests/node_tests/search_future.js b/frontend_tests/node_tests/search_future.js
index c6675245a11..038d2acb3a3 100644
--- a/frontend_tests/node_tests/search_future.js
+++ b/frontend_tests/node_tests/search_future.js
@@ -21,7 +21,6 @@ mock_esm("../../static/js/search_pill_widget", {
},
});
mock_esm("../../static/js/ui_util", {
- change_tab_to: noop,
place_caret_at_end: noop,
});
diff --git a/frontend_tests/node_tests/search_now.js b/frontend_tests/node_tests/search_now.js
index a85a9b83236..700da3f123b 100644
--- a/frontend_tests/node_tests/search_now.js
+++ b/frontend_tests/node_tests/search_now.js
@@ -9,14 +9,9 @@ const {page_params} = require("../zjsunit/zpage_params");
page_params.search_pills_enabled = false;
-const noop = () => {};
-
const narrow = mock_esm("../../static/js/narrow");
const narrow_state = mock_esm("../../static/js/narrow_state");
const search_suggestion = mock_esm("../../static/js/search_suggestion");
-mock_esm("../../static/js/ui_util", {
- change_tab_to: noop,
-});
const Filter = {};
diff --git a/static/js/gear_menu.js b/static/js/gear_menu.js
index 870f7f56914..9251e369b31 100644
--- a/static/js/gear_menu.js
+++ b/static/js/gear_menu.js
@@ -2,10 +2,7 @@ import $ from "jquery";
import render_gear_menu from "../templates/gear_menu.hbs";
-import * as hashchange from "./hashchange";
import {$t} from "./i18n";
-import * as message_viewport from "./message_viewport";
-import * as navigate from "./navigate";
import {page_params} from "./page_params";
import * as settings_data from "./settings_data";
@@ -80,15 +77,8 @@ in static/js/info_overlay.js. They are dispatched
using a click handler in static/js/click_handlers.js.
The click handler uses "[data-overlay-trigger]" as
the selector and then calls browser_history.go_to_location.
-
*/
-// We want to remember how far we were scrolled on each 'tab'.
-// To do so, we need to save away the old position of the
-// scrollbar when we switch to a new tab (and restore it
-// when we switch back.)
-const scroll_positions = new Map();
-
export function update_org_settings_menu_item() {
const $item = $(".admin-menu-item").expectOne();
if (page_params.is_admin) {
@@ -156,38 +146,6 @@ export function initialize() {
});
$("#navbar-buttons").html(rendered_gear_menu);
update_org_settings_menu_item();
-
- $('#gear-menu a[data-toggle="tab"]').on("show", (e) => {
- // Save the position of our old tab away, before we switch
- const old_tab = $(e.relatedTarget).attr("href");
- scroll_positions.set(old_tab, message_viewport.scrollTop());
- });
- $('#gear-menu a[data-toggle="tab"]').on("shown", (e) => {
- const target_tab = $(e.target).attr("href");
- // Hide all our error messages when switching tabs
- $(".alert").removeClass("show");
-
- // Set the URL bar title to show the sub-page you're currently on.
- let browser_url = target_tab;
- if (browser_url === "#message_feed_container") {
- browser_url = "";
- }
- hashchange.changehash(browser_url);
-
- // After we show the new tab, restore its old scroll position
- // (we apparently have to do this after setting the hash,
- // because otherwise that action may scroll us somewhere.)
- if (target_tab === "#message_feed_container") {
- if (scroll_positions.has(target_tab)) {
- message_viewport.scrollTop(scroll_positions.get(target_tab));
- } else {
- navigate.scroll_to_selected();
- }
- }
- });
-
- // The admin and settings pages are generated client-side through
- // templates.
}
export function open() {
diff --git a/static/js/hashchange.js b/static/js/hashchange.js
index 75de9050018..2ea35305b04 100644
--- a/static/js/hashchange.js
+++ b/static/js/hashchange.js
@@ -26,7 +26,6 @@ import * as spectators from "./spectators";
import * as stream_settings_ui from "./stream_settings_ui";
import * as top_left_corner from "./top_left_corner";
import * as ui_report from "./ui_report";
-import * as ui_util from "./ui_util";
import * as user_groups_settings_ui from "./user_groups_settings_ui";
import {user_settings} from "./user_settings";
@@ -91,7 +90,6 @@ export function save_narrow(operators) {
function show_all_message_view() {
const coming_from_recent_topics = maybe_hide_recent_topics();
- ui_util.change_tab_to("#message_feed_container");
narrow.deactivate(coming_from_recent_topics);
top_left_corner.handle_narrow_deactivated();
floating_recipient_bar.update();
@@ -138,7 +136,6 @@ function do_hashchange_normal(from_reload) {
switch (hash[0]) {
case "#narrow": {
maybe_hide_recent_topics();
- ui_util.change_tab_to("#message_feed_container");
let operators;
try {
// TODO: Show possible valid URLs to the user.
diff --git a/static/js/narrow.js b/static/js/narrow.js
index 94ebc3a1483..17968af29b1 100644
--- a/static/js/narrow.js
+++ b/static/js/narrow.js
@@ -39,7 +39,6 @@ import * as stream_list from "./stream_list";
import * as top_left_corner from "./top_left_corner";
import * as topic_generator from "./topic_generator";
import * as typing_events from "./typing_events";
-import * as ui_util from "./ui_util";
import * as unread from "./unread";
import * as unread_ops from "./unread_ops";
import * as unread_ui from "./unread_ui";
@@ -489,7 +488,6 @@ export function activate(raw_operators, opts) {
$("#zfilt").addClass("focused_table");
$("#zhome").removeClass("focused_table");
- ui_util.change_tab_to("#message_feed_container");
message_list.set_narrowed(msg_list);
message_lists.set_current(message_list.narrowed);
diff --git a/static/js/search.js b/static/js/search.js
index 8de5d117de9..50f06ea1f2c 100644
--- a/static/js/search.js
+++ b/static/js/search.js
@@ -24,7 +24,6 @@ export function narrow_or_search_for_term(search_string) {
// while using input tool
return $search_query_box.val();
}
- ui_util.change_tab_to("#message_feed_container");
let operators;
if (page_params.search_pills_enabled) {
diff --git a/static/js/ui_util.ts b/static/js/ui_util.ts
index 81a0e501e72..bf399845128 100644
--- a/static/js/ui_util.ts
+++ b/static/js/ui_util.ts
@@ -5,10 +5,6 @@ import * as keydown_util from "./keydown_util";
// Add functions to this that have no non-trivial
// dependencies other than jQuery.
-export function change_tab_to(tabname: string): void {
- $(`#gear-menu a[href="${CSS.escape(tabname)}"]`).tab("show");
-}
-
// https://stackoverflow.com/questions/4233265/contenteditable-set-caret-at-the-end-of-the-text-cross-browser
export function place_caret_at_end(el: HTMLElement): void {
el.focus();
diff --git a/static/styles/zulip.css b/static/styles/zulip.css
index aad19603603..5f61579db91 100644
--- a/static/styles/zulip.css
+++ b/static/styles/zulip.css
@@ -546,6 +546,10 @@ p.n-margin {
.column-middle {
min-height: 100%;
+
+ .column-middle-inner {
+ overflow: auto;
+ }
}
}
diff --git a/static/templates/gear_menu.hbs b/static/templates/gear_menu.hbs
index fdf3ed37244..98a4eeb8124 100644
--- a/static/templates/gear_menu.hbs
+++ b/static/templates/gear_menu.hbs
@@ -4,10 +4,6 @@
<i class="fa fa-cog settings-dropdown-cog" aria-hidden="true"></i>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="settings-dropdown">
- {{!-- It is quite ingrained in our frontend code that your Home
- view is a Bootstrap nav tab, even though we don't show the tab
- anymore --}}
- <li class="invisible" style="display:none;" role="presentation"><a href="#message_feed_container" data-toggle="tab"></a></li>
<li class="org-info org-name">{{realm_name}}</li>
<li class="org-info org-url">{{realm_uri}}</li>
{{#if is_self_hosted }}
diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html
index 4fea28d98e6..8131ecd8d6a 100644
--- a/templates/zerver/app/index.html
+++ b/templates/zerver/app/index.html
@@ -151,7 +151,7 @@
<div class="column-left" id="left-sidebar-container">
</div>
<div class="column-middle">
- <div class="column-middle-inner tab-content">
+ <div class="column-middle-inner">
<div id="recent_topics_view">
<div class="recent_topics_container">
<div id="recent_topics_table"></div>
@@ -166,7 +166,7 @@
</div>
</div>
</div>
- <div class="tab-pane" id="message_feed_container">
+ <div id="message_feed_container">
<div class="fixed-app" id="floating_recipient_bar">
<div class="app-main recipient_bar_content">
<div class="column-middle column-overlay recipient-bar-main">