diff --git a/.travis.yml b/.travis.yml index ab807d7a..220c8032 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,5 @@ before_install: - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & install: - npm ci - - npm run lint - npm run build after_success: npm run coverage diff --git a/src/backend/model/database/sql/GalleryManager.ts b/src/backend/model/database/sql/GalleryManager.ts index 1963b62b..9f250262 100644 --- a/src/backend/model/database/sql/GalleryManager.ts +++ b/src/backend/model/database/sql/GalleryManager.ts @@ -60,7 +60,13 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager { if (dir.lastModified !== lastModified) { Logger.silly(LOG_TAG, 'Reindexing reason: lastModified mismatch: known: ' + dir.lastModified + ', current:' + lastModified); - return ObjectManagers.getInstance().IndexingManager.indexDirectory(relativeDirectoryName); + const ret = await ObjectManagers.getInstance().IndexingManager.indexDirectory(relativeDirectoryName); + for (const subDir of ret.directories) { + if (!subDir.preview) { // if sub directories does not have photos, so cannot show a preview, try get one from DB + await this.fillPreviewFromSubDir(connection, subDir); + } + } + return ret; } @@ -213,7 +219,7 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager { return await query.getOne(); } - protected async fillPreviewFromSubDir(connection: Connection, dir: DirectoryEntity): Promise { + protected async fillPreviewFromSubDir(connection: Connection, dir: DirectoryDTO): Promise { dir.media = []; const query = connection .getRepository(MediaEntity)