mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 18:36:36 +00:00
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:
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user