From f2207bc4d4d748505c4f231fc6e90cce09ce4e78 Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Thu, 4 Oct 2018 12:30:05 +0200 Subject: [PATCH] Asset list item: Don't show user.full_name in latest and random assets --- cloud/routes.py | 8 ++------ tests/test_routes.py | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cloud/routes.py b/cloud/routes.py index f86ce9a..da64c5d 100644 --- a/cloud/routes.py +++ b/cloud/routes.py @@ -278,11 +278,6 @@ def get_random_featured_nodes() -> typing.List[dict]: 'foreignField': '_id', 'as': 'node'}}, {'$unwind': {'path': '$node'}}, - {'$lookup': {"from": "users", - "localField": "node.user", - "foreignField": "_id", - "as": "node.user"}}, - {'$unwind': {'path': "$node.user"}}, {'$match': {'node._deleted': {'$ne': True}}}, {'$project': {'url': True, 'name': True, @@ -296,7 +291,8 @@ def get_random_featured_nodes() -> typing.List[dict]: 'node.properties.duration_seconds': True, 'node.properties.url': True, 'node._created': True, - 'node.user.full_name': True,}}, + } + }, ]) featured_node_documents = [] diff --git a/tests/test_routes.py b/tests/test_routes.py index 5ef86fa..417f62b 100644 --- a/tests/test_routes.py +++ b/tests/test_routes.py @@ -166,4 +166,5 @@ class RandomFeaturedNodeTest(AbstractCloudTest): self.assertTrue(asset.properties.content_type == 'video') self.assertEquals(self.fake_now, asset['_created']) self.assertEquals(str(node_id), asset['_id']) - self.assertEquals(75, asset['properties']['duration_seconds']) \ No newline at end of file + self.assertEquals(75, asset['properties']['duration_seconds']) + self.assertNotIn('user', asset)