Skip to content

Commit

Permalink
oly show following if user_id is not supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
Mubangizi committed Jul 1, 2024
1 parent adc21fe commit d9db2f8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/controllers/activity_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get(self):
params['user_id'] = user_id

following = current_user.followed
if following:
if following and not user_id:
params['user_ids'] = [user.id for user in following]

LOGGER_APP_URL = current_app.config.get('LOGGER_APP_URL')
Expand All @@ -48,17 +48,15 @@ def get(self):
# get project or app details in each item in the feed and return them
user_feed = user_feed.json()
user_activities = user_feed.get('data').get('activity')
print(user_feed)
print(dir(user_feed))

if not user_activities:
return dict(user_feed=user_feed), 200

for item in user_activities:
if item['model'] == 'Project':
if item['model'] == 'Project' or item['model'] == 'App' or item['model'] == 'Database':
project = Project.get_by_id(item['a_project_id'])
project_data, _ = project_schema.dump(project)
item['project'] = project_schema.dump(project_data)[0]
elif item['model'] == 'App':
if item['model'] == 'App':
app = App.get_by_id(item['a_app_id'])
app_data, _ = app_schema.dump(app)
item['app'] = app_schema.dump(app_data)[0]
Expand Down

0 comments on commit d9db2f8

Please sign in to comment.