Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apiserver/plane/app/views/asset/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def patch(self, request, asset_id):
# update the attributes
asset.attributes = request.data.get("attributes", asset.attributes)
# save the asset
asset.save()
asset.save(created_by=request.user)
return Response(status=status.HTTP_204_NO_CONTENT)

def delete(self, request, asset_id):
Expand Down Expand Up @@ -459,7 +459,7 @@ def patch(self, request, slug, asset_id):
# update the attributes
asset.attributes = request.data.get("attributes", asset.attributes)
# save the asset
asset.save()
asset.save(created_by=request.user)
return Response(status=status.HTTP_204_NO_CONTENT)

def delete(self, request, slug, asset_id):
Expand Down Expand Up @@ -690,7 +690,7 @@ def patch(self, request, slug, project_id, pk):
# update the attributes
asset.attributes = request.data.get("attributes", asset.attributes)
# save the asset
asset.save()
asset.save(created_by=request.user)
return Response(status=status.HTTP_204_NO_CONTENT)

@allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/app/views/issue/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,5 @@ def patch(self, request, slug, project_id, issue_id, pk):
# Get the storage metadata
if not issue_attachment.storage_metadata:
get_asset_object_metadata.delay(str(issue_attachment.id))
issue_attachment.save()
issue_attachment.save(created_by=request.user)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix improper use of 'created_by' parameter in 'save' method

The save method does not accept a created_by parameter unless it is explicitly overridden in the FileAsset model. To set the created_by field, assign it directly before calling save().

Apply this diff to correct the code:

-            issue_attachment.save(created_by=request.user)
+            issue_attachment.created_by = request.user
+            issue_attachment.save()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
issue_attachment.save(created_by=request.user)
issue_attachment.created_by = request.user
issue_attachment.save()

return Response(status=status.HTTP_204_NO_CONTENT)
2 changes: 1 addition & 1 deletion apiserver/plane/space/views/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def patch(self, request, anchor, pk):
# update the attributes
asset.attributes = request.data.get("attributes", asset.attributes)
# save the asset
asset.save()
asset.save(created_by=request.user)
return Response(status=status.HTTP_204_NO_CONTENT)

def delete(self, request, anchor, pk):
Expand Down