Skip to content

Commit

Permalink
fix: Always fetch media for "most recent media" views (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
dermotduffy authored Dec 24, 2024
1 parent 9d812af commit bc95f55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 41 deletions.
13 changes: 3 additions & 10 deletions src/card-controller/view/view-query-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,14 @@ export class ViewQueryExecutor {
viewModifiers.push(...(await executeMediaQuery('clips')));
break;

// Gallery views:
case 'clip':
case 'clips':
case 'snapshot':
case 'snapshots':
case 'recording':
case 'recordings':
viewModifiers.push(...(await executeMediaQuery(mediaType)));
break;

// Viewer views:
case 'clip':
case 'snapshot':
case 'recording':
if (config.media_viewer.controls.thumbnails.mode !== 'none') {
viewModifiers.push(...(await executeMediaQuery(mediaType)));
}
break;
}

viewModifiers.push(...this._getTimelineWindowViewModifier(view));
Expand Down
31 changes: 0 additions & 31 deletions tests/card-controller/view/view-query-executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,37 +345,6 @@ describe('ViewQueryExecutor', () => {
);
});

describe('with an media viewer view', () => {
it('should not fetch anything if configured for no thumbnails', async () => {
const executor = mock<QueryExecutor>();

const viewQueryExecutor = new ViewQueryExecutor(
createPopulatedAPI({
media_viewer: {
controls: {
thumbnails: {
mode: 'none' as const,
},
},
},
}),
executor,
);
const view = new View({
view: 'clip',
camera: 'camera.office',
});

const modifiers = await viewQueryExecutor.getNewQueryModifiers(view);
applyViewModifiers(view, modifiers);

expect(view?.query).toBeNull();
expect(view?.queryResults).toBeNull();
expect(executor.executeDefaultEventQuery).not.toHaveBeenCalled();
expect(executor.executeDefaultRecordingQuery).not.toHaveBeenCalled();
});
});

describe('when setting or removing seek time', () => {
it('should set seek time when results are selected based on time', async () => {
const now = new Date();
Expand Down

0 comments on commit bc95f55

Please sign in to comment.