Skip to content
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

fix: prevent trashing of trashed assets #10028

Merged

Conversation

roschaefer
Copy link
Contributor

@roschaefer roschaefer commented Jun 7, 2024

Motivation

This will improve user experience by hiding a pointless action by changing "move to trash" into "delete permanently" if the asset is already in the trash.

You can not trash a trashed asset again. It won't get any trashier than it already is.

How to test

  1. Visit route /trash
  2. Click on an asset
  3. Press "Delete" on your keyboard
  4. You will see the confirmation dialog to permanently delete the asset
  5. Click on the trash button in the top right
  6. Same as 4)

];

if (!asset.isTrashed) {
shortcutOptions.push({ shortcut: { key: 'Delete' }, onShortcut: () => trashOrDelete(false) });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is not tested. I could - but I would refactor the callbacks to live outside the component, for easier testing. Shall I?

@roschaefer roschaefer force-pushed the fix-prevent-obsolete-trash-action branch 2 times, most recently from dbb9694 to 0d8daa4 Compare June 7, 2024 19:30
@roschaefer
Copy link
Contributor Author

So how can I add PR labels as a contributor?

Motivation
----------
This will improve user experience by hiding a pointless action.

You can not trash a trashed asset again. It won't get any trashier than it already is.

How to test
-----------
1. Visit route `/trash`
2. Click on an asset
3. Press "Delete" on your keyboard
4. Nothing happens
5. Try to find the trash button in the top right
6. You can't find it
@roschaefer
Copy link
Contributor Author

@michelheusschen thanks for the review. I hope I could address all the requested changes?

@roschaefer roschaefer force-pushed the fix-prevent-obsolete-trash-action branch from 0d8daa4 to c9654cd Compare June 8, 2024 14:37
roschaefer added a commit to roschaefer/immich that referenced this pull request Jun 8, 2024
Motivation
----------
While working on immich-app#10028 I would see the following:

```
$ git status
On branch gitignore-docker-postgres-volume
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	docker/postgres/

nothing added to commit but untracked files present (use "git add" to track)
```

Why was the postgres bound volume not git-ignored?

Another question: Should we use one `.gitignore` in the root directory or many `.gitignore` files in each project subdirectory? I'm asking because I can see a `.gitignore` in `docker/` which ignores `.env`. I would prefer dedicated `.gitignore` files per project directory.

How to test
-----------
1. `cd docker/`
2. `docker compose -f docker-compose.dev.yml up`
3. Wait..
4. `git status`
5. nothing to commit, working tree clean
roschaefer added a commit to roschaefer/immich that referenced this pull request Jun 8, 2024
Motivation
----------
It's a follow up to immich-app#10028. I think it would be better user experience if one can tell by the icon what the delete button is about to do.

I hope I caught all the occurences where one can permanently delete assets.

How to test
-----------
1. Visit e.g. `/trash`
2. If you select some assets, the delete button in the top right corner
   looks different.
@alextran1502 alextran1502 merged commit d8d64ec into immich-app:main Jun 8, 2024
24 checks passed
roschaefer added a commit to roschaefer/immich that referenced this pull request Jun 9, 2024
Motivation
----------
It's a follow up to immich-app#10028. I think it would be better user experience if one can tell by the icon what the delete button is about to do.

I hope I caught all the occurences where one can permanently delete assets.

How to test
-----------
1. Visit e.g. `/trash`
2. If you select some assets, the delete button in the top right corner
   looks different.
alextran1502 pushed a commit that referenced this pull request Jun 9, 2024
Motivation
----------
It's a follow up to #10028. I think it would be better user experience if one can tell by the icon what the delete button is about to do.

I hope I caught all the occurences where one can permanently delete assets.

How to test
-----------
1. Visit e.g. `/trash`
2. If you select some assets, the delete button in the top right corner
   looks different.
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.

None yet

3 participants