diff --git a/web/src/compose_actions.js b/web/src/compose_actions.js index cad56b37b0..ae95c06271 100644 --- a/web/src/compose_actions.js +++ b/web/src/compose_actions.js @@ -23,7 +23,6 @@ import * as resize from "./resize"; import * as settings_config from "./settings_config"; import * as spectators from "./spectators"; import {realm} from "./state_data"; -import * as stream_bar from "./stream_bar"; import * as stream_data from "./stream_data"; const compose_clear_box_hooks = []; @@ -115,12 +114,6 @@ export function complete_starting_tasks(msg_type, opts) { maybe_scroll_up_selected_message(opts); compose_fade.start_compose(msg_type); - if (msg_type === "stream") { - stream_bar.decorate( - opts.stream_id, - $("#stream_message_recipient_topic .message_header_stream"), - ); - } $(document).trigger(new $.Event("compose_started.zulip", opts)); compose_recipient.update_placeholder_text(); compose_recipient.update_narrow_to_recipient_visibility(); @@ -245,13 +238,6 @@ export function start(msg_type, opts) { clear_box(); } - if (msg_type === "stream") { - const $stream_header_colorblock = $( - "#compose_select_recipient_widget_wrapper .stream_header_colorblock", - ); - stream_bar.decorate(opts.stream_id, $stream_header_colorblock); - } - if (msg_type === "private") { compose_state.set_compose_recipient_id(compose_state.DIRECT_MESSAGE_ID); compose_recipient.on_compose_select_recipient_update(); diff --git a/web/src/compose_recipient.js b/web/src/compose_recipient.js index efc2f31422..1a35c76fc9 100644 --- a/web/src/compose_recipient.js +++ b/web/src/compose_recipient.js @@ -18,7 +18,6 @@ import * as narrow_state from "./narrow_state"; import * as people from "./people"; import * as settings_config from "./settings_config"; import {realm} from "./state_data"; -import * as stream_bar from "./stream_bar"; import * as stream_data from "./stream_data"; import * as sub_store from "./sub_store"; import * as ui_util from "./ui_util"; @@ -207,12 +206,8 @@ export function on_compose_select_recipient_update() { if (curr_message_type === "stream") { // Update stream name in the recipient box. - const $stream_header_colorblock = $( - "#compose_select_recipient_widget_wrapper .stream_header_colorblock", - ); const stream_id = compose_state.stream_id(); update_recipient_label(stream_id); - stream_bar.decorate(stream_id, $stream_header_colorblock); } update_on_recipient_change(); diff --git a/web/src/stream_bar.ts b/web/src/stream_bar.ts deleted file mode 100644 index b9b7499ca1..0000000000 --- a/web/src/stream_bar.ts +++ /dev/null @@ -1,10 +0,0 @@ -import * as stream_data from "./stream_data"; - -// In an attempt to decrease mixing, set stream bar -// color look like the stream being used. -// (In particular, if there's a color associated with it, -// have that color be reflected here too.) -export function decorate(stream_id: number | undefined, $element: JQuery): void { - const color = stream_data.get_color(stream_id); - $element.css("background-color", color); -} diff --git a/web/src/stream_popover.js b/web/src/stream_popover.js index a8d7cf2abc..720bdb8a4e 100644 --- a/web/src/stream_popover.js +++ b/web/src/stream_popover.js @@ -18,7 +18,6 @@ import * as message_lists from "./message_lists"; import * as popover_menus from "./popover_menus"; import {left_sidebar_tippy_options} from "./popover_menus"; import * as settings_data from "./settings_data"; -import * as stream_bar from "./stream_bar"; import * as stream_color from "./stream_color"; import * as stream_data from "./stream_data"; import * as stream_settings_api from "./stream_settings_api"; @@ -33,7 +32,6 @@ import * as util from "./util"; // that pop up from the left sidebar. let stream_popover_instance = null; let stream_widget_value; -let $stream_header_colorblock; function get_popover_menu_items(sidebar_elem) { if (!sidebar_elem) { @@ -486,7 +484,6 @@ export async function build_move_topic_to_stream_popover( function render_selected_stream() { const stream_id = Number.parseInt(stream_widget_value, 10); - stream_bar.decorate(stream_id, $stream_header_colorblock); const stream = stream_data.get_sub_by_id(stream_id); if (stream === undefined) { $("#move_topic_to_stream_widget .dropdown_widget_value").text( @@ -531,9 +528,6 @@ export async function build_move_topic_to_stream_popover( return; } - $stream_header_colorblock = $("#dialog_widget_modal .topic_stream_edit_header").find( - ".stream_header_colorblock", - ); stream_widget_value = current_stream_id; const streams_list_options = () => stream_data.get_options_for_dropdown_widget().filter((stream) => { @@ -557,9 +551,6 @@ export async function build_move_topic_to_stream_popover( render_selected_stream(); $("#move_topic_to_stream_widget").prop("disabled", disable_stream_input); - if (disable_stream_input) { - $stream_header_colorblock.addClass("disabled"); - } $("#move_topic_modal .move_messages_edit_topic").on("input", () => { update_submit_button_disabled_state(stream_widget_value); }); diff --git a/web/styles/app_components.css b/web/styles/app_components.css index 6ffbff4589..ceca361a3b 100644 --- a/web/styles/app_components.css +++ b/web/styles/app_components.css @@ -484,12 +484,6 @@ div.overlay { border-bottom: 0; } -.stream_header_colorblock { - @extend .stream-selection-header-colorblock; - margin-bottom: 5px; - z-index: 1; -} - .edit-controls .fa-angle-right, .topic_stream_edit_header .fa-angle-right { font-size: 0.9em; diff --git a/web/styles/compose.css b/web/styles/compose.css index 730f18a1ee..de25b695a9 100644 --- a/web/styles/compose.css +++ b/web/styles/compose.css @@ -163,10 +163,6 @@ #compose_select_recipient_widget { border-radius: 4px !important; } - - .stream_header_colorblock { - display: none; - } } .topic-marker-container { @@ -828,12 +824,12 @@ textarea.new_message_textarea, } #compose_select_recipient_widget { - border-radius: 0 4px 4px 0; width: auto; outline: none; &.dropdown-widget-button { padding: 0 6px; + border-radius: 4px; } } @@ -1163,13 +1159,8 @@ textarea.new_message_textarea, justify-content: flex-start; height: var(--compose-recipient-box-min-height); - .stream_header_colorblock { - margin: 0; - } - .dropdown_widget_value { flex-grow: 1; - overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-default); diff --git a/web/styles/message_row.css b/web/styles/message_row.css index b6223028d3..d5492a1b19 100644 --- a/web/styles/message_row.css +++ b/web/styles/message_row.css @@ -605,10 +605,6 @@ $time_column_min_width: 42px; /* + padding */ margin-top: 0; } - .stream_header_colorblock { - margin-bottom: 10px; - } - & textarea { width: 100%; min-width: 206px; diff --git a/web/styles/popovers.css b/web/styles/popovers.css index 9d99dbe928..e03ba6e515 100644 --- a/web/styles/popovers.css +++ b/web/styles/popovers.css @@ -1026,19 +1026,12 @@ ul { margin-bottom: 10px; .dropdown-widget-button { - /* Override the default border-radius to properly align - the button corners with `stream_header_colorblock`. */ - border-radius: 1px 4px 4px 1px !important; outline: none; line-height: 24px; width: auto; max-width: 206px; } - .stream_header_colorblock { - margin: 0; - } - .dropdown_widget_value { overflow: hidden; text-overflow: ellipsis; diff --git a/web/templates/compose.hbs b/web/templates/compose.hbs index 90c292ac2a..2a7a9e4090 100644 --- a/web/templates/compose.hbs +++ b/web/templates/compose.hbs @@ -58,7 +58,7 @@
- {{> dropdown_widget_with_stream_colorblock + {{> dropdown_widget_wrapper widget_name="compose_select_recipient"}}
diff --git a/web/templates/dropdown_widget_with_stream_colorblock.hbs b/web/templates/dropdown_widget_wrapper.hbs similarity index 70% rename from web/templates/dropdown_widget_with_stream_colorblock.hbs rename to web/templates/dropdown_widget_wrapper.hbs index b041180063..a2f6fd6659 100644 --- a/web/templates/dropdown_widget_with_stream_colorblock.hbs +++ b/web/templates/dropdown_widget_wrapper.hbs @@ -1,4 +1,3 @@
-
{{> dropdown_widget disable_keyboard_focus="true"}}
diff --git a/web/templates/move_topic_to_stream.hbs b/web/templates/move_topic_to_stream.hbs index 7428afbdd7..a477ce2ff2 100644 --- a/web/templates/move_topic_to_stream.hbs +++ b/web/templates/move_topic_to_stream.hbs @@ -9,7 +9,7 @@ {{/if}}
{{#unless only_topic_edit}} - {{> dropdown_widget_with_stream_colorblock widget_name="move_topic_to_stream"}} + {{> dropdown_widget_wrapper widget_name="move_topic_to_stream"}} {{/unless}} diff --git a/web/tests/compose.test.js b/web/tests/compose.test.js index 02e68230da..c63a8cca09 100644 --- a/web/tests/compose.test.js +++ b/web/tests/compose.test.js @@ -4,7 +4,6 @@ const {strict: assert} = require("assert"); const MockDate = require("mockdate"); -const {mock_stream_header_colorblock} = require("./lib/compose"); const {mock_banners} = require("./lib/compose_banner"); const {$t} = require("./lib/i18n"); const {mock_esm, set_global, zrequire} = require("./lib/namespace"); @@ -374,7 +373,6 @@ test_ui("send_message", ({override, override_rewire, mock_template}) => { test_ui("enter_with_preview_open", ({override, override_rewire}) => { mock_banners(); $("textarea#compose-textarea").toggleClass = noop; - mock_stream_header_colorblock(); override_rewire(compose_banner, "clear_message_sent_banners", noop); override(document, "to_$", () => $("document-stub")); let show_button_spinner_called = false; @@ -424,7 +422,6 @@ test_ui("enter_with_preview_open", ({override, override_rewire}) => { test_ui("finish", ({override, override_rewire}) => { mock_banners(); - mock_stream_header_colorblock(); override_rewire(compose_banner, "clear_message_sent_banners", noop); override(document, "to_$", () => $("document-stub")); @@ -617,8 +614,6 @@ test_ui("trigger_submit_compose_form", ({override, override_rewire}) => { }); test_ui("on_events", ({override, override_rewire}) => { - mock_stream_header_colorblock(); - initialize_handlers({override}); override(rendered_markdown, "update_elements", noop); @@ -792,7 +787,6 @@ test_ui("on_events", ({override, override_rewire}) => { }); test_ui("create_message_object", ({override, override_rewire}) => { - mock_stream_header_colorblock(); mock_banners(); compose_state.set_stream_id(social.stream_id); diff --git a/web/tests/compose_actions.test.js b/web/tests/compose_actions.test.js index 001bdbdf33..374b5982c9 100644 --- a/web/tests/compose_actions.test.js +++ b/web/tests/compose_actions.test.js @@ -2,7 +2,6 @@ const {strict: assert} = require("assert"); -const {mock_stream_header_colorblock} = require("./lib/compose"); const {mock_banners} = require("./lib/compose_banner"); const {mock_esm, set_global, zrequire} = require("./lib/namespace"); const {run_test, noop} = require("./lib/test"); @@ -123,7 +122,6 @@ test("start", ({override, override_rewire, mock_template}) => { override_rewire(compose_recipient, "on_compose_select_recipient_update", noop); override_rewire(compose_recipient, "check_posting_policy_for_compose_box", noop); mock_template("inline_decorated_stream_name.hbs", false, noop); - mock_stream_header_colorblock(); let compose_defaults; override(narrow_state, "set_compose_defaults", () => compose_defaults); @@ -249,7 +247,6 @@ test("respond_to_message", ({override, override_rewire, mock_template}) => { override_rewire(compose_recipient, "check_posting_policy_for_compose_box", noop); override_private_message_recipient({override}); mock_template("inline_decorated_stream_name.hbs", false, noop); - mock_stream_header_colorblock(); // Test direct message const person = { @@ -297,7 +294,6 @@ test("respond_to_message", ({override, override_rewire, mock_template}) => { test("reply_with_mention", ({override, override_rewire, mock_template}) => { mock_banners(); - mock_stream_header_colorblock(); compose_state.set_message_type("stream"); override_rewire(compose_recipient, "on_compose_select_recipient_update", noop); override_rewire(compose_actions, "complete_starting_tasks", noop); @@ -359,7 +355,6 @@ test("quote_and_reply", ({disallow, override, override_rewire}) => { override_rewire(compose_reply, "selection_within_message_id", () => undefined); mock_banners(); - mock_stream_header_colorblock(); compose_state.set_message_type("stream"); const steve = { user_id: 90, diff --git a/web/tests/compose_state.test.js b/web/tests/compose_state.test.js index c2057138cc..ad9ca8659f 100644 --- a/web/tests/compose_state.test.js +++ b/web/tests/compose_state.test.js @@ -2,7 +2,6 @@ const {strict: assert} = require("assert"); -const {mock_stream_header_colorblock} = require("./lib/compose"); const {mock_esm, zrequire} = require("./lib/namespace"); const {run_test, noop} = require("./lib/test"); const $ = require("./lib/zjquery"); @@ -25,7 +24,6 @@ run_test("private_message_recipient", ({override}) => { }); run_test("has_full_recipient", ({override}) => { - mock_stream_header_colorblock(); $(`#compose_banners .topic_resolved`).remove = noop; $(".narrow_to_compose_recipients").toggleClass = noop; diff --git a/web/tests/composebox_typeahead.test.js b/web/tests/composebox_typeahead.test.js index 0d702e2dd5..6281912a21 100644 --- a/web/tests/composebox_typeahead.test.js +++ b/web/tests/composebox_typeahead.test.js @@ -2,7 +2,6 @@ const {strict: assert} = require("assert"); -const {mock_stream_header_colorblock} = require("./lib/compose"); const {mock_banners} = require("./lib/compose_banner"); const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace"); const {run_test, noop} = require("./lib/test"); @@ -718,7 +717,6 @@ function sorted_names_from(subs) { const sweden_topics_to_show = ["<&>", "even more ice", "furniture", "ice", "kronor", "more ice"]; test("initialize", ({override, override_rewire, mock_template}) => { - mock_stream_header_colorblock(); mock_banners(); let pill_items = []; @@ -1890,7 +1888,6 @@ test("direct message recipients sorted according to stream / topic being viewed" (stream_id, user_id) => stream_id === denmark_stream.stream_id && user_id === cordelia.user_id, ); - mock_stream_header_colorblock(); mock_banners(); // When viewing no stream, sorting is alphabetical diff --git a/web/tests/drafts.test.js b/web/tests/drafts.test.js index edaeeda9ef..057052fcbf 100644 --- a/web/tests/drafts.test.js +++ b/web/tests/drafts.test.js @@ -2,7 +2,6 @@ const {strict: assert} = require("assert"); -const {mock_stream_header_colorblock} = require("./lib/compose"); const {mock_banners} = require("./lib/compose_banner"); const {mock_esm, set_global, zrequire} = require("./lib/namespace"); const {run_test, noop} = require("./lib/test"); @@ -196,8 +195,6 @@ test("snapshot_message", ({override, override_rewire}) => { $(".narrow_to_compose_recipients").toggleClass = noop; - mock_stream_header_colorblock(); - let curr_draft; function set_compose_state() { diff --git a/web/tests/lib/compose.js b/web/tests/lib/compose.js deleted file mode 100644 index ef87cddd16..0000000000 --- a/web/tests/lib/compose.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -const {noop} = require("./test"); -const $ = require("./zjquery"); - -exports.mock_stream_header_colorblock = () => { - const $stream_selection_dropdown = $("#compose_select_recipient_widget_wrapper"); - const $stream_header_colorblock = $(".stream_header_colorblock"); - $("#compose_select_recipient_widget_wrapper .stream_header_colorblock").css = noop; - $stream_selection_dropdown.set_find_results( - ".stream_header_colorblock", - $stream_header_colorblock, - ); -};