-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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): synchronise metadata and album membership between duplicate images #13851
Open
EinToni
wants to merge
2
commits into
immich-app:main
Choose a base branch
from
EinToni:deduplicate-sync-album
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+189
−19
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
web/src/lib/components/utilities-page/duplicates/duplicate-options.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script lang="ts"> | ||
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte'; | ||
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte'; | ||
import { t } from 'svelte-i18n'; | ||
|
||
interface Props { | ||
synchronizeAlbums: boolean; | ||
synchronizeArchives: boolean; | ||
synchronizeFavorites: boolean; | ||
onClose: () => void; | ||
onToggleSyncAlbum: () => void; | ||
onToggleSyncArchives: () => void; | ||
onToggleSyncFavorites: () => void; | ||
} | ||
let { | ||
synchronizeAlbums, | ||
synchronizeArchives, | ||
synchronizeFavorites, | ||
onClose, | ||
onToggleSyncAlbum, | ||
onToggleSyncArchives, | ||
onToggleSyncFavorites, | ||
}: Props = $props(); | ||
</script> | ||
|
||
<FullScreenModal title={$t('options')} width="auto" {onClose}> | ||
<div class="items-center justify-center"> | ||
<div class="grid p-2 gap-y-2"> | ||
<SettingSwitch | ||
title={$t('synchronize_albums')} | ||
subtitle={$t('synchronize_albums_description')} | ||
checked={synchronizeAlbums} | ||
onToggle={onToggleSyncAlbum} | ||
/> | ||
<SettingSwitch | ||
title={$t('synchronize_favorites')} | ||
subtitle={$t('synchronize_favorites_description')} | ||
checked={synchronizeFavorites} | ||
onToggle={onToggleSyncFavorites} | ||
/> | ||
<SettingSwitch | ||
title={$t('synchronize_archives')} | ||
subtitle={$t('synchronize_archives_description')} | ||
checked={synchronizeArchives} | ||
onToggle={onToggleSyncArchives} | ||
/> | ||
</div> | ||
</div> | ||
</FullScreenModal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleDeduplicateAll isn't updated to respect the new settings. Ideally, both bulk and individual resolutions should behave the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
locally hacked up a version that does this. Definitely unpolished and imperfect, but sharing here in case there's anything useful.
I'm not really convinced that 'fetch all the album memberships up front' is the most efficient approach vs requesting per photo. Probably depends on the number of dupes vs overall album size. Might make sense when there are tons of dupes, but otherwise not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, this should just be handled in the backend. All these queries and set operations can be handled much more efficiently with a single specialized DB query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if we automatically sync album membership while deduplicating single images, it should also be done when deduplicating all. Otherwise this would be quite unexpected behavior for the end user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not saying we shouldn't handle syncing when deduplicating all assets, just that the client is not a great place to be doing this. The DB is much better at doing these operations than JS, can do it without moving all of this data back and forth, and can make the entire process atomic. The bulk dedupe arguably should have been a server endpoint from the start, but with this extra layer of functionality it's just too much to keep in the client.