forked from Cutlery/immich
fix comments from mert
This commit is contained in:
parent
3f56cbeddf
commit
d8830e2a52
@ -70,41 +70,6 @@ describe(`${LibraryController.name} (e2e)`, () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not offline a missing file when performing regular scan', async () => {
|
|
||||||
await fs.promises.cp(`${IMMICH_TEST_ASSET_PATH}/albums/nature`, `${IMMICH_TEST_ASSET_TEMP_PATH}/albums/nature`, {
|
|
||||||
recursive: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const library = await api.libraryApi.create(server, admin.accessToken, {
|
|
||||||
type: LibraryType.EXTERNAL,
|
|
||||||
importPaths: [`${IMMICH_TEST_ASSET_TEMP_PATH}`],
|
|
||||||
});
|
|
||||||
|
|
||||||
await api.libraryApi.scanLibrary(server, admin.accessToken, library.id);
|
|
||||||
|
|
||||||
const onlineAssets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
|
||||||
expect(onlineAssets.length).toBeGreaterThan(1);
|
|
||||||
|
|
||||||
await fs.promises.rm(`${IMMICH_TEST_ASSET_TEMP_PATH}/albums/nature/silver_fir.jpg`);
|
|
||||||
|
|
||||||
await api.libraryApi.scanLibrary(server, admin.accessToken, library.id);
|
|
||||||
|
|
||||||
const assets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
|
||||||
|
|
||||||
expect(assets).toEqual(
|
|
||||||
expect.arrayContaining([
|
|
||||||
expect.objectContaining({
|
|
||||||
isOffline: false,
|
|
||||||
originalFileName: 'silver_fir',
|
|
||||||
}),
|
|
||||||
expect.objectContaining({
|
|
||||||
isOffline: false,
|
|
||||||
originalFileName: 'tanners_ridge',
|
|
||||||
}),
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should mark a rediscovered file as back online', async () => {
|
it('should mark a rediscovered file as back online', async () => {
|
||||||
await fs.promises.cp(`${IMMICH_TEST_ASSET_PATH}/albums/nature`, `${IMMICH_TEST_ASSET_TEMP_PATH}/albums/nature`, {
|
await fs.promises.cp(`${IMMICH_TEST_ASSET_PATH}/albums/nature`, `${IMMICH_TEST_ASSET_TEMP_PATH}/albums/nature`, {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
|
@ -563,20 +563,17 @@ export class LibraryService extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dto.checkForOffline) {
|
if (dto.checkForOffline) {
|
||||||
if (dto.refreshAllFiles || dto.refreshModifiedFiles) {
|
|
||||||
throw new BadRequestException('Cannot use checkForOffline with refreshAllFiles or refreshModifiedFiles');
|
|
||||||
}
|
|
||||||
await this.jobRepository.queue({ name: JobName.LIBRARY_SCAN_OFFLINE, data: { id } });
|
await this.jobRepository.queue({ name: JobName.LIBRARY_SCAN_OFFLINE, data: { id } });
|
||||||
} else {
|
|
||||||
await this.jobRepository.queue({
|
|
||||||
name: JobName.LIBRARY_SCAN,
|
|
||||||
data: {
|
|
||||||
id,
|
|
||||||
refreshModifiedFiles: dto.refreshModifiedFiles ?? false,
|
|
||||||
refreshAllFiles: dto.refreshAllFiles ?? false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.jobRepository.queue({
|
||||||
|
name: JobName.LIBRARY_SCAN,
|
||||||
|
data: {
|
||||||
|
id,
|
||||||
|
refreshModifiedFiles: dto.refreshModifiedFiles ?? false,
|
||||||
|
refreshAllFiles: dto.refreshAllFiles ?? false,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async queueRemoveOffline(auth: AuthDto, id: string) {
|
async queueRemoveOffline(auth: AuthDto, id: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user