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(server): link motion photo with existing video asset #8724

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

Ynng
Copy link
Contributor

@Ynng Ynng commented Apr 11, 2024

Closes #8508, closes #8503.
Originally part of #8512.

Links existing video asset with motion photo if their checksum matches.

Should NOT be merged until #8719 is merged to prevent cross library linking.

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.

Your PRs are really good, thank you! :)

@@ -439,7 +439,7 @@ describe(MetadataService.name, () => {
});
cryptoRepository.hashSha1.mockReturnValue(randomBytes(512));
assetMock.getByChecksum.mockResolvedValue(null);
assetMock.create.mockResolvedValue(assetStub.livePhotoMotionAsset);
assetMock.create.mockImplementation((asset) => Promise.resolve({ ...assetStub.livePhotoMotionAsset, ...asset }));
Copy link
Member

Choose a reason for hiding this comment

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

AFAICT the create function is only called once, correct? Why can't we use mockResolvedValue then, given that we already know which asset we pass in.


if (asset.livePhotoVideoId !== motionAsset.id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this whole method run even when an asset is already linked?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, nevermind. This is for the case we had awhile ago with corrupt extraction.

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

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

LGTM

@jrasm91 jrasm91 merged commit 5834646 into immich-app:main Apr 11, 2024
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants