mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 09:15:35 +03:00
fix(server): include trashed assets in forced thumbnail generation (#10389)
* fix(server): include trashed assets in forced thumbnail generation * deleted -> trashed
This commit is contained in:
@@ -107,6 +107,31 @@ describe(MediaService.name, () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('should queue trashed assets when force is true', async () => {
|
||||
assetMock.getAll.mockResolvedValue({
|
||||
items: [assetStub.trashed],
|
||||
hasNextPage: false,
|
||||
});
|
||||
personMock.getAll.mockResolvedValue({
|
||||
items: [],
|
||||
hasNextPage: false,
|
||||
});
|
||||
|
||||
await sut.handleQueueGenerateThumbnails({ force: true });
|
||||
|
||||
expect(assetMock.getAll).toHaveBeenCalledWith(
|
||||
{ skip: 0, take: 1000 },
|
||||
expect.objectContaining({ withDeleted: true }),
|
||||
);
|
||||
expect(assetMock.getWithout).not.toHaveBeenCalled();
|
||||
expect(jobMock.queueAll).toHaveBeenCalledWith([
|
||||
{
|
||||
name: JobName.GENERATE_PREVIEW,
|
||||
data: { id: assetStub.trashed.id },
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should queue all people with missing thumbnail path', async () => {
|
||||
assetMock.getWithout.mockResolvedValue({
|
||||
items: [assetStub.image],
|
||||
|
||||
@@ -70,7 +70,7 @@ export class MediaService {
|
||||
async handleQueueGenerateThumbnails({ force }: IBaseJob): Promise<JobStatus> {
|
||||
const assetPagination = usePagination(JOBS_ASSET_PAGINATION_SIZE, (pagination) => {
|
||||
return force
|
||||
? this.assetRepository.getAll(pagination, { isVisible: true })
|
||||
? this.assetRepository.getAll(pagination, { isVisible: true, withDeleted: true })
|
||||
: this.assetRepository.getWithout(pagination, WithoutProperty.THUMBNAIL);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user