zulip/zerver/tornado
Prakhar Pratyush 1a400b21e7 notifications: Fix missed message email notifications of welcome bot.
A missed message email notification, where the message is the welcome
message sent by the welcome bot on account creation, get sent when
the user somehow not focuses the browser tab during account creation.

No missed message email or push notifications should be sent for the
messages generated by the welcome bot.

'internal_send_private_message' accepts a parameter
'disable_external_notifications' and is set to 'True' when the sender
is 'welcome bot'.

A check is introduced in `trivially_should_not_notify`, not to notify
if `disable_external_notifications` is true.

TestCases are updated to include the `disable_external_notifications`
check in the early (False) return patterns of `is_push_notifiable` and
`is_email_notifiable`.

One query reduced for both `test_create_user_with_multiple_streams`
and `test_register`.
Reason: When welcome bot sends message after user creation
`do_send_messages` calls `get_active_presence_idle_user_ids`,
`user_ids` in `get_active_presence_idle_user_ids` remains empty if
`disable_external_notifications` is true because `is_notifiable` returns
false.
`get_active_presence_idle_user_ids` calls `filter_presence_idle_user_ids`
and since the `user_ids` is empty, the query inside the function doesn't
get executed.

MissedMessageHookTest updated.

Fixes: #22884
2023-01-24 11:16:21 -08:00
..
__init__.py
application.py tornado: Construct Django BaseHandler once, not per-request. 2022-09-30 11:20:45 -07:00
descriptors.py tornado: Support sharding by user ID. 2022-11-15 17:27:01 -08:00
django_api.py tornado: Support sharding by user ID. 2022-11-15 17:27:01 -08:00
event_queue.py notifications: Fix missed message email notifications of welcome bot. 2023-01-24 11:16:21 -08:00
exceptions.py exceptions: Update error message for BAD_EVENT_QUEUE_ID. 2022-11-30 17:16:12 -08:00
handlers.py ruff: Fix SIM105 Use `contextlib.suppress` instead of try-except-pass. 2023-01-23 11:18:36 -08:00
ioloop_logging.py
sharding.py tornado: Support sharding by user ID. 2022-11-15 17:27:01 -08:00
views.py tornado: Move internal tornado redirect to under /internal/. 2023-01-09 18:23:58 -05:00