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: Fix abnormal initialize calling convention.

Anders Kaseorgff04cafc40d2
diff --git a/web/src/onboarding_steps.ts b/web/src/onboarding_steps.ts
index 89e964edeb3..2da1549dc01 100644
--- a/web/src/onboarding_steps.ts
+++ b/web/src/onboarding_steps.ts
@@ -8,8 +8,9 @@ import * as blueslip from "./blueslip.ts";
import * as channel from "./channel.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";
import * as people from "./people.ts";
-import type {NarrowTerm, StateData, onboarding_step_schema} from "./state_data.ts";
+import type {StateData, onboarding_step_schema} from "./state_data.ts";
import * as util from "./util.ts";
export type OnboardingStep = z.output<typeof onboarding_step_schema>;
@@ -56,7 +57,7 @@ export function update_onboarding_steps_to_display(onboarding_steps: OnboardingS
function narrow_to_dm_with_welcome_bot_new_user(
onboarding_steps: OnboardingStep[],
- show_message_view: (raw_terms: NarrowTerm[], opts: {trigger: string}) => void,
+ show_message_view: typeof message_view.show,
): void {
if (
onboarding_steps.some(
@@ -168,10 +169,9 @@ function show_navigation_tour_video(navigation_tour_video_url: string | null): v
export function initialize(
params: StateData["onboarding_steps"],
- navigation_tour_video_url: StateData["navigation_tour_video_url"],
- show_message_view: (raw_terms: NarrowTerm[], opts: {trigger: string}) => void,
+ {show_message_view}: {show_message_view: typeof message_view.show},
): 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(navigation_tour_video_url);
+ show_navigation_tour_video(params.navigation_tour_video_url);
}
diff --git a/web/src/state_data.ts b/web/src/state_data.ts
index e78cbc6d2ca..b0d3871f0f7 100644
--- a/web/src/state_data.ts
+++ b/web/src/state_data.ts
@@ -580,10 +580,7 @@ export const state_data_schema = z
onboarding_steps: z.array(onboarding_step_schema),
navigation_tour_video_url: z.nullable(z.string()),
})
- .transform(({onboarding_steps, navigation_tour_video_url}) => ({
- onboarding_steps: {onboarding_steps},
- navigation_tour_video_url,
- })),
+ .transform((onboarding_steps) => ({onboarding_steps})),
)
.and(current_user_schema.transform((current_user) => ({current_user})))
.and(realm_schema.transform((realm) => ({realm})));
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index 531e3d528cc..bd94f5783fe 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -717,11 +717,9 @@ export async function initialize_everything(state_data) {
drafts_overlay_ui.initialize();
// This needs to happen after activity_ui.initialize, so that user_filter
// is defined. Also, must happen after people.initialize()
- onboarding_steps.initialize(
- state_data.onboarding_steps,
- state_data.navigation_tour_video_url,
- message_view.show,
- );
+ onboarding_steps.initialize(state_data.onboarding_steps, {
+ show_message_view: message_view.show,
+ });
typing.initialize();
starred_messages_ui.initialize();
user_status_ui.initialize();