diff --git a/package.json b/package.json index 2ddfa5bd..c0254f2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "podverse-api", - "version": "4.14.10", + "version": "4.14.11", "description": "Data API, database migration scripts, and backend services for all Podverse models.", "contributors": [ "Mitch Downey" diff --git a/src/controllers/episode.ts b/src/controllers/episode.ts index 24212990..7f3dcb32 100644 --- a/src/controllers/episode.ts +++ b/src/controllers/episode.ts @@ -562,16 +562,12 @@ const retrieveLatestChapters = async (id) => { }) const existingChapters = await qb.getRawMany() - // If existing chapter with current chapter's startTime does not exist, - // then set the existingChapter to isPublic = false. - const deadChapters = existingChapters.filter((x) => { - return newChapters.every((y) => y.startTime !== x.startTime) - }) - - for (const deadChapter of deadChapters) { + // Temporarily hide all existing chapters, + // then display the new valid ones at the end. + for (const existingChapter of existingChapters) { await updateMediaRef( { - ...deadChapter, + ...existingChapter, isPublic: false }, superUserId