Skip to content

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.

@snipe
Copy link
Member

snipe commented Jun 3, 2025

I think the history formatting stuff would likely be handled via this WIP #16769

@snipe
Copy link
Member

snipe commented Sep 2, 2025

Really nice work here @Godmartinz - a lot of it doesn't apply anymore since the new file uploads controller (since those FooFilesControllers don't exist anymore), but I'm nicking part of it for a new PR that does the same thing in the new way. Sorry, and thank you! :D

@Godmartinz
Copy link
Member Author

all good, also I didnt realize I had changes to apply 😬 🤦

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

Successfully merging this pull request may close these issues.

3 participants