diff --git a/client/components/modals/item/tabs/Schedule.vue b/client/components/modals/item/tabs/Schedule.vue index 032936d1..819ede19 100644 --- a/client/components/modals/item/tabs/Schedule.vue +++ b/client/components/modals/item/tabs/Schedule.vue @@ -20,7 +20,7 @@
Max new episodes to download per check @@ -129,9 +129,12 @@ export default { return } } - if (this.$refs.maxEpisodesInput && this.$refs.maxEpisodesInput.isFocused) { + + if (this.$refs.maxEpisodesInput?.isFocused) { this.$refs.maxEpisodesInput.blur() - return + } + if (this.$refs.maxEpisodesToDownloadInput?.isFocused) { + this.$refs.maxEpisodesToDownloadInput.blur() } const updatePayload = { @@ -140,9 +143,11 @@ export default { if (this.enableAutoDownloadEpisodes) { updatePayload.autoDownloadSchedule = this.cronExpression } + this.newMaxEpisodesToKeep = Number(this.newMaxEpisodesToKeep) if (this.newMaxEpisodesToKeep !== this.maxEpisodesToKeep) { updatePayload.maxEpisodesToKeep = this.newMaxEpisodesToKeep } + this.newMaxNewEpisodesToDownload = Number(this.newMaxNewEpisodesToDownload) if (this.newMaxNewEpisodesToDownload !== this.maxNewEpisodesToDownload) { updatePayload.maxNewEpisodesToDownload = this.newMaxNewEpisodesToDownload } diff --git a/server/objects/mediaTypes/Podcast.js b/server/objects/mediaTypes/Podcast.js index a0e5de04..6f7ca337 100644 --- a/server/objects/mediaTypes/Podcast.js +++ b/server/objects/mediaTypes/Podcast.js @@ -42,7 +42,13 @@ class Podcast { this.autoDownloadSchedule = podcast.autoDownloadSchedule || '0 * * * *' // Added in 2.1.3 so default to hourly this.lastEpisodeCheck = podcast.lastEpisodeCheck || 0 this.maxEpisodesToKeep = podcast.maxEpisodesToKeep || 0 - this.maxNewEpisodesToDownload = podcast.maxNewEpisodesToDownload || 3 + + // Default is 3 but 0 is allowed + if (typeof podcast.maxNewEpisodesToDownload !== 'number') { + this.maxNewEpisodesToDownload = 3 + } else { + this.maxNewEpisodesToDownload = podcast.maxNewEpisodesToDownload + } } toJSON() { diff --git a/server/utils/index.js b/server/utils/index.js index f75572ba..6a89621b 100644 --- a/server/utils/index.js +++ b/server/utils/index.js @@ -114,7 +114,9 @@ module.exports.reqSupportsWebp = (req) => { module.exports.areEquivalent = areEquivalent module.exports.copyValue = (val) => { - if (!val) return val === false ? false : null + if (val === undefined || val === '') return null + else if (!val) return val + if (!this.isObject(val)) return val if (Array.isArray(val)) {