Outgoing Webhook System: Prevent infinite loops with outgoing webhooks.

This commit is contained in:
vaibhav
2017-05-23 09:26:28 +05:30
committed by Tim Abbott
parent 53a8b2ac87
commit c7524f2f38

View File

@@ -798,8 +798,14 @@ def do_send_messages(messages_maybe_none):
ums.extend(ums_to_create)
# Now prepare the outgoing webhook events
message['message'].outgoing_webhook_bot_triggers = []
# Avoid infinite loops by preventing messages sent by bots
# from triggering outgoing webhooks.
sender = message['message'].sender
if sender.is_bot:
continue
# TODO: Right now, outgoing webhook bots need to be a
# subscribed to a stream in order to receive messages when
# mentioned; we will want to change that structure.