mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
Return a dictionary in subscriptions/list instead of a tuple.
This will give us flexibility in the future to add new properties to the list. In order to support that, we now do a list comprehension rather than just returning the gather_subscriptions list in get_stream_colors. (imported from commit a3c0f749a3320f647440f800105942434da08111)
This commit is contained in:
@@ -373,9 +373,10 @@ def gather_subscriptions(user_profile):
|
||||
with_color = StreamColor.objects.filter(subscription__in = subs).select_related()
|
||||
no_color = subs.exclude(id__in = with_color.values('subscription_id')).select_related()
|
||||
|
||||
result = [(get_display_recipient(sc.subscription.recipient), sc.color)
|
||||
for sc in with_color]
|
||||
result.extend((get_display_recipient(sub.recipient), StreamColor.DEFAULT_STREAM_COLOR)
|
||||
for sub in no_color)
|
||||
result = [{'name': get_display_recipient(sc.subscription.recipient),
|
||||
'color': sc.color} for sc in with_color]
|
||||
result.extend({'name': get_display_recipient(sub.recipient),
|
||||
'color': StreamColor.DEFAULT_STREAM_COLOR} for sub in no_color)
|
||||
|
||||
|
||||
return sorted(result)
|
||||
|
||||
Reference in New Issue
Block a user