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:
Steve Howell
2020-10-13 13:16:27 +00:00
committed by Tim Abbott
parent efc931a671
commit 9df9934ed6
12 changed files with 40 additions and 27 deletions

View File

@@ -28,7 +28,7 @@ class Command(ZulipBaseCommand):
for stream_name in set(stream_names):
for user_profile in user_profiles:
stream = ensure_stream(realm, stream_name, acting_user=None)
_ignore, already_subscribed = bulk_add_subscriptions([stream], [user_profile])
_ignore, already_subscribed = bulk_add_subscriptions(realm, [stream], [user_profile])
was_there_already = user_profile.id in (tup[0].id for tup in already_subscribed)
print("{} {} to {}".format(
"Already subscribed" if was_there_already else "Subscribed",