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.

onboarding_steps: Pass update_recipient_row_attention_level as callback.

Alya Abbott1fe38a051392
diff --git a/web/src/onboarding_steps.ts b/web/src/onboarding_steps.ts
index a0163dec086..19ff50d7563 100644
--- a/web/src/onboarding_steps.ts
+++ b/web/src/onboarding_steps.ts
@@ -6,7 +6,6 @@ import render_navigation_tour_video_modal from "../templates/navigation_tour_vid
import * as browser_history from "./browser_history.ts";
import * as channel from "./channel.ts";
-import * as compose_recipient from "./compose_recipient.ts";
import * as dialog_widget from "./dialog_widget.ts";
import {$t, $t_html} from "./i18n.ts";
import type * as message_view from "./message_view.ts";
@@ -104,7 +103,10 @@ function narrow_to_dm_with_welcome_bot_new_user(
}
}
-function show_navigation_tour_video(navigation_tour_video_url: string | null): void {
+function show_navigation_tour_video(
+ navigation_tour_video_url: string | null,
+ update_recipient_row_attention_level: () => void,
+): void {
if (ONE_TIME_NOTICES_TO_DISPLAY.has("navigation_tour_video")) {
assert(navigation_tour_video_url !== null);
const modal_content_html = render_navigation_tour_video_modal({
@@ -193,7 +195,7 @@ function show_navigation_tour_video(navigation_tour_video_url: string | null): v
//
// We explicitly set the focus to #compose-textarea to avoid flaky nature.
$("textarea#compose-textarea").trigger("focus");
- compose_recipient.update_recipient_row_attention_level();
+ update_recipient_row_attention_level();
if (!watch_later_clicked) {
// $watch_later_button click handler already calls this function.
@@ -206,9 +208,19 @@ function show_navigation_tour_video(navigation_tour_video_url: string | null): v
export function initialize(
params: StateData["onboarding_steps"],
- {show_message_view}: {show_message_view: typeof message_view.show},
+ {
+ show_message_view,
+ update_recipient_row_attention_level,
+ }: {
+ show_message_view: typeof message_view.show;
+ update_recipient_row_attention_level: () => void;
+ },
): void {
update_onboarding_steps_to_display(params.onboarding_steps);
+
narrow_to_dm_with_welcome_bot_new_user(params.onboarding_steps, show_message_view);
- show_navigation_tour_video(params.navigation_tour_video_url);
+ show_navigation_tour_video(
+ params.navigation_tour_video_url,
+ update_recipient_row_attention_level,
+ );
}
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index 9da0359e683..bcf67582026 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -764,6 +764,8 @@ export async function initialize_everything(state_data) {
// is defined. Also, must happen after people.initialize()
onboarding_steps.initialize(state_data.onboarding_steps, {
show_message_view: message_view.show,
+ update_recipient_row_attention_level:
+ compose_recipient.update_recipient_row_attention_level,
});
typing.initialize();
starred_messages_ui.initialize();
diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjs
index 440795ee457..247b591f129 100644
--- a/web/tests/dispatch.test.cjs
+++ b/web/tests/dispatch.test.cjs
@@ -424,7 +424,10 @@ run_test("default_streams", ({override}) => {
});
run_test("onboarding_steps", () => {
- onboarding_steps.initialize({onboarding_steps: []}, () => {});
+ onboarding_steps.initialize(
+ {onboarding_steps: []},
+ {show_message_view() {}, update_recipient_row_attention_level() {}},
+ );
const event = event_fixtures.onboarding_steps;
const one_time_notices = new Set();
for (const onboarding_step of event.onboarding_steps) {