mirror of https://github.com/zulip/zulip.git
Return in_home_view in gather_subscriptions.
This enables us to do client-side filtering on messages by the value of this setting. (imported from commit e69a7772dc90c67cb91ea8f630f5b78c902e8fa8)
This commit is contained in:
parent
e8afaa8b8e
commit
ac0dbd0864
|
@ -374,8 +374,10 @@ def gather_subscriptions(user_profile):
|
|||
no_color = subs.exclude(id__in = with_color.values('subscription_id')).select_related()
|
||||
|
||||
result = [{'name': get_display_recipient(sc.subscription.recipient),
|
||||
'in_home_view': sc.subscription.in_home_view,
|
||||
'color': sc.color} for sc in with_color]
|
||||
result.extend({'name': get_display_recipient(sub.recipient),
|
||||
'in_home_view': sub.in_home_view,
|
||||
'color': StreamColor.DEFAULT_STREAM_COLOR} for sub in no_color)
|
||||
|
||||
|
||||
|
|
|
@ -508,8 +508,8 @@ class SubscriptionPropertiesTest(AuthedTestCase):
|
|||
for stream, color in json["stream_colors"]:
|
||||
self.assertIsInstance(color, str)
|
||||
self.assertIsInstance(stream, str)
|
||||
self.assertIn({'name': stream, 'color': color}, subs)
|
||||
subs.remove({'name': stream, 'color': color})
|
||||
self.assertIn({'name': stream, 'in_home_view': True, 'color': color}, subs)
|
||||
subs.remove({'name': stream, 'in_home_view': True, 'color': color})
|
||||
self.assertFalse(subs)
|
||||
|
||||
def test_set_stream_color(self):
|
||||
|
@ -533,10 +533,10 @@ class SubscriptionPropertiesTest(AuthedTestCase):
|
|||
self.assert_json_success(result)
|
||||
|
||||
new_subs = gather_subscriptions(self.get_user_profile(test_email))
|
||||
self.assertIn({'name': stream_name, 'color': new_color}, new_subs)
|
||||
self.assertIn({'name': stream_name, 'in_home_view': True, 'color': new_color}, new_subs)
|
||||
|
||||
old_subs.remove({'name': stream_name, 'color': old_color})
|
||||
new_subs.remove({'name': stream_name, 'color': new_color})
|
||||
old_subs.remove({'name': stream_name, 'in_home_view': True, 'color': old_color})
|
||||
new_subs.remove({'name': stream_name, 'in_home_view': True, 'color': new_color})
|
||||
self.assertEqual(old_subs, new_subs)
|
||||
|
||||
def test_set_color_missing_stream_name(self):
|
||||
|
|
Loading…
Reference in New Issue