Skip to content

Commit

Permalink
Refactor code to be more redable with better doc
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Jul 3, 2023
1 parent 3989a79 commit aa67d05
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,30 @@ export default defineComponent({
return false
}
} else if (data.type === 'channel') {
if (this.channelsHidden.includes(data.id) || this.channelsHidden.includes(data.name) ||
this.channelsHidden.includes(data.authorId) || this.channelsHidden.includes(data.author)) {
const attrsToCheck = [
// Local API
data.id,
data.name,
// Invidious API
// https://docs.invidious.io/api/common_types/#channelobject
data.author,
data.authorId,
]
if (attrsToCheck.some(a => a != null && this.channelsHidden.includes(a))) {
// hide channels by author
return false
}
} else if (data.type === 'playlist') {
if (this.channelsHidden.includes(data.channelId) || this.channelsHidden.includes(data.channelName) ||
this.channelsHidden.includes(data.authorId) || this.channelsHidden.includes(data.author)) {
const attrsToCheck = [
// Local API
data.channelId,
data.channelName,
// Invidious API
// https://docs.invidious.io/api/common_types/#playlistobject
data.author,
data.authorId,
]
if (attrsToCheck.some(a => a != null && this.channelsHidden.includes(a))) {
// hide playlists by author
return false
}
Expand Down

0 comments on commit aa67d05

Please sign in to comment.