Fix @-mention "not subscribed" warning for all_public_streams bots.

Don't warn when @-mentioning a bot on a public stream that it does
not appear to be subscribed to. It may be receiving those messages
anyway.

(imported from commit 4a00694942a721897a01736f48033c71048e0b16)
This commit is contained in:
Kevin Mehall
2013-10-18 10:51:26 -04:00
parent 7b8dea3d54
commit 89d149c6f7
2 changed files with 8 additions and 1 deletions

View File

@@ -560,7 +560,7 @@ $(function () {
if (data !== undefined && data.mentioned !== undefined) {
var email = data.mentioned.email;
if (!compose_fade.would_receive_message(email)) {
if (compose_fade.would_receive_message(email) === false) {
var new_row = templates.render("compose-invite-users", {email: email,
name: data.mentioned.full_name});
var error_area = $("#compose_invite_users");

View File

@@ -84,6 +84,13 @@ exports.would_receive_message = function (email) {
}
if (focused_recipient.type === 'stream') {
var user = realm_people_dict.get(email);
var sub = stream_data.get_sub(focused_recipient.stream);
if (user && sub && user.is_bot && !sub.invite_only) {
// Bots may receive messages on public streams even if they are
// not subscribed.
return undefined;
}
return stream_data.user_is_subscribed(focused_recipient.stream, email);
}