Skip to content

Commit

Permalink
Hide playlists in channel search results if "hide channel playlist" p…
Browse files Browse the repository at this point in the history
…reference selected. (#4454)

* Hide playlists in channel search results if "hide channel playlist"
preference selected.

* Apply filtering to invidious api response.

* Correct playlist filtering predicate for invidious API.

---------

Co-authored-by: Simon Epstein <[email protected]>
  • Loading branch information
elshimone and simonepstein authored Dec 16, 2023
1 parent 3c3a83e commit ca94bce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/renderer/views/Channel/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ export default defineComponent({
const results = contents
.filter(node => node.type === 'ItemSection')
.flatMap(itemSection => itemSection.contents)
.filter(item => item.type === 'Video' || item.type === 'Playlist')
.filter(item => item.type === 'Video' || (!this.hideChannelPlaylists && item.type === 'Playlist'))
.map(item => {
if (item.type === 'Video') {
return parseLocalListVideo(item)
Expand Down Expand Up @@ -1847,7 +1847,11 @@ export default defineComponent({
}

invidiousAPICall(payload).then((response) => {
this.searchResults = this.searchResults.concat(response)
if (this.hideChannelPlaylists) {
this.searchResults = this.searchResults.concat(response.filter(item => item.type !== 'playlist'))
} else {
this.searchResults = this.searchResults.concat(response)
}
this.isElementListLoading = false
this.searchPage++
}).catch((err) => {
Expand Down

0 comments on commit ca94bce

Please sign in to comment.