mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
bot events: Prevent duplicate add-bot notifications.
We don't need `do_create_user` to send a partial event here for bots. The only caller to `do_create_user` that actually creates bots (apart from some tests that just need data setup) is `add_bot_backend`, which sends the more complete event including bot "extras" like service info. The modified event tests show the simplification here (2 events instead of 3). Also, the bot tests now use tuple unpacking, which will force a ValueError if we duplicate events again.
This commit is contained in:
@@ -523,10 +523,10 @@ def do_create_user(email: str, password: Optional[str], realm: Realm, full_name:
|
||||
if settings.BILLING_ENABLED:
|
||||
update_license_ledger_if_needed(user_profile.realm, event_time)
|
||||
|
||||
# Note that for bots, the caller will send an additional event
|
||||
# with bot-specific info like services.
|
||||
notify_created_user(user_profile)
|
||||
if bot_type:
|
||||
notify_created_bot(user_profile)
|
||||
else:
|
||||
if bot_type is None:
|
||||
process_new_human_user(user_profile, prereg_user=prereg_user,
|
||||
newsletter_data=newsletter_data,
|
||||
default_stream_groups=default_stream_groups,
|
||||
|
||||
Reference in New Issue
Block a user