mirror of https://github.com/FreeTubeApp/FreeTube
Add back author search in video playlist searching (#4919)
* Add back author search in video playlist searching
Reuses previous paradigm (the paradigm currently in place in History.js). This was the pre-existing behavior before the Playlist PR. See 5c8d49bf51/src/renderer/views/UserPlaylists/UserPlaylists.js (L98-L103)
.
* Update title/author search handling to not fail if only one of the base values is invalid
* Add author-searching to 'Find playlist with video' results
This commit is contained in:
parent
2d51419797
commit
d6e5439b67
|
@ -119,7 +119,7 @@ export default defineComponent({
|
||||||
if (typeof (playlist.playlistName) !== 'string') { return false }
|
if (typeof (playlist.playlistName) !== 'string') { return false }
|
||||||
|
|
||||||
if (this.doSearchPlaylistsWithMatchingVideos) {
|
if (this.doSearchPlaylistsWithMatchingVideos) {
|
||||||
if (playlist.videos.some((v) => v.title.toLowerCase().includes(this.processedQuery))) {
|
if (playlist.videos.some((v) => v.author.toLowerCase().includes(this.processedQuery) || v.title.toLowerCase().includes(this.processedQuery))) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,13 @@ export default defineComponent({
|
||||||
} else {
|
} else {
|
||||||
const lowerCaseQuery = this.query.toLowerCase()
|
const lowerCaseQuery = this.query.toLowerCase()
|
||||||
const filteredQuery = this.historyCacheSorted.filter((video) => {
|
const filteredQuery = this.historyCacheSorted.filter((video) => {
|
||||||
if (typeof (video.title) !== 'string' || typeof (video.author) !== 'string') {
|
if (typeof (video.title) === 'string' && video.title.toLowerCase().includes(lowerCaseQuery)) {
|
||||||
return false
|
return true
|
||||||
} else {
|
} else if (typeof (video.author) === 'string' && video.author.toLowerCase().includes(lowerCaseQuery)) {
|
||||||
return video.title.toLowerCase().includes(lowerCaseQuery) || video.author.toLowerCase().includes(lowerCaseQuery)
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
}).sort((a, b) => {
|
}).sort((a, b) => {
|
||||||
return b.timeWatched - a.timeWatched
|
return b.timeWatched - a.timeWatched
|
||||||
})
|
})
|
||||||
|
|
|
@ -142,7 +142,13 @@ export default defineComponent({
|
||||||
if (this.processedVideoSearchQuery === '') { return this.playlistItems }
|
if (this.processedVideoSearchQuery === '') { return this.playlistItems }
|
||||||
|
|
||||||
return this.playlistItems.filter((v) => {
|
return this.playlistItems.filter((v) => {
|
||||||
return v.title.toLowerCase().includes(this.processedVideoSearchQuery)
|
if (typeof (v.title) === 'string' && v.title.toLowerCase().includes(this.processedVideoSearchQuery)) {
|
||||||
|
return true
|
||||||
|
} else if (typeof (v.author) === 'string' && v.author.toLowerCase().includes(this.processedVideoSearchQuery)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
visiblePlaylistItems: function () {
|
visiblePlaylistItems: function () {
|
||||||
|
|
|
@ -223,7 +223,7 @@ export default defineComponent({
|
||||||
if (typeof (playlist.playlistName) !== 'string') { return false }
|
if (typeof (playlist.playlistName) !== 'string') { return false }
|
||||||
|
|
||||||
if (this.doSearchPlaylistsWithMatchingVideos) {
|
if (this.doSearchPlaylistsWithMatchingVideos) {
|
||||||
if (playlist.videos.some((v) => v.title.toLowerCase().includes(this.lowerCaseQuery))) {
|
if (playlist.videos.some((v) => v.author.toLowerCase().includes(this.lowerCaseQuery) || v.title.toLowerCase().includes(this.lowerCaseQuery))) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue