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.

compose: Fix validation treating welcome bot as deactivated.

Tim Abbott99e6618f07d2
diff --git a/frontend_tests/node_tests/compose_validate.js b/frontend_tests/node_tests/compose_validate.js
index ff91e50ed26..ffe9fb949a7 100644
--- a/frontend_tests/node_tests/compose_validate.js
+++ b/frontend_tests/node_tests/compose_validate.js
@@ -47,6 +47,16 @@ people.initialize_current_user(me.user_id);
people.add_active_user(alice);
people.add_active_user(bob);
+const welcome_bot = {
+ email: "[email protected]",
+ user_id: 4,
+ full_name: "Welcome Bot",
+ is_bot: true,
+ // cross realm bots have no owner
+};
+
+people.add_cross_realm_user(welcome_bot);
+
function test_ui(label, f) {
// The sloppy_$ flag lets us re-use setup from prior tests.
run_test(label, ({override, mock_template}) => {
@@ -215,6 +225,11 @@ test_ui("validate", ({override, mock_template}) => {
assert.ok(compose_validate.validate());
page_params.realm_is_zephyr_mirror_realm = false;
+ initialize_pm_pill();
+ add_content_to_compose_box();
+ compose_state.private_message_recipient("[email protected]");
+ assert.ok(compose_validate.validate());
+
compose_state.set_message_type("stream");
compose_state.stream_name("");
assert.ok(!compose_validate.validate());
diff --git a/static/js/people.js b/static/js/people.js
index b581c50b19c..49b3c85257e 100644
--- a/static/js/people.js
+++ b/static/js/people.js
@@ -1164,6 +1164,10 @@ export const is_person_active = (user_id) => {
blueslip.error("No user found.", user_id);
}
+ if (cross_realm_dict.has(user_id)) {
+ return true;
+ }
+
return active_user_dict.has(user_id);
};