mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
refactor: Eliminate new_subs.
We now just process new subs for a user immediately within the loop.
This commit is contained in:
@@ -2827,7 +2827,7 @@ def bulk_add_subscriptions(streams: Iterable[Stream],
|
|||||||
|
|
||||||
already_subscribed: List[Tuple[UserProfile, Stream]] = []
|
already_subscribed: List[Tuple[UserProfile, Stream]] = []
|
||||||
subs_to_activate: List[Tuple[Subscription, Stream]] = []
|
subs_to_activate: List[Tuple[Subscription, Stream]] = []
|
||||||
new_subs: List[Tuple[UserProfile, int, Stream]] = []
|
subs_to_add: List[Tuple[Subscription, Stream]] = []
|
||||||
for user_profile in users:
|
for user_profile in users:
|
||||||
needs_new_sub: Set[int] = set(recipient_ids)
|
needs_new_sub: Set[int] = set(recipient_ids)
|
||||||
for sub in subs_by_user[user_profile.id]:
|
for sub in subs_by_user[user_profile.id]:
|
||||||
@@ -2841,12 +2841,10 @@ def bulk_add_subscriptions(streams: Iterable[Stream],
|
|||||||
# pick_color will consider this to be an active
|
# pick_color will consider this to be an active
|
||||||
# subscription when picking colors
|
# subscription when picking colors
|
||||||
sub.active = True
|
sub.active = True
|
||||||
|
|
||||||
for recipient_id in needs_new_sub:
|
for recipient_id in needs_new_sub:
|
||||||
stream = stream_map[recipient_id]
|
stream = stream_map[recipient_id]
|
||||||
new_subs.append((user_profile, recipient_id, stream))
|
|
||||||
|
|
||||||
subs_to_add: List[Tuple[Subscription, Stream]] = []
|
|
||||||
for (user_profile, recipient_id, stream) in new_subs:
|
|
||||||
if stream.name in color_map:
|
if stream.name in color_map:
|
||||||
color = color_map[stream.name]
|
color = color_map[stream.name]
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user