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

feat(web): Add stacking option to deduplication utilities #11114

Merged
merged 27 commits into from
Aug 6, 2024

Conversation

i-am-a-teapot
Copy link
Contributor

Since stacked photos exist in immich and de-duplication only allows for deletion, I figured it would be nice to have the option to stack the pictures instead of deleting them.

I created a basic version of this functionality in this pull request.
It (partially) addresses #2479

Interface:
Mon Jul 15 06:07:00 PM CEST 2024

Let me know if I need to modify something, i did not fix the internationalization error in the tests, otherwise everything passed I think.

@alextran1502
Copy link
Contributor

Thank you for working on this! I will take a look shortly

Copy link
Contributor

@mertalev mertalev left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! I'm sure a lot of people will love this feature.

How do you feel about the "select keep all" / "select trash all" buttons? I think they feel weird now since keeping and trashing aren't the only actions. IMO it'd be best to just fold them into one button that says "select all" if not all assets are selected, and "unselect all" if all of them are.

@i-am-a-teapot i-am-a-teapot marked this pull request as draft July 18, 2024 13:02
@i-am-a-teapot
Copy link
Contributor Author

I created some new endpoints in the server to handle the one request stackAll operation. I hope I captured all the functionality of the old updateAll method. I am not certain if the two DTO's are necessary but it seems to work for now.
If you agree on the general structure, I think writing some tests would be necessary to ensure it works as it should.

I did not look into the app development yet, but the stack functionality will also need to change there.

@i-am-a-teapot i-am-a-teapot marked this pull request as ready for review July 19, 2024 06:22
@alextran1502
Copy link
Contributor

Sorry for the back-and-forth on this PR. We are refactoring the stack mechanism, so I would avoid changing the code on the server for stacking. Would it be possible to use the current stack endpoint and mechanism for this purpose?

@i-am-a-teapot
Copy link
Contributor Author

It would be possible, but we would need to live with multiple requests for stacking all duplicates.
(Pretty much like in the first commit)

@mertalev
Copy link
Contributor

mertalev commented Jul 28, 2024

That would be unfortunate. If we did it one-by-one, the user has 50k duplicate groups, and handling each group takes 20ms, it would take over 16 minutes to get through all of them. The user has to wait on that page that long and not assume that clicking the button was enough, or that something went wrong and they need to refresh. I'd almost rather not have the Stack All button in that case. You could do requests in parallel to mitigate this, but it would still be very slow regardless.

@alextran1502
Copy link
Contributor

Yeah, no stack all button is fine

@i-am-a-teapot i-am-a-teapot marked this pull request as draft July 29, 2024 15:07
@i-am-a-teapot i-am-a-teapot marked this pull request as ready for review July 29, 2024 17:22
@i-am-a-teapot
Copy link
Contributor Author

I updated it to the best of my knowledge, it is a bit sad that the stack all button is not possible yet, but I understand.
Let me know if you still need changes.

@@ -324,13 +324,17 @@ export const getSelectedAssets = (assets: Set<AssetResponseDto>, user: UserRespo
return ids;
};

export const stackAssets = async (assets: AssetResponseDto[]) => {
export const stackAssets = async (assets: AssetResponseDto[], parent?: AssetResponseDto, showGoToButton?: boolean) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to change the logic of this method?

@@ -361,17 +365,19 @@ export const stackAssets = async (assets: AssetResponseDto[]) => {
parent.stack ??= [];
parent.stack = parent.stack.concat(children, grandChildren);
parent.stackCount = parent.stack.length + 1;

notificationController.show({
const notificationObject = {
Copy link
Contributor

Choose a reason for hiding this comment

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

What are we trying to achieve here? The button property is also not a public property AFAIK

@@ -141,6 +162,36 @@
$t('confirm'),
);
};

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to keep this commented code here

@@ -157,6 +208,16 @@
{$t('keep_all')}
</div>
</LinkButton>
<!--
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to keep this commented code here

Copy link
Contributor

@alextran1502 alextran1502 left a comment

Choose a reason for hiding this comment

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

Thank you for your work, I add some comments on a few things

@alextran1502 alextran1502 enabled auto-merge (squash) August 6, 2024 17:00
@alextran1502 alextran1502 merged commit 65f5118 into immich-app:main Aug 6, 2024
22 checks passed
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.

4 participants