mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
populate_db: Fix stream colors being generated wrong.
Previously, the stream colors index i was accidentally a function only of the user, so each user got the same color for all their streams. This should provide a lot nicer-looking development environment experience.
This commit is contained in:
parent
4c8a69e3fb
commit
8a64d8ef06
@ -257,29 +257,30 @@ class Command(BaseCommand):
|
||||
'polonius@zulip.com': ['Verona'],
|
||||
}
|
||||
|
||||
for i, profile in enumerate(profiles):
|
||||
for profile in profiles:
|
||||
if profile.email not in subscriptions_map:
|
||||
raise Exception('Subscriptions not listed for user %s' % (profile.email,))
|
||||
|
||||
for stream_name in subscriptions_map[profile.email]:
|
||||
stream = Stream.objects.get(name=stream_name)
|
||||
r = Recipient.objects.get(type=Recipient.STREAM, type_id=stream.id)
|
||||
color = STREAM_ASSIGNMENT_COLORS[i % len(STREAM_ASSIGNMENT_COLORS)]
|
||||
subscriptions_list.append((profile, r, color))
|
||||
subscriptions_list.append((profile, r))
|
||||
else:
|
||||
for i, profile in enumerate(profiles):
|
||||
# Subscribe to some streams.
|
||||
for type_id in recipient_streams[:int(len(recipient_streams) *
|
||||
float(i)/len(profiles)) + 1]:
|
||||
r = Recipient.objects.get(type=Recipient.STREAM, type_id=type_id)
|
||||
color = STREAM_ASSIGNMENT_COLORS[i % len(STREAM_ASSIGNMENT_COLORS)]
|
||||
subscriptions_list.append((profile, r, color))
|
||||
subscriptions_list.append((profile, r))
|
||||
|
||||
subscriptions_to_add = [] # type: List[Subscription]
|
||||
event_time = timezone_now()
|
||||
all_subscription_logs = [] # type: (List[RealmAuditLog])
|
||||
|
||||
for profile, recipient, color in subscriptions_list:
|
||||
i = 0
|
||||
for profile, recipient in subscriptions_list:
|
||||
i += 1
|
||||
color = STREAM_ASSIGNMENT_COLORS[i % len(STREAM_ASSIGNMENT_COLORS)]
|
||||
s = Subscription(
|
||||
recipient=recipient,
|
||||
user_profile=profile,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user