Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup unused channel hiding code in ft-list-video-numbered #5208

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,46 +74,16 @@ export default defineComponent({
isCurrentVideo: {
type: Boolean,
default: false
},
useChannelsHiddenPreference: {
type: Boolean,
default: false,
}
},
emits: ['move-video-down', 'move-video-up', 'pause-player', 'remove-from-playlist'],
data: function () {
return {
visible: false,
show: true,
visible: this.initialVisibleState,
stopWatchingInitialVisibleState: null
}
},
computed: {
channelsHidden() {
// Some component users like channel view will have this disabled
if (!this.useChannelsHiddenPreference) { return [] }

return JSON.parse(this.$store.getters.getChannelsHidden).map((ch) => {
// Legacy support
if (typeof ch === 'string') {
return { name: ch, preferredName: '', icon: '' }
}
return ch
})
},

// As we only use this component in Playlist and watch-video-playlist,
// where title filtering is never desired, we don't have any title filtering logic here,
// like we do in ft-list-video-lazy

shouldBeVisible() {
return !(this.channelsHidden.some(ch => ch.name === this.data.authorId) ||
this.channelsHidden.some(ch => ch.name === this.data.author))
}
},
created() {
this.visible = this.initialVisibleState

if (!this.initialVisibleState) {
this.stopWatchingInitialVisibleState = this.$watch('initialVisibleState', (newValue) => {
this.visible = newValue
Expand All @@ -124,18 +94,12 @@ export default defineComponent({
},
methods: {
onVisibilityChanged: function (visible) {
if (visible && this.shouldBeVisible) {
if (visible) {
this.visible = visible
if (this.stopWatchingInitialVisibleState) {
this.stopWatchingInitialVisibleState()
this.stopWatchingInitialVisibleState = null
}
} else if (visible) {
this.show = false
if (this.stopWatchingInitialVisibleState) {
this.stopWatchingInitialVisibleState()
this.stopWatchingInitialVisibleState = null
}
}
},
pausePlayer: function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div
v-show="show"
v-observe-visibility="initialVisibleState || visible ? false : {
callback: onVisibilityChanged,
once: true,
Expand Down