mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 01:47:41 +00:00
refactor: Pass realm to bulk_add_subscriptions.
I think it's important that the callers understand that bulk_add_subscriptions assumes all streams are being created within a single realm, so I make it an explicit parameter. This may be overkill--I would also be happy if we just included the assertions from this commit.
This commit is contained in:
@@ -869,12 +869,13 @@ Output:
|
||||
|
||||
# Subscribe to a stream directly
|
||||
def subscribe(self, user_profile: UserProfile, stream_name: str) -> Stream:
|
||||
realm = user_profile.realm
|
||||
try:
|
||||
stream = get_stream(stream_name, user_profile.realm)
|
||||
from_stream_creation = False
|
||||
except Stream.DoesNotExist:
|
||||
stream, from_stream_creation = create_stream_if_needed(user_profile.realm, stream_name)
|
||||
bulk_add_subscriptions([stream], [user_profile], from_stream_creation=from_stream_creation)
|
||||
stream, from_stream_creation = create_stream_if_needed(realm, stream_name)
|
||||
bulk_add_subscriptions(realm, [stream], [user_profile], from_stream_creation=from_stream_creation)
|
||||
return stream
|
||||
|
||||
def unsubscribe(self, user_profile: UserProfile, stream_name: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user