mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
compose: Fix validation treating welcome bot as deactivated.
This commit is contained in:
@@ -47,6 +47,16 @@ people.initialize_current_user(me.user_id);
|
|||||||
people.add_active_user(alice);
|
people.add_active_user(alice);
|
||||||
people.add_active_user(bob);
|
people.add_active_user(bob);
|
||||||
|
|
||||||
|
const welcome_bot = {
|
||||||
|
email: "welcome-bot@example.com",
|
||||||
|
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) {
|
function test_ui(label, f) {
|
||||||
// The sloppy_$ flag lets us re-use setup from prior tests.
|
// The sloppy_$ flag lets us re-use setup from prior tests.
|
||||||
run_test(label, ({override, mock_template}) => {
|
run_test(label, ({override, mock_template}) => {
|
||||||
@@ -215,6 +225,11 @@ test_ui("validate", ({override, mock_template}) => {
|
|||||||
assert.ok(compose_validate.validate());
|
assert.ok(compose_validate.validate());
|
||||||
page_params.realm_is_zephyr_mirror_realm = false;
|
page_params.realm_is_zephyr_mirror_realm = false;
|
||||||
|
|
||||||
|
initialize_pm_pill();
|
||||||
|
add_content_to_compose_box();
|
||||||
|
compose_state.private_message_recipient("welcome-bot@example.com");
|
||||||
|
assert.ok(compose_validate.validate());
|
||||||
|
|
||||||
compose_state.set_message_type("stream");
|
compose_state.set_message_type("stream");
|
||||||
compose_state.stream_name("");
|
compose_state.stream_name("");
|
||||||
assert.ok(!compose_validate.validate());
|
assert.ok(!compose_validate.validate());
|
||||||
|
|||||||
@@ -1164,6 +1164,10 @@ export const is_person_active = (user_id) => {
|
|||||||
blueslip.error("No user found.", 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);
|
return active_user_dict.has(user_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user