Merge pull request #1938 from cosandr/fix-304

Remember sort & filter options for podcast episodes
This commit is contained in:
advplyr
2026-08-02 17:49:02 -05:00
committed by GitHub
2 changed files with 28 additions and 8 deletions
+23 -6
View File
@@ -79,9 +79,6 @@ export default {
episodesCopy: [], episodesCopy: [],
showFiltersModal: false, showFiltersModal: false,
showSortModal: false, showSortModal: false,
sortKey: 'publishedAt',
sortDesc: true,
filterKey: 'incomplete',
fetchingRSSFeed: false, fetchingRSSFeed: false,
podcastFeedEpisodes: [], podcastFeedEpisodes: [],
showPodcastEpisodeFeed: false, showPodcastEpisodeFeed: false,
@@ -223,6 +220,27 @@ export default {
if (!this.sortKey) return '' if (!this.sortKey) return ''
const _sel = this.episodeSortItems.find((i) => i.value === this.sortKey) const _sel = this.episodeSortItems.find((i) => i.value === this.sortKey)
return _sel?.text || '' return _sel?.text || ''
},
filterKey() {
return this.$store.getters['user/getUserSetting']('podcastEpisodesFilterBy') || 'incomplete'
},
sortKey: {
get() {
return this.$store.getters['user/getUserSetting']('podcastEpisodesOrderBy') || 'publishedAt'
},
set(val) {
this.$store.dispatch('user/updateUserSettings', { podcastEpisodesOrderBy: val })
}
},
sortDesc: {
get() {
const desc = this.$store.getters['user/getUserSetting']('podcastEpisodesOrderDesc')
if (desc == null) return this.mediaMetadata.type === 'episodic'
return desc
},
set(val) {
this.$store.dispatch('user/updateUserSettings', { podcastEpisodesOrderDesc: val })
}
} }
}, },
methods: { methods: {
@@ -277,8 +295,8 @@ export default {
this.$store.commit('globals/setShowPlaylistsAddCreateModal', true) this.$store.commit('globals/setShowPlaylistsAddCreateModal', true)
}, },
setFilter(filter) { setFilter(filter) {
this.filterKey = filter
this.showFiltersModal = false this.showFiltersModal = false
this.$store.dispatch('user/updateUserSettings', { podcastEpisodesFilterBy: filter })
}, },
showFilters() { showFilters() {
this.showFiltersModal = true this.showFiltersModal = true
@@ -291,7 +309,6 @@ export default {
return this.$store.getters['user/getUserMediaProgress'](this.libraryItemId, episode.id) return this.$store.getters['user/getUserMediaProgress'](this.libraryItemId, episode.id)
}, },
init() { init() {
this.sortDesc = this.mediaMetadata.type === 'episodic'
this.episodesCopy = this.episodes.map((ep) => { this.episodesCopy = this.episodes.map((ep) => {
return { ...ep } return { ...ep }
}) })
@@ -316,7 +333,7 @@ export default {
}, },
mounted() { mounted() {
if (this.$route.query['episodefilter'] === 'downloaded') { if (this.$route.query['episodefilter'] === 'downloaded') {
this.filterKey = 'downloaded' this.$store.dispatch('user/updateUserSettings', { podcastEpisodesFilterBy: 'downloaded' })
} }
this.$socket.$on('episode_download_queued', this.episodeDownloadQueued) this.$socket.$on('episode_download_queued', this.episodeDownloadQueued)
this.$socket.$on('episode_download_started', this.episodeDownloadStarted) this.$socket.$on('episode_download_started', this.episodeDownloadStarted)
+5 -2
View File
@@ -12,7 +12,10 @@ export const state = () => ({
mobileFilterBy: 'all', mobileFilterBy: 'all',
playbackRate: 1, playbackRate: 1,
collapseSeries: false, collapseSeries: false,
collapseBookSeries: false collapseBookSeries: false,
podcastEpisodesOrderBy: 'publishedAt',
podcastEpisodesOrderDesc: null,
podcastEpisodesFilterBy: 'incomplete'
} }
}) })
@@ -45,7 +48,7 @@ export const getters = {
return state.user.bookmarks.filter((bm) => bm.libraryItemId === libraryItemId) return state.user.bookmarks.filter((bm) => bm.libraryItemId === libraryItemId)
}, },
getUserSetting: (state) => (key) => { getUserSetting: (state) => (key) => {
return state.settings?.[key] || null return state.settings?.[key] ?? null
}, },
getUserCanUpdate: (state) => { getUserCanUpdate: (state) => {
return !!state.user?.permissions?.update return !!state.user?.permissions?.update