diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index 8aca189956..099e6ae59f 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -1104,17 +1104,18 @@ run_test('warn_if_mentioning_unsubscribed_user', () => { $('#compose_invite_users .compose_invite_user').length = 0; - function test_noop_case(msg_type, is_zephyr_mirror, mentioned_full_name) { + function test_noop_case(is_private, is_zephyr_mirror, is_broadcast) { + const msg_type = is_private ? 'private' : 'stream'; compose_state.set_message_type(msg_type); page_params.realm_is_zephyr_mirror_realm = is_zephyr_mirror; - mentioned.full_name = mentioned_full_name; + mentioned.is_broadcast = is_broadcast; compose.warn_if_mentioning_unsubscribed_user(mentioned); assert.equal($('#compose_invite_users').visible(), false); } - test_noop_case('private', true, 'everyone'); - test_noop_case('stream', true, 'everyone'); - test_noop_case('stream', false, 'everyone'); + test_noop_case(true, false, false); + test_noop_case(false, true, false); + test_noop_case(false, false, true); // Test mentioning a user that should gets a warning. diff --git a/static/js/compose.js b/static/js/compose.js index bbeb0ba77d..b9a3e2e7ba 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -849,8 +849,8 @@ exports.warn_if_mentioning_unsubscribed_user = function (mentioned) { const email = mentioned.email; - if (mentioned.full_name === 'all' || mentioned.full_name === 'everyone' || mentioned.full_name === 'stream') { - return; // don't check if @all or @everyone is subscribed to a stream + if (mentioned.is_broadcast) { + return; // don't check if @all/@everyone/@stream } if (exports.needs_subscribe_warning(email)) {