Skip to content

Adds file upload deletion logging #16599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

Godmartinz
Copy link
Member

@Godmartinz Godmartinz commented Mar 31, 2025

This adds logging for deletion of uploads across assets, accessories, licenses, consumables and components.
While components history is not currently surfaced, changes are reflected in the action_logs table.
[sc-28213]
Deletions have a trash icon:
image

This updates the uploads() relationships on all models mentioned above to exclude all filenames that have been deleted so the File Uploads tabs correctly reflect what is actually still being stored.

Copy link

what-the-diff bot commented Mar 31, 2025

PR Summary

  • Improved File Deletion Handling: The system for deleting files has been upgraded across various controllers. Instead of directly removing files, the application now goes through an extra process called logUploadDelete($log->filename). This change ensures that we keep a record of the files that we delete, adding more transparency and potentially making it easier to recover any mistakenly deleted files.

  • Established logUploadDelete Method: A fresh functionality called logUploadDelete($filename) has been put in place. Whenever a file is removed, this new method creates a record to document the action. This feature introduces a way for us to track and validate which files have been removed and when.

  • Refined Query Logic for File Uploads: The way the system retrieves the list of uploaded files has been enhanced across multiple assets. In its latest form, the query process filters out any files marked as deleted and refrains from showing them in the uploads list. This ensures we maintain an accurate list of currently available files.

  • Visual Cue for Deleted Files: The upload history now displays a trash icon next to the files that have been deleted. This serves as additional evidence of these deletions and makes it easier to identify them at a glance.

  • Language Consistency for Deleted File Actions: To ensure our messaging about file deletions is consistent, a new translation string for 'upload deleted' has been added. This ensures that all related actions will be uniformly labelled, no matter their location or context, providing a coherent user experience.

Copy link
Collaborator

@marcusmoore marcusmoore left a comment

Choose a reason for hiding this comment

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

This is mostly solid but there are a couple inconsistencies we should fix up before merging.

  1. Consumables don't show the filename like other histories do
  2. Deleting a file update for a component hides uploaded action from the history view

image

  1. you can still download a "deleted" file from a license history. It's not actually being removed.

image

This doesn't occur for the other first class items
image

Some of this might not be caused by this PR but we should probably make them uniform.


Also, should we include users in this? I think it's in the same boat as components where the file history isn't surfaced but can be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants