Merge fix/watched-overlay-metadata-load
@@ -192,7 +192,8 @@
192
192
- loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.
193
193
- isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.
194
194
- makeFileItem(item) - Builds a .file-item element; roots in Home now use folder-like interaction (single-click focus, double-click open), roots are non-draggable, and mobile long-press contextmenu suppression remains.
195
- makeFileItem(item) - Adds per-video watched overlays in the tile icon centre for the current user (`fully` filled eye, `partway` outlined eye).
195
- makeFileItem(item) - Renders tile icons first, then applies any cached watched overlay state (`fully` filled eye, `partway` outlined eye).
196
- loadWatchedStatusesForCurrentDir() - Fetches /files/meta for video files in the current directory, derives the logged-in user's watched state, caches it per path, and updates tile overlays after metadata arrives.
196
197
- attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.
197
198
- beginSidebarLoad() - Aborts in-flight sidebar requests and increments a load token so stale async responses cannot mutate the current sidebar state.
198
199
- openSidebar(item) - Renders item details/actions in sidebar; roots show alias + original name + usage stats, hide Move To/Delete, keep Rename.
@@ -250,7 +251,7 @@
250
251
- video preview does not save caption style settings per user on close - Verifies caption style changes are not persisted to per-user video preferences.
251
252
- video preview releases the backend stream session when closed - Verifies closing a streamed video preview sends an explicit backend release call.
252
253
- rapid file reselection does not duplicate sidebar action buttons after delayed metadata - Verifies stale sidebar loads are ignored so action buttons are not duplicated.
253
- video tiles show centred watched overlays for fully and partway statuses - Verifies watched-status overlays render as filled/outlined eye icons.
254
- video tiles show centred watched overlays after watched metadata is loaded - Verifies overlays remain absent until watched metadata is fetched, then render as filled/outlined eye icons.
254
255
255
256
## tests/video-stream.test.js
256
257
- createVideoStreamSession resolves once ffmpeg starts writing stream assets - Verifies session creation no longer waits for the final master playlist before preview can begin.
@@ -192,7 +192,8 @@192
- loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.
192
- loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.
193
- isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.
193
- isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.
194
- makeFileItem(item) - Builds a .file-item element; roots in Home now use folder-like interaction (single-click focus, double-click open), roots are non-draggable, and mobile long-press contextmenu suppression remains.
194
- makeFileItem(item) - Builds a .file-item element; roots in Home now use folder-like interaction (single-click focus, double-click open), roots are non-draggable, and mobile long-press contextmenu suppression remains.
195
- makeFileItem(item) - Adds per-video watched overlays in the tile icon centre for the current user (`fully` filled eye, `partway` outlined eye).
195
- makeFileItem(item) - Renders tile icons first, then applies any cached watched overlay state (`fully` filled eye, `partway` outlined eye).
196
- loadWatchedStatusesForCurrentDir() - Fetches /files/meta for video files in the current directory, derives the logged-in user's watched state, caches it per path, and updates tile overlays after metadata arrives.
196
- attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.
197
- attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.
197
- beginSidebarLoad() - Aborts in-flight sidebar requests and increments a load token so stale async responses cannot mutate the current sidebar state.
198
- beginSidebarLoad() - Aborts in-flight sidebar requests and increments a load token so stale async responses cannot mutate the current sidebar state.
198
- openSidebar(item) - Renders item details/actions in sidebar; roots show alias + original name + usage stats, hide Move To/Delete, keep Rename.
199
- openSidebar(item) - Renders item details/actions in sidebar; roots show alias + original name + usage stats, hide Move To/Delete, keep Rename.
@@ -250,7 +251,7 @@250
- video preview does not save caption style settings per user on close - Verifies caption style changes are not persisted to per-user video preferences.
251
- video preview does not save caption style settings per user on close - Verifies caption style changes are not persisted to per-user video preferences.
251
- video preview releases the backend stream session when closed - Verifies closing a streamed video preview sends an explicit backend release call.
252
- video preview releases the backend stream session when closed - Verifies closing a streamed video preview sends an explicit backend release call.
252
- rapid file reselection does not duplicate sidebar action buttons after delayed metadata - Verifies stale sidebar loads are ignored so action buttons are not duplicated.
253
- rapid file reselection does not duplicate sidebar action buttons after delayed metadata - Verifies stale sidebar loads are ignored so action buttons are not duplicated.
253
- video tiles show centred watched overlays for fully and partway statuses - Verifies watched-status overlays render as filled/outlined eye icons.
254
- video tiles show centred watched overlays after watched metadata is loaded - Verifies overlays remain absent until watched metadata is fetched, then render as filled/outlined eye icons.
254
255
255
## tests/video-stream.test.js
256
## tests/video-stream.test.js
256
- createVideoStreamSession resolves once ffmpeg starts writing stream assets - Verifies session creation no longer waits for the final master playlist before preview can begin.
257
- createVideoStreamSession resolves once ffmpeg starts writing stream assets - Verifies session creation no longer waits for the final master playlist before preview can begin.
@@ -59,6 +59,10 @@ const STATE = {
59
59
// Sidebar async loading guard to prevent stale updates on rapid selection changes.
60
60
sidebarLoadId: 0,
61
61
sidebarAbortController: null,
62
63
// Watched overlays are resolved asynchronously from /files/meta responses.
64
watchedStatusByPath: {},
65
watchedLoadId: 0,
62
66
};
63
67
64
68
const SESSION_KEY = 'filemanager.session.v1';
@@ -539,6 +543,16 @@ async function reportWatchProgress (filePath, progress)
539
543
filePath,
540
544
progress,
541
545
}).catch(() => null);
546
547
const nextStatus = progress >= 0.7 ? 'fully' : progress >= 0.1 ? 'partway' : null;
548
if (!nextStatus) return;
549
550
const prev = STATE.watchedStatusByPath[filePath];
551
if (prev === 'fully') return;
552
STATE.watchedStatusByPath[filePath] = nextStatus;
553
554
const iconEl = findTileIconByPath(filePath);
555
renderWatchedOverlayOnIcon(iconEl, nextStatus);
542
556
}
543
557
544
558
function getOrCreateClientBindingId ()
@@ -1463,6 +1477,7 @@ async function incrementalRefreshCurrentDir ()
1463
1477
else
1464
1478
{
1465
1479
loadThumbnails();
1480
void loadWatchedStatusesForCurrentDir();
1466
1481
}
1467
1482
1468
1483
await refreshFolderStats();
@@ -1515,6 +1530,7 @@ function renderFileGrid ()
1515
1530
}
1516
1531
1517
1532
loadThumbnails();
1533
void loadWatchedStatusesForCurrentDir();
1518
1534
}
1519
1535
1520
1536
function makeFileItem (item)
@@ -1530,15 +1546,7 @@ function makeFileItem (item)
1530
1546
if (!item.isDir)
1531
1547
{
1532
1548
icon.dataset.previewPath = item.path;
1533
1534
const watchStatus = watchStatusForTile(item);
1535
if (watchStatus)
1536
{
1537
const overlay = document.createElement('div');
1538
overlay.className = `watched-overlay watched-overlay--${watchStatus}`;
1539
overlay.innerHTML = watchStatus === 'fully' ? watchedEyeFilledSvg() : watchedEyeOutlineSvg();
1540
icon.appendChild(overlay);
1541
}
1549
renderWatchedOverlayOnIcon(icon, watchStatusForTile(item));
1542
1550
} else
1543
1551
{
1544
1552
icon.dataset.folderPath = item.path;
@@ -4180,6 +4188,9 @@ function watchStatusForTile (item)
4180
4188
if (!item || item.isDir) return null;
4181
4189
if (!VIDEO_EXTS.has(extOf(item.name || ''))) return null;
4182
4190
4191
const cached = STATE.watchedStatusByPath[item.path];
4192
if (cached === 'fully' || cached === 'partway') return cached;
4193
4183
4194
const currentUser = String(STATE.username || '').trim();
4184
4195
if (!currentUser) return null;
4185
4196
@@ -4190,6 +4201,75 @@ function watchStatusForTile (item)
4190
4201
return null;
4191
4202
}
4192
4203
4204
function renderWatchedOverlayOnIcon (iconEl, watchStatus)
4205
{
4206
if (!iconEl) return;
4207
4208
const existing = iconEl.querySelector('.watched-overlay');
4209
if (existing) existing.remove();
4210
if (watchStatus !== 'fully' && watchStatus !== 'partway') return;
4211
4212
const overlay = document.createElement('div');
4213
overlay.className = `watched-overlay watched-overlay--${watchStatus}`;
4214
overlay.innerHTML = watchStatus === 'fully' ? watchedEyeFilledSvg() : watchedEyeOutlineSvg();
4215
iconEl.appendChild(overlay);
4216
}
4217
4218
function findTileIconByPath (filePath)
4219
{
4220
if (typeof document === 'undefined' || typeof document.querySelectorAll !== 'function') return null;
4221
const tile = Array.from(document.querySelectorAll('.file-item')).find((el) => el.dataset.path === filePath);
4222
if (!tile) return null;
4223
return tile.querySelector('.icon');
4224
}
4225
4226
function watchStatusFromWatchedBy (watchedBy)
4227
{
4228
const currentUser = String(STATE.username || '').trim();
4229
if (!currentUser) return null;
4230
4231
const map = watchedBy && typeof watchedBy === 'object' ? watchedBy : {};
4232
const statusRaw = map[currentUser];
4233
const status = String(statusRaw || '').toLowerCase();
4234
if (status === 'fully' || status === 'partway') return status;
4235
return null;
4236
}
4237
4238
async function loadWatchedStatusesForCurrentDir ()
4239
{
4240
const dirAtStart = STATE.currentDir;
4241
if (!dirAtStart) return;
4242
4243
const videoItems = (STATE.items || []).filter((item) =>
4244
item && !item.isDir && VIDEO_EXTS.has(extOf(item.name || ''))
4245
);
4246
if (!videoItems.length) return;
4247
4248
const loadId = ++STATE.watchedLoadId;
4249
4250
const statuses = await Promise.all(videoItems.map(async (item) =>
4251
{
4252
const meta = await api('GET', `/files/meta?file=${encodeURIComponent(item.path)}`).catch(() => null);
4253
return {
4254
path: item.path,
4255
status: watchStatusFromWatchedBy(meta && meta.watchedBy),
4256
};
4257
}));
4258
4259
if (loadId !== STATE.watchedLoadId) return;
4260
if (!samePath(STATE.currentDir, dirAtStart)) return;
4261
if (typeof document === 'undefined' || typeof document.querySelectorAll !== 'function') return;
4262
4263
for (const entry of statuses)
4264
{
4265
if (entry.status) STATE.watchedStatusByPath[entry.path] = entry.status;
4266
else delete STATE.watchedStatusByPath[entry.path];
4267
4268
const iconEl = findTileIconByPath(entry.path);
4269
renderWatchedOverlayOnIcon(iconEl, entry.status);
4270
}
4271
}
4272
4193
4273
function watchedEyeFilledSvg ()
4194
4274
{
4195
4275
return `<svg class="watched-overlay-svg" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path fill="#ffffff" d="M651.669528 512c0-14.5903-2.084475-28.290323-6.251378-41.395806-11.019984 24.423249-35.143405 41.395806-63.733557 41.395806l-7.440459-0.593518-5.957689 0.593518c-30.973432 0-56.285934-25.607214-56.285934-56.882522l0.297782-5.952572-0.297782-7.447623c0-28.290323 16.97665-52.709479 41.097-63.727417-13.104459-4.172019-26.802436-6.252401-41.097-6.252401-77.132728 0-139.67311 62.834071-139.67311 140.263557 0 77.428464 62.540382 139.971915 139.67311 139.971915S651.669528 589.428464 651.669528 512L651.669528 512zM958.70846 512c0 0-153.36904-297.80564-448.198905-297.80564-293.63669 0-445.219037 297.80564-445.219037 297.80564s164.385954 297.804616 447.306582 297.804616C805.038568 809.80564 958.70846 512 958.70846 512L958.70846 512zM304.725748 512c0-114.954125 92.619444-208.164017 207.27374-208.164017 114.657366 0 207.27067 93.209892 207.27067 208.164017 0 114.953102-92.613304 208.167087-207.27067 208.167087C397.345192 720.167087 304.725748 626.953102 304.725748 512L304.725748 512zM304.725748 512"/></svg>`;
@@ -59,6 +59,10 @@ const STATE = {59
// Sidebar async loading guard to prevent stale updates on rapid selection changes.59
// Sidebar async loading guard to prevent stale updates on rapid selection changes.60
sidebarLoadId: 0,60
sidebarLoadId: 0,61
sidebarAbortController: null,61
sidebarAbortController: null,62
63
// Watched overlays are resolved asynchronously from /files/meta responses.64
watchedStatusByPath: {},65
watchedLoadId: 0,62
};66
};63
67
64
const SESSION_KEY = 'filemanager.session.v1';68
const SESSION_KEY = 'filemanager.session.v1';@@ -539,6 +543,16 @@ async function reportWatchProgress (filePath, progress)539
filePath,543
filePath,540
progress,544
progress,541
}).catch(() => null);545
}).catch(() => null);546
547
const nextStatus = progress >= 0.7 ? 'fully' : progress >= 0.1 ? 'partway' : null;548
if (!nextStatus) return;549
550
const prev = STATE.watchedStatusByPath[filePath];551
if (prev === 'fully') return;552
STATE.watchedStatusByPath[filePath] = nextStatus;553
554
const iconEl = findTileIconByPath(filePath);555
renderWatchedOverlayOnIcon(iconEl, nextStatus);542
}556
}543
557
544
function getOrCreateClientBindingId ()558
function getOrCreateClientBindingId ()@@ -1463,6 +1477,7 @@ async function incrementalRefreshCurrentDir ()1463
else1477
else1464
{1478
{1465
loadThumbnails();1479
loadThumbnails();1480
void loadWatchedStatusesForCurrentDir();1466
}1481
}1467
1482
1468
await refreshFolderStats();1483
await refreshFolderStats();@@ -1515,6 +1530,7 @@ function renderFileGrid ()1515
}1530
}1516
1531
1517
loadThumbnails();1532
loadThumbnails();1533
void loadWatchedStatusesForCurrentDir();1518
}1534
}1519
1535
1520
function makeFileItem (item)1536
function makeFileItem (item)@@ -1530,15 +1546,7 @@ function makeFileItem (item)1530
if (!item.isDir)1546
if (!item.isDir)1531
{1547
{1532
icon.dataset.previewPath = item.path;1548
icon.dataset.previewPath = item.path;1533
1549
renderWatchedOverlayOnIcon(icon, watchStatusForTile(item));1534
const watchStatus = watchStatusForTile(item);1535
if (watchStatus)1536
{1537
const overlay = document.createElement('div');1538
overlay.className = `watched-overlay watched-overlay--${watchStatus}`;1539
overlay.innerHTML = watchStatus === 'fully' ? watchedEyeFilledSvg() : watchedEyeOutlineSvg();1540
icon.appendChild(overlay);1541
}1542
} else1550
} else1543
{1551
{1544
icon.dataset.folderPath = item.path;1552
icon.dataset.folderPath = item.path;@@ -4180,6 +4188,9 @@ function watchStatusForTile (item)4180
if (!item || item.isDir) return null;4188
if (!item || item.isDir) return null;4181
if (!VIDEO_EXTS.has(extOf(item.name || ''))) return null;4189
if (!VIDEO_EXTS.has(extOf(item.name || ''))) return null;4182
4190
4191
const cached = STATE.watchedStatusByPath[item.path];4192
if (cached === 'fully' || cached === 'partway') return cached;4193
4183
const currentUser = String(STATE.username || '').trim();4194
const currentUser = String(STATE.username || '').trim();4184
if (!currentUser) return null;4195
if (!currentUser) return null;4185
4196
@@ -4190,6 +4201,75 @@ function watchStatusForTile (item)4190
return null;4201
return null;4191
}4202
}4192
4203
4204
function renderWatchedOverlayOnIcon (iconEl, watchStatus)4205
{4206
if (!iconEl) return;4207
4208
const existing = iconEl.querySelector('.watched-overlay');4209
if (existing) existing.remove();4210
if (watchStatus !== 'fully' && watchStatus !== 'partway') return;4211
4212
const overlay = document.createElement('div');4213
overlay.className = `watched-overlay watched-overlay--${watchStatus}`;4214
overlay.innerHTML = watchStatus === 'fully' ? watchedEyeFilledSvg() : watchedEyeOutlineSvg();4215
iconEl.appendChild(overlay);4216
}4217
4218
function findTileIconByPath (filePath)4219
{4220
if (typeof document === 'undefined' || typeof document.querySelectorAll !== 'function') return null;4221
const tile = Array.from(document.querySelectorAll('.file-item')).find((el) => el.dataset.path === filePath);4222
if (!tile) return null;4223
return tile.querySelector('.icon');4224
}4225
4226
function watchStatusFromWatchedBy (watchedBy)4227
{4228
const currentUser = String(STATE.username || '').trim();4229
if (!currentUser) return null;4230
4231
const map = watchedBy && typeof watchedBy === 'object' ? watchedBy : {};4232
const statusRaw = map[currentUser];4233
const status = String(statusRaw || '').toLowerCase();4234
if (status === 'fully' || status === 'partway') return status;4235
return null;4236
}4237
4238
async function loadWatchedStatusesForCurrentDir ()4239
{4240
const dirAtStart = STATE.currentDir;4241
if (!dirAtStart) return;4242
4243
const videoItems = (STATE.items || []).filter((item) =>4244
item && !item.isDir && VIDEO_EXTS.has(extOf(item.name || ''))4245
);4246
if (!videoItems.length) return;4247
4248
const loadId = ++STATE.watchedLoadId;4249
4250
const statuses = await Promise.all(videoItems.map(async (item) =>4251
{4252
const meta = await api('GET', `/files/meta?file=${encodeURIComponent(item.path)}`).catch(() => null);4253
return {4254
path: item.path,4255
status: watchStatusFromWatchedBy(meta && meta.watchedBy),4256
};4257
}));4258
4259
if (loadId !== STATE.watchedLoadId) return;4260
if (!samePath(STATE.currentDir, dirAtStart)) return;4261
if (typeof document === 'undefined' || typeof document.querySelectorAll !== 'function') return;4262
4263
for (const entry of statuses)4264
{4265
if (entry.status) STATE.watchedStatusByPath[entry.path] = entry.status;4266
else delete STATE.watchedStatusByPath[entry.path];4267
4268
const iconEl = findTileIconByPath(entry.path);4269
renderWatchedOverlayOnIcon(iconEl, entry.status);4270
}4271
}4272
4193
function watchedEyeFilledSvg ()4273
function watchedEyeFilledSvg ()4194
{4274
{4195
return `<svg class="watched-overlay-svg" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path fill="#ffffff" d="M651.669528 512c0-14.5903-2.084475-28.290323-6.251378-41.395806-11.019984 24.423249-35.143405 41.395806-63.733557 41.395806l-7.440459-0.593518-5.957689 0.593518c-30.973432 0-56.285934-25.607214-56.285934-56.882522l0.297782-5.952572-0.297782-7.447623c0-28.290323 16.97665-52.709479 41.097-63.727417-13.104459-4.172019-26.802436-6.252401-41.097-6.252401-77.132728 0-139.67311 62.834071-139.67311 140.263557 0 77.428464 62.540382 139.971915 139.67311 139.971915S651.669528 589.428464 651.669528 512L651.669528 512zM958.70846 512c0 0-153.36904-297.80564-448.198905-297.80564-293.63669 0-445.219037 297.80564-445.219037 297.80564s164.385954 297.804616 447.306582 297.804616C805.038568 809.80564 958.70846 512 958.70846 512L958.70846 512zM304.725748 512c0-114.954125 92.619444-208.164017 207.27374-208.164017 114.657366 0 207.27067 93.209892 207.27067 208.164017 0 114.953102-92.613304 208.167087-207.27067 208.167087C397.345192 720.167087 304.725748 626.953102 304.725748 512L304.725748 512zM304.725748 512"/></svg>`;4275
return `<svg class="watched-overlay-svg" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path fill="#ffffff" d="M651.669528 512c0-14.5903-2.084475-28.290323-6.251378-41.395806-11.019984 24.423249-35.143405 41.395806-63.733557 41.395806l-7.440459-0.593518-5.957689 0.593518c-30.973432 0-56.285934-25.607214-56.285934-56.882522l0.297782-5.952572-0.297782-7.447623c0-28.290323 16.97665-52.709479 41.097-63.727417-13.104459-4.172019-26.802436-6.252401-41.097-6.252401-77.132728 0-139.67311 62.834071-139.67311 140.263557 0 77.428464 62.540382 139.971915 139.67311 139.971915S651.669528 589.428464 651.669528 512L651.669528 512zM958.70846 512c0 0-153.36904-297.80564-448.198905-297.80564-293.63669 0-445.219037 297.80564-445.219037 297.80564s164.385954 297.804616 447.306582 297.804616C805.038568 809.80564 958.70846 512 958.70846 512L958.70846 512zM304.725748 512c0-114.954125 92.619444-208.164017 207.27374-208.164017 114.657366 0 207.27067 93.209892 207.27067 208.164017 0 114.953102-92.613304 208.167087-207.27067 208.167087C397.345192 720.167087 304.725748 626.953102 304.725748 512L304.725748 512zM304.725748 512"/></svg>`;@@ -29,6 +29,7 @@ describe('page load smoke test', () =>
29
29
let downloadFixture;
30
30
let videoStreamFixture;
31
31
let metaDelayMsFixture;
32
let metaWatchedByFixture;
32
33
let releasedVideoStreamSessions;
33
34
let setupNeededFixture;
34
35
const openDoms = [];
@@ -59,6 +60,7 @@ describe('page load smoke test', () =>
59
60
downloadFixture = {};
60
61
videoStreamFixture = {};
61
62
metaDelayMsFixture = {};
63
metaWatchedByFixture = {};
62
64
releasedVideoStreamSessions = [];
63
65
setupNeededFixture = false;
64
66
});
@@ -125,7 +127,7 @@ describe('page load smoke test', () =>
125
127
mtime: new Date(item.mtime || Date.now()).toISOString(),
126
128
uploader: '',
127
129
downloaders: [],
128
watchedBy: item.watchedBy || {},
130
watchedBy: metaWatchedByFixture[file] || item.watchedBy || {},
129
131
});
130
132
};
131
133
@@ -744,7 +746,7 @@ describe('page load smoke test', () =>
744
746
dom.window.close();
745
747
});
746
748
747
test('video tiles show centred watched overlays for fully and partway statuses', async () =>
749
test('video tiles show centred watched overlays after watched metadata is loaded', async () =>
748
750
{
749
751
listFixture = {
750
752
'/data': [
@@ -754,7 +756,6 @@ describe('page load smoke test', () =>
754
756
isDir: false,
755
757
size: 100,
756
758
mtime: Date.now(),
757
watchedBy: { tester: 'fully' },
758
759
},
759
760
{
760
761
name: 'watched-part.mkv',
@@ -762,14 +763,20 @@ describe('page load smoke test', () =>
762
763
isDir: false,
763
764
size: 100,
764
765
mtime: Date.now(),
765
watchedBy: { tester: 'partway' },
766
766
},
767
767
],
768
768
};
769
metaWatchedByFixture['/data/watched-full.mkv'] = { tester: 'fully' };
770
metaWatchedByFixture['/data/watched-part.mkv'] = { tester: 'partway' };
771
metaDelayMsFixture['/data/watched-full.mkv'] = 80;
772
metaDelayMsFixture['/data/watched-part.mkv'] = 80;
769
773
770
774
const { dom, runtimeErrors } = await bootClient();
771
775
expect(runtimeErrors).toEqual([]);
772
776
777
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"]'));
778
expect(dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"] .watched-overlay')).toBeFalsy();
779
773
780
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"] .watched-overlay--fully'));
774
781
775
782
const fullOverlayPath = dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"] .watched-overlay--fully path');
@@ -29,6 +29,7 @@ describe('page load smoke test', () =>29
let downloadFixture;
29
let downloadFixture;
30
let videoStreamFixture;
30
let videoStreamFixture;
31
let metaDelayMsFixture;
31
let metaDelayMsFixture;
32
let metaWatchedByFixture;
32
let releasedVideoStreamSessions;
33
let releasedVideoStreamSessions;
33
let setupNeededFixture;
34
let setupNeededFixture;
34
const openDoms = [];
35
const openDoms = [];
@@ -59,6 +60,7 @@ describe('page load smoke test', () =>59
downloadFixture = {};
60
downloadFixture = {};
60
videoStreamFixture = {};
61
videoStreamFixture = {};
61
metaDelayMsFixture = {};
62
metaDelayMsFixture = {};
63
metaWatchedByFixture = {};
62
releasedVideoStreamSessions = [];
64
releasedVideoStreamSessions = [];
63
setupNeededFixture = false;
65
setupNeededFixture = false;
64
});
66
});
@@ -125,7 +127,7 @@ describe('page load smoke test', () =>125
mtime: new Date(item.mtime || Date.now()).toISOString(),
127
mtime: new Date(item.mtime || Date.now()).toISOString(),
126
uploader: '',
128
uploader: '',
127
downloaders: [],
129
downloaders: [],
128
watchedBy: item.watchedBy || {},
130
watchedBy: metaWatchedByFixture[file] || item.watchedBy || {},
129
});
131
});
130
};
132
};
131
133
@@ -744,7 +746,7 @@ describe('page load smoke test', () =>744
dom.window.close();
746
dom.window.close();
745
});
747
});
746
748
747
test('video tiles show centred watched overlays for fully and partway statuses', async () =>
749
test('video tiles show centred watched overlays after watched metadata is loaded', async () =>
748
{
750
{
749
listFixture = {
751
listFixture = {
750
'/data': [
752
'/data': [
@@ -754,7 +756,6 @@ describe('page load smoke test', () =>754
isDir: false,
756
isDir: false,
755
size: 100,
757
size: 100,
756
mtime: Date.now(),
758
mtime: Date.now(),
757
watchedBy: { tester: 'fully' },
758
},
759
},
759
{
760
{
760
name: 'watched-part.mkv',
761
name: 'watched-part.mkv',
@@ -762,14 +763,20 @@ describe('page load smoke test', () =>762
isDir: false,
763
isDir: false,
763
size: 100,
764
size: 100,
764
mtime: Date.now(),
765
mtime: Date.now(),
765
watchedBy: { tester: 'partway' },
766
},
766
},
767
],
767
],
768
};
768
};
769
metaWatchedByFixture['/data/watched-full.mkv'] = { tester: 'fully' };
770
metaWatchedByFixture['/data/watched-part.mkv'] = { tester: 'partway' };
771
metaDelayMsFixture['/data/watched-full.mkv'] = 80;
772
metaDelayMsFixture['/data/watched-part.mkv'] = 80;
769
773
770
const { dom, runtimeErrors } = await bootClient();
774
const { dom, runtimeErrors } = await bootClient();
771
expect(runtimeErrors).toEqual([]);
775
expect(runtimeErrors).toEqual([]);
772
776
777
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"]'));
778
expect(dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"] .watched-overlay')).toBeFalsy();
779
773
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"] .watched-overlay--fully'));
780
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"] .watched-overlay--fully'));
774
781
775
const fullOverlayPath = dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"] .watched-overlay--fully path');
782
const fullOverlayPath = dom.window.document.querySelector('.file-item[data-path="/data/watched-full.mkv"] .watched-overlay--fully path');