zulip/zerver
Anders Kaseorg 7657cb4a0f django_api: Extract send_event_on_commit helper.
django-stubs 4.2.1 gives transaction.on_commit a more accurate type
annotation, but this exposed that mypy can’t handle the lambda default
parameters that we use to recapture loop variables such as

    for stream_id in public_stream_ids:
        peer_user_ids = …
        event = …

        transaction.on_commit(
            lambda event=event, peer_user_ids=peer_user_ids: send_event(
                realm, event, peer_user_ids
            )
        )

https://github.com/python/mypy/issues/15459

A workaround that mypy accepts is

        transaction.on_commit(
            (
                lambda event, peer_user_ids: lambda: send_event(
                    realm, event, peer_user_ids
                )
            )(event, peer_user_ids)
        )

But that’s kind of ugly and potentially error-prone, so let’s make a
helper function for this very common pattern.

        send_event_on_commit(realm, event, peer_user_ids)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-06-19 13:42:40 -07:00
..
actions django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
data_import slack import: Convert threads to nicely named Zulip topics. 2023-05-30 16:35:19 -07:00
integration_fixtures/nagios
lib send_email: Delete ScheduledEmail objects with no recipients. 2023-06-19 13:40:50 -07:00
management ruff: Fix PLC0208 Use a sequence type when iterating over values. 2023-06-06 14:58:11 -07:00
migrations settings: Add wildcard mention notifications for the followed topics. 2023-06-13 18:01:41 -07:00
openapi settings: Configure 'enable_followed_topic_audible_notifications'. 2023-06-13 18:01:41 -07:00
tests django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
tornado django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
views settings: Configure 'enable_followed_topic_audible_notifications'. 2023-06-13 18:01:41 -07:00
webhooks integrations: Update links for various events in GitLab Integration. 2023-06-12 17:14:18 -07:00
worker realm_export: Handle hard head-of-queue failures. 2023-05-16 14:05:01 -07:00
__init__.py
apps.py requirements: Upgrade Python requirements. 2023-04-03 22:39:21 -07:00
context_processors.py emails: Add corporate_enabled to context for emails. 2023-05-01 10:32:43 -07:00
decorator.py Remove statsd support. 2023-04-25 19:58:16 -07:00
filters.py
forms.py accounts: Allow user to change email visibility during first login. 2023-05-16 13:52:56 -07:00
logging_handlers.py python: Use Python 3.8 typing.{Protocol,TypedDict}. 2022-04-27 12:57:49 -07:00
middleware.py middleware: Redirect non-canonical realm domain names. 2023-05-16 15:13:51 -07:00
models.py models: Fix typo in comment. 2023-06-15 17:50:34 -04:00
signals.py requirements: Upgrade to Django 4.0. 2022-07-13 16:07:17 -07:00