Skip to content

fix(server): do not list album activity for assets that are not in the album anymore #18927

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

Closed
wants to merge 7 commits into from

Conversation

dahool
Copy link
Collaborator

@dahool dahool commented Jun 4, 2025

Description

This is a minor fix to prevent listing album activity from assets that are not available anymore.

Fixes #17475

How Has This Been Tested?

See #17475

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/)

@dahool dahool marked this pull request as draft June 4, 2025 20:01
@dahool dahool marked this pull request as ready for review June 4, 2025 20:24
@danieldietzler danieldietzler changed the title fix(server): do not list album activity for assets thare are not in the album anymore fix(server): do not list album activity for assets that are not in the album anymore Jun 5, 2025
mertalev
mertalev previously approved these changes Jun 6, 2025
@mertalev
Copy link
Member

mertalev commented Jun 6, 2025

Actually, I wonder if this could instead be handled with DDL with something like FOREIGN KEY ("albumId", "assetId") REFERENCES albums_assets_assets ON DELETE CASCADE. My understanding is that assetId would be allowed to be null, but if both are non-null then the constraint would kick in.

@mertalev mertalev dismissed their stale review June 6, 2025 17:49

Possibly better handled with DDL

@dahool
Copy link
Collaborator Author

dahool commented Jun 6, 2025

well it depends, how the functionallity is supposed to work. I see 2 possibilities

  • op 1: the activity is cleared when the assets is removed from the album (yes, this could be resolved with a simple constraint)
  • op 2 (this): we recover the activity history if the asset is restored to the album.

@dahool
Copy link
Collaborator Author

dahool commented Jun 6, 2025

option 1: d6626fa

@mertalev
Copy link
Member

mertalev commented Jun 6, 2025

I think it makes sense for the activity to be reset when you remove the asset. You should update the table definition under src/schema/tables as well.

@dahool
Copy link
Collaborator Author

dahool commented Jun 6, 2025

I think it makes sense for the activity to be reset when you remove the asset. You should update the table definition under src/schema/tables as well.

I'm not exactly sure what you guys are using here, I thought at first it was typeorm, but looks like some custom lib

@mertalev
Copy link
Member

mertalev commented Jun 6, 2025

I think it makes sense for the activity to be reset when you remove the asset. You should update the table definition under src/schema/tables as well.

I'm not exactly sure what you guys are using here, I thought at first it was typeorm, but looks like some custom lib

Yes, it's an internal library to have TypeORM-like table definitions while using Kysely.

@alextran1502
Copy link
Member

Hello, can you help add e2e or a medium test for this?

@dahool
Copy link
Collaborator Author

dahool commented Jun 17, 2025

Hello, can you help add e2e or a medium test for this?

are we going to use this patch or the one in #19019 ?

@alextran1502
Copy link
Member

Ah sorry, probably the other one is preferred

@dahool
Copy link
Collaborator Author

dahool commented Jun 17, 2025

closing this PR as it has been superseded by #19019

@dahool dahool closed this Jun 17, 2025
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.

Removing a photo from an album leads to broken thumbnail and broken links for others
4 participants