From caedcb8b8ba170bfec415a2097c9b94a13397e03 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Fri, 28 Jun 2024 13:50:34 +0530 Subject: [PATCH] onboarding: Narrow new users in DMs with Welcome Bot. Earlier, new users were narrowed to the interleaved DMs view on the first visit. This commit updates the behavior to narrow new users in DMs with Welcome Bot. Reason for the change: It makes more sense overall as an interleaved DMs view is a power user view and it would also prevent the message fading banner #29076 from showing up if the user DMs Welcome Bot right away. --- web/src/people.ts | 4 ++++ web/src/tutorial.js | 5 +++-- web/src/ui_init.js | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/src/people.ts b/web/src/people.ts index 134f810845..e74902d9c4 100644 --- a/web/src/people.ts +++ b/web/src/people.ts @@ -55,6 +55,7 @@ let duplicate_full_name_data: FoldDict>; let my_user_id: number; export let INACCESSIBLE_USER_NAME: string; +export let WELCOME_BOT: CrossRealmBot; // We have an init() function so that our automated tests // can easily clear data. @@ -1390,6 +1391,9 @@ export function add_cross_realm_user(person: CrossRealmBot): void { _add_user(person); } cross_realm_dict.set(person.user_id, person); + if (person.full_name === "Welcome Bot") { + WELCOME_BOT = person; + } } export function deactivate(person: User): void { diff --git a/web/src/tutorial.js b/web/src/tutorial.js index a722522131..39d9b0485e 100644 --- a/web/src/tutorial.js +++ b/web/src/tutorial.js @@ -1,6 +1,7 @@ import * as channel from "./channel"; import * as message_view from "./message_view"; import {page_params} from "./page_params"; +import * as people from "./people"; function set_tutorial_status(status, callback) { return channel.post({ @@ -16,8 +17,8 @@ export function initialize() { message_view.show( [ { - operator: "is", - operand: "private", + operator: "dm", + operand: people.WELCOME_BOT.user_id, }, ], {trigger: "sidebar"}, diff --git a/web/src/ui_init.js b/web/src/ui_init.js index 91499e0f3e..7e6f742f03 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -636,7 +636,7 @@ export function initialize_everything(state_data) { }, }); // This needs to happen after activity_ui.initialize, so that user_filter - // is defined. + // is defined. Also, must happen after people.initialize() tutorial.initialize(); // All overlays, and also activity_ui, must be initialized before hashchange.js