Skip to content

Commit ad981b3

Browse files
authored
Fix hide/show channel in ft-list-video (#5149)
* Fix hide/show channel in ft-list-video * Fix fetching the channel thumbnail
1 parent 85b01de commit ad981b3

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/renderer/components/distraction-settings/distraction-settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export default defineComponent({
173173
if (tag.invalid) continue
174174

175175
// process if no preferred name and is possibly a YouTube ID
176-
if (tag.preferredName === '' && checkYoutubeChannelId(tag.name)) {
176+
if ((tag.preferredName === '' || !tag.icon) && checkYoutubeChannelId(tag.name)) {
177177
this.channelHiderDisabled = true
178178

179179
const { preferredName, icon, iconHref, invalidId } = await this.findChannelTagInfo(tag.name)

src/renderer/components/ft-list-video/ft-list-video.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export default defineComponent({
296296

297297
if (this.channelId !== null) {
298298
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
299-
const channelShouldBeHidden = hiddenChannels.some(c => c === this.channelId)
299+
const channelShouldBeHidden = hiddenChannels.some(c => c.name === this.channelId)
300300

301301
options.push(
302302
{
@@ -755,15 +755,15 @@ export default defineComponent({
755755

756756
hideChannel: function(channelName, channelId) {
757757
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
758-
hiddenChannels.push(channelId)
758+
hiddenChannels.push({ name: channelId, preferredName: channelName })
759759
this.updateChannelsHidden(JSON.stringify(hiddenChannels))
760760

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

764764
unhideChannel: function(channelName, channelId) {
765765
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
766-
this.updateChannelsHidden(JSON.stringify(hiddenChannels.filter(c => c !== channelId)))
766+
this.updateChannelsHidden(JSON.stringify(hiddenChannels.filter(c => c.name !== channelId)))
767767

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

src/renderer/helpers/channels.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { invidiousGetChannelInfo } from './api/invidious'
2-
import { getLocalChannel } from './api/local'
2+
import { getLocalChannel, parseLocalChannelHeader } from './api/local'
33

44
/**
55
* @param {string} id
@@ -54,9 +54,12 @@ export async function findChannelTagInfo(id, backendOptions) {
5454
}
5555
} else {
5656
if (channel.alert) return { invalidId: true }
57+
58+
const { name, thumbnailUrl } = parseLocalChannelHeader(channel)
59+
5760
return {
58-
preferredName: channel.header.author.name,
59-
icon: channel.header.author.thumbnails.pop().url,
61+
preferredName: name,
62+
icon: thumbnailUrl,
6063
iconHref: `/channel/${id}`
6164
}
6265
}

0 commit comments

Comments
 (0)