mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 12:33:40 +00:00
get_service_bot_events: Add some future-proofing.
The comment is the most important part here, but the new code structure should help, too.
This commit is contained in:
@@ -987,6 +987,19 @@ def get_service_bot_events(sender, service_bot_tuples, mentioned_user_ids,
|
||||
|
||||
is_stream = (recipient_type == Recipient.STREAM)
|
||||
|
||||
# Important note: service_bot_tuples may contain service bots
|
||||
# who were not actually mentioned in the message (e.g. if
|
||||
# mention syntax for that bot appeared in a code block).
|
||||
# Thus, it is important to filter any users who aren't part of
|
||||
# either mentioned_user_ids (the actual mentioned users) or
|
||||
# active_user_ids (the actual recipients).
|
||||
#
|
||||
# So even though this is implied by the logic below, we filter
|
||||
# these not-actually-mentioned users here, to help keep[ this
|
||||
# function future-proof.
|
||||
if user_profile_id not in mentioned_user_ids and user_profile_id not in active_user_ids:
|
||||
continue
|
||||
|
||||
# Mention triggers, primarily for stream messages
|
||||
if user_profile_id in mentioned_user_ids:
|
||||
trigger = 'mention'
|
||||
|
||||
Reference in New Issue
Block a user