immich
immich copied to clipboard
feat(web/server/mobile) Optionally move deleted items to a recycle bin
Implementing this as part of a suggested feature (Issue:833)
It will be nice to get feedback on this. Currently, I just hide the images by setting isVisible = false and timestamping when the asset got deleted. Would it be better to allow the admin to specify a location? Like a .recycleBin folder.
Also, I am not very good with UI, any suggestions on where we can place the Recycle bin on the Mobile App? Thanks
TODO
Web
- [x] Allow the admin to configure the Recycle Bin
- [x] Create a new Bin page
- [x] View all user-deleted assets if Admin has set up the Recycling Bin
- [x] Allow permanently deleting all assets in the Recycle Bin
- [x] Allow restoring and permanently deleting all selected assets
- [x] Create a new AssetViewer for deleted assets.
Server
- [x] Create a background task to permanently delete assets that have passed the Recycle Bin configured days
- [x] Create a new controller and service
- [x] Update asset Entity to add a timestamp for when the asset was deleted
- [x] Update DELETE request not to delete the image but instead hide the image if Recycle Bin has been enabled
- [x] Hide deleted Assets from the Photos page
- [x] Hide deleted assets from Albums
Mobile
- [ ] Create a Bin tab
- [ ] View all user-deleted assets if Admin has set up the Recycling Bin
- [ ] Allow permanently deleting all assets in the Recycle Bin
- [ ] Allow restoring and permanently deleting all selected assets
Web UI

The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated |
|---|---|---|---|---|
| immich-code-coverage | ❌ Failed (Inspect) | Jan 24, 2023 at 0:28AM (UTC) |
Someone is attempting to deploy a commit to the immich Team on Vercel.
A member of the Team first needs to authorize it.
Something might be worth taking into account is that we don't have a mechanism to detect what has been deleted from the web yet to not reupload it on the mobile side
Something might be worth taking into account is that we don't have a mechanism to detect what has been deleted from the web yet to not reupload it on the mobile side
I have done a quick test on Android. And you are right.
When deleting from the Web (without recycle bin) assets uploaded on mobile will get deleted until the app backs up the assets again. One potential solution could be when an asset gets deleted on the web to not remove the asset from the disk until the user interacts with the app or there's some kind of background task that will delete it from the mobile.
With the recycle bin the asset can remain on the user's phone for simplicity (just don't display it on the UI) and when they decide or it is deleted permanently that is when we can remove it from the disk and the user's mobile.
I will investigate that further and have a look at how Google photos tackle the issue.
The approach that Google take is to notify the user that a file has been deleted by someone else or on the web. And the user can then decide if they want to also remove it on their device or keep it but it will mean it will get reuploaded again when Photos does a backup.
That sounds like a good approach to give the user option if they want it to be removed from their phone. If it was truly accidental then don't remove it and it will get reuploaded automatically if you did mean to remove it then accept and it will be gone from your phone (with recycle bin it will remain on the server).
Another interesting thing. On Android 13 when you are deleting a photo from the app it prompts you if you want to move it to the recycling bin or not. If you choose Recycle Bin then the file remains on your device without a way to recover it besides using Google Photos. So, they are technically deleted even though they are not. I have also noticed on the app side when you say no don't move it to the bin, the asset remains on your device and is deleted on the server. I will create an issue to do nothing when the user chooses the "Deny" option.
Would you mind record and showing how Google Photos handle this? I don't have backup turned on, so when I tried to backup and delete a single photo, it doesn't notify me that the photo has been deleted on the web.
Thank you
Would you mind record and showing how Google Photos handle this? I don't have backup turned on, so when I tried to backup and delete a single photo, it doesn't notify me that the photo has been deleted on the web.
Thank you
I have described what happens here. https://github.com/Dilanwizzy/immich/blob/how-google-deletes-assets/HowGoogleDeletsImages.md
A suggestion on how to handle deletion will be to track how an asset was uploaded. If it was uploaded on the web and was deleted on the web or mobile then we delete the file from the server and remove the entry on the DB (what is currently happening). If it was uploaded on Mobile then mark the file as deleted on the DB and delete the file on the server. Then on mobile when we pull the asset data, we can check for deleted files and see if it is part of the upload paths. And if it is then notify the user with a similar pop-up as Google Photos. Delete from the device or do not remove.
Found another discovery on android, when immich deletes an asset it doesn't actually delete it but renames it as a .trash file. So, the asset is hidden. So, regarding bin functionality on android. All we need to do is search for .trash files in the folders the user has backed up. To permanently delete an asset we delete the .trash file. If Bin is enabled then we search for the .trash files and display those. If a file is deleted on the web we give the user the option to also "delete" it locally. One concern I have is that if the user has Google Photos also installed on their device, google photos will delete those files after 30 days without backup and 60 days with backup. So, let's say the admin sets the bin to 90 days and before 90 days those assets will be deleted from the user's device and remain on the server. When they decide to recover it, they will only be able to recover them from the server side and not locally due to Google Photos deleting the asset.
If anyone can have a look at IOS on how this is implemented then it would be great. In the meantime, I will continue working on implementing this on android. And implementation on android might take a while as I haven't used flutter before. Hopefully, not too long as I have experience with React Native
Stale, will implement this feature in the future