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

Add hide channel option directly to More Options menu #4228

41 changes: 40 additions & 1 deletion src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,25 @@ export default defineComponent({
{
label: this.$t('Video.Open Channel in Invidious'),
value: 'openInvidiousChannel'
},
{
type: 'divider'
}
)

const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
const channelShouldBeHidden = hiddenChannels.some(c => c === this.channelId)
if (channelShouldBeHidden) {
options.push({
label: this.$t('Video.Unhide Channel'),
value: 'unhideChannel'
})
} else {
options.push({
label: this.$t('Video.Hide Channel'),
value: 'hideChannel'
})
}
}
}

Expand Down Expand Up @@ -434,6 +451,12 @@ export default defineComponent({
case 'openInvidiousChannel':
openExternalLink(this.invidiousChannelUrl)
break
case 'hideChannel':
this.hideChannel(this.channelName, this.channelId)
break
case 'unhideChannel':
this.unhideChannel(this.channelName, this.channelId)
break
}
},

Expand Down Expand Up @@ -621,12 +644,28 @@ export default defineComponent({
showToast(this.$t('Video.Video has been removed from your saved list'))
},

hideChannel: function(channelName, channelId) {
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
hiddenChannels.push(channelId)
this.updateChannelsHidden(JSON.stringify(hiddenChannels))

showToast(this.$t('Channel Hidden', { channel: channelName }))
},

unhideChannel: function(channelName, channelId) {
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
this.updateChannelsHidden(JSON.stringify(hiddenChannels.filter(c => c !== channelId)))

showToast(this.$t('Channel Unhidden', { channel: channelName }))
},

...mapActions([
'openInExternalPlayer',
'updateHistory',
'removeFromHistory',
'addVideo',
'removeVideo'
'removeVideo',
'updateChannelsHidden'
])
}
})
4 changes: 4 additions & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,8 @@ Video:
Copy YouTube Channel Link: Copy YouTube Channel Link
Open Channel in Invidious: Open Channel in Invidious
Copy Invidious Channel Link: Copy Invidious Channel Link
Hide Channel: Hide Channel
Unhide Channel: Show Channel
Views: Views
Loop Playlist: Loop Playlist
Shuffle Playlist: Shuffle Playlist
Expand Down Expand Up @@ -920,6 +922,8 @@ Starting download: 'Starting download of "{videoTitle}"'
Downloading failed: 'There was an issue downloading "{videoTitle}"'
Screenshot Success: Saved screenshot as "{filePath}"
Screenshot Error: Screenshot failed. {error}
Channel Hidden: '{channel} added to channel filter'
Channel Unhidden: '{channel} removed from channel filter'

Hashtag:
Hashtag: Hashtag
Expand Down