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: Narrow new users in DMs with Welcome Bot.

Prakhar Pratyushcaedcb8b8ba1
diff --git a/web/src/people.ts b/web/src/people.ts
index 134f810845b..e74902d9c40 100644
--- a/web/src/people.ts
+++ b/web/src/people.ts
@@ -55,6 +55,7 @@ let duplicate_full_name_data: FoldDict<Set<number>>;
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 a722522131c..39d9b0485e5 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 91499e0f3e7..7e6f742f03b 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