Skip to content

feat(web): Add to Multiple Albums #20072

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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

xCJPECKOVERx
Copy link
Collaborator

@xCJPECKOVERx xCJPECKOVERx commented Jul 22, 2025

Description

Added ability to select multiple albums from the AlbumPickerModal. Hovering over an album shows a checkbox (similar to Thumbnail), and once an album is 'multiSelected', clicking anywhere on an album checks and unchecks it. Finalize choice by clicking the submit button, or pressing Enter (pressing 'm' or long pressing on a selected album will also multi-select it.

Notifications when attempting to add to multiple albums are simplified, with no links to the albums. Instead, counts of how many assets were added to how many albums are displayed. ex. "1 asset added to 3 albums".

A new endpoint is added (PUT /albums/assets), with a new body dto and new return dto with the final counts. If any asset is successfully added to any album, the return is a success, with total counts adjusted to announce how many assets were added to albums.

How Has This Been Tested?

  • Select assets and add to multiple albums where it doesn't exist. Results in all successes
  • Select assets and add to multiple albums, one of which already contains assets. Returns in success, but with potentially modified counts.
  • Select assets and add to multiple albums, all of which contain all assets: Results in error, duplicate
  • Select assets and add to album with read-only access: Results in failure
  • Select assets and add to an album without assets, album with assets, and read-only album: results in success, with modified counts for notification.
  • Unit tests

Screenshots (if appropriate)

image image

API Changes

Added PUT /albums/assets

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

- update modal for multi select
- Update add-to-album and add-to-album-action to work with new array return from AlbumPickerModal
- Add asset-utils.addAssetsToAlbums (incomplete)
- add test
- make open-api
- handle notification
- clean up
- format & check
- fix assets_cannot_be_added language call
Copy link
Member

@danieldietzler danieldietzler 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 the PR!

@xCJPECKOVERx
Copy link
Collaborator Author

Appreciate the review! Adding some of your points to my own PR checklist lol. Aiming to have cleaner PRs 👍

@xCJPECKOVERx xCJPECKOVERx marked this pull request as draft July 25, 2025 03:21
@xCJPECKOVERx xCJPECKOVERx marked this pull request as ready for review July 30, 2025 04:53
Copy link
Member

@danieldietzler danieldietzler 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 starting to look pretty good. I still don't like the error handling/response stuff but I guess that's a bigger discussion to have.

@@ -511,6 +515,7 @@
"assets_trashed_count": "Trashed {count, plural, one {# asset} other {# assets}}",
"assets_trashed_from_server": "{count} asset(s) trashed from the Immich server",
"assets_were_part_of_album_count": "{count, plural, one {Asset was} other {Assets were}} already part of the album",
"assets_were_part_of_albums_count": "{count, plural, one {Asset was} other {Assets were}} already part of the albums",
Copy link
Member

Choose a reason for hiding this comment

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

Have you just... duplicated this key from the line above? 👀

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

album -> albums lol

Copy link
Member

Choose a reason for hiding this comment

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

Ah damn it I'm blind 😅

Comment on lines +210 to +212
} else if (results.error && res.error !== BulkIdErrorReason.DUPLICATE) {
results.error = BulkIdErrorReason.UNKNOWN;
}
Copy link
Member

Choose a reason for hiding this comment

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

Do you need to results.success = false here too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't believe so. results.success is initialized false, and if one album succeeds it should be permanently true.

Copy link
Member

Choose a reason for hiding this comment

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

Ah got it

@danieldietzler danieldietzler requested a review from jrasm91 August 9, 2025 16:17
Copy link
Contributor

📖 Documentation deployed to pr-20072.preview.immich.app

@xCJPECKOVERx
Copy link
Collaborator Author

I still don't like the error handling/response stuff but I guess that's a bigger discussion to have.

Are you leaning towards more verbose responses, or less? Whole thing could probably be cleaned up a bit if it was a simple pass/fail, with no extra error messages if any albums failed.
More verbose would logically be simple I think, but could potentially have huge responses, depending on the number of assets and albums you're trying to add to.

@danieldietzler
Copy link
Member

danieldietzler commented Aug 10, 2025

I'm leaning towards something much simpler, less verbose, but I'd be interested in Jason's take on this.

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