Merge pull request #286 from trecoool/feat/motion-photos

This commit is contained in:
Alan Grainger
2026-09-17 21:34:22 +12:00
17 changed files with 384 additions and 23 deletions
+16 -1
View File
@@ -39,6 +39,8 @@ const sharedLinkResponse = (order?: string) => ({
}
})
const MOTION_CLIP_ID = 'dddddddd-dddd-dddd-dddd-dddddddddddd'
const bucketsResponse = [{ timeBucket: '2026-06-01', count: 3 }]
// Columnar (struct-of-arrays). Index 1 is trashed and must be filtered out.
@@ -53,7 +55,9 @@ const bucketResponse = {
thumbhash: ['hashA', null, 'hashC'],
isTrashed: [false, true, false],
fileCreatedAt: ['2026-06-03T00:00:00.000Z', '2026-06-02T00:00:00.000Z', '2026-06-01T00:00:00.000Z'],
localOffsetHours: [5.5, -8, 0]
localOffsetHours: [5.5, -8, 0],
// Index 0 is a motion photo; the others are ordinary assets.
livePhotoVideoId: [MOTION_CLIP_ID, null, null]
}
function routeFetch (sharedLink: unknown) {
@@ -117,6 +121,17 @@ describe('album timeline enumeration (Immich 3.0)', () => {
expect(utcBucketKey('')).toBe('')
})
it('carries the motion photo clip id through from the bucket', async () => {
// Album shares get livePhotoVideoId for free from the timeline response,
// so motion photos cost no extra upstream requests here.
vi.stubGlobal('fetch', routeFetch(sharedLinkResponse()))
const result = await getShareByKey(uniqueKey(), undefined, KeyType.key)
const assets = result.link!.assets
expect(assets[0].livePhotoVideoId).toBe(MOTION_CLIP_ID)
// null in the columnar response becomes undefined, as with thumbhash
expect(assets[1].livePhotoVideoId).toBeUndefined()
})
it('synthesises localDateTime from fileCreatedAt + localOffsetHours', async () => {
vi.stubGlobal('fetch', routeFetch(sharedLinkResponse()))
const result = await getShareByKey(uniqueKey(), undefined, KeyType.key)