Skip to content

Commit

Permalink
set cover image postits to expire after 24 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
shayanaijaz committed Feb 21, 2025
1 parent efff723 commit cd736f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/portal/apps/projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ def get(self, request, project_id=None, system_id=None):
else:
root_system = settings.PORTAL_PROJECTS_ROOT_SYSTEM_NAME

postit = service_client.files.createPostIt(systemId=root_system, path=prj['cover_image'], allowedUses=-1)
postit = service_client.files.createPostIt(systemId=root_system, path=prj['cover_image'], allowedUses=-1,
validSeconds=86400)
prj["cover_image_url"] = postit.redeemUrl

if not getattr(prj, 'is_review_project', False) and not getattr(prj, 'is_published_project', False):
Expand Down Expand Up @@ -299,7 +300,8 @@ def patch(
# Get the postit for the cover image
postit = service_client.files.createPostIt(systemId=settings.PORTAL_PROJECTS_ROOT_SYSTEM_NAME,
path=f'media/{project_id}/cover_image/{cover_image.name}',
allowedUses=-1)
allowedUses=-1,
validSeconds=86400)
workspace_def["cover_image_url"] = postit.redeemUrl

return JsonResponse(
Expand Down

0 comments on commit cd736f0

Please sign in to comment.