Skip to content

Commit

Permalink
fix(api) dont return products and subscribers in the api response (#1138
Browse files Browse the repository at this point in the history
)
  • Loading branch information
marwoodandrew authored Jun 21, 2021
1 parent fa18d39 commit 06a2c55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion features/news_api_item.feature
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ Feature: News API Item
"body_html": "<p>test&nbsp;test</p>",
"associations": {
"featuremedia": {
"products": ["12345", "6789"],
"subscribers": ["12345", "6789"],
"renditions": {
"16-9": {
"href": "/assets/1234567"
"href": "/assets/1234567",
"media": "/12345/6789.jpg"
},
"_newsroom_thumbnail": {
"href": "/assets/987654"
Expand Down
6 changes: 6 additions & 0 deletions newsroom/news_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ def remove_internal_renditions(item):
for key, rendition in\
item['associations']['featuremedia']['renditions'].items():
if not key.startswith('_newsroom'):
rendition.pop('media', None)
clean_renditions[key] = rendition

item['associations']['featuremedia']['renditions'] = clean_renditions
for key, meta in item.get('associations', {}).items():
if isinstance(meta, dict):
meta.pop('products', None)
meta.pop('subscribers', None)

return item

0 comments on commit 06a2c55

Please sign in to comment.