1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-10 23:22:22 +02:00

feat(web): manually link live photos (#12514)

feat(web,server): manually link live photos
This commit is contained in:
Jason Rasmussen
2024-09-10 08:51:11 -04:00
committed by GitHub
parent 12bfb19852
commit 27050af57b
16 changed files with 178 additions and 36 deletions

View File

@@ -545,6 +545,38 @@ describe('/asset', () => {
expect(status).toEqual(200);
});
it('should not allow linking two photos', async () => {
const { status, body } = await request(app)
.put(`/assets/${user1Assets[0].id}`)
.set('Authorization', `Bearer ${user1.accessToken}`)
.send({ livePhotoVideoId: user1Assets[1].id });
expect(body).toEqual(errorDto.badRequest('Live photo video must be a video'));
expect(status).toEqual(400);
});
it('should not allow linking a video owned by another user', async () => {
const asset = await utils.createAsset(user2.accessToken, { assetData: { filename: 'example.mp4' } });
const { status, body } = await request(app)
.put(`/assets/${user1Assets[0].id}`)
.set('Authorization', `Bearer ${user1.accessToken}`)
.send({ livePhotoVideoId: asset.id });
expect(body).toEqual(errorDto.badRequest('Live photo video does not belong to the user'));
expect(status).toEqual(400);
});
it('should link a motion photo', async () => {
const asset = await utils.createAsset(user1.accessToken, { assetData: { filename: 'example.mp4' } });
const { status, body } = await request(app)
.put(`/assets/${user1Assets[0].id}`)
.set('Authorization', `Bearer ${user1.accessToken}`)
.send({ livePhotoVideoId: asset.id });
expect(status).toEqual(200);
expect(body).toMatchObject({ id: user1Assets[0].id, livePhotoVideoId: asset.id });
});
it('should update date time original when sidecar file contains DateTimeOriginal', async () => {
const sidecarData = `<?xpacket begin='?' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.40'>