Skip to content

Commit

Permalink
Remove activity feed for private projects
Browse files Browse the repository at this point in the history
  • Loading branch information
LanternNassi committed Jul 22, 2024
1 parent e8fb586 commit 0372768
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions app/controllers/activity_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ def get(self):
if not user_activities:
return dict(user_feed=user_feed), 200
for item in user_activities:

project_is_public = True

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]
project_is_public = project.is_public

if (project.is_public):
project_data, _ = project_schema.dump(project)
item['project'] = project_schema.dump(project_data)[0]

tags_list = item.get('a_tag_ids', [])
if tags_list and len(tags_list) > 0:
tags = []
Expand All @@ -71,14 +79,18 @@ def get(self):
tag_data, _ = tag_schema.dump(tag)
tags.append(tag_data)
item['tags'] = tags

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]
if project_is_public:
app = App.get_by_id(item['a_app_id'])
app_data, _ = app_schema.dump(app)
item['app'] = app_schema.dump(app_data)[0]

if item['model'] == 'User' and item['a_user_id'] != None:
user = User.get_by_id(item['a_user_id'])
user_data, _ = user_schema.dump(user)
item['a_user'] = user_schema.dump(user_data)[0]

elif item['model'] == 'Database':
pass
user_feed['data']['activity'] = user_activities
Expand Down

0 comments on commit 0372768

Please sign in to comment.