mirror of
https://github.com/zulip/zulip.git
synced 2025-11-20 22:48:16 +00:00
bulk_access_messages: Bulk fetch Subscription details.
This completes the effort to make it possible to use bulk_access_message in contexts where there are more than a handful of messages without creating performance issues.
This commit is contained in:
@@ -58,6 +58,14 @@ def get_subscribed_stream_ids_for_user(user_profile: UserProfile) -> QuerySet:
|
||||
).values_list("recipient__type_id", flat=True)
|
||||
|
||||
|
||||
def get_subscribed_stream_recipient_ids_for_user(user_profile: UserProfile) -> QuerySet:
|
||||
return Subscription.objects.filter(
|
||||
user_profile_id=user_profile,
|
||||
recipient__type=Recipient.STREAM,
|
||||
active=True,
|
||||
).values_list("recipient_id", flat=True)
|
||||
|
||||
|
||||
def get_stream_subscriptions_for_user(user_profile: UserProfile) -> QuerySet:
|
||||
# TODO: Change return type to QuerySet[Subscription]
|
||||
return Subscription.objects.filter(
|
||||
|
||||
Reference in New Issue
Block a user