From dcd6859d49b55489a794c9d78dede380c1016130 Mon Sep 17 00:00:00 2001 From: RikThePixel Date: Thu, 22 Jun 2023 15:27:14 +0200 Subject: [PATCH 1/4] Fix Hide Channel Subscribers setting still displaying subscribers if changed from a secondary window (#3504) --- .../ft-list-channel/ft-list-channel.js | 13 +++------- .../ft-list-channel/ft-list-channel.vue | 2 +- .../ft-subscribe-button.js | 6 ++++- .../watch-video-info/watch-video-info.js | 12 ++++----- .../watch-video-info/watch-video-info.vue | 2 +- src/renderer/views/Channel/Channel.js | 8 ++---- src/renderer/views/Channel/Channel.vue | 2 +- src/renderer/views/Watch/Watch.js | 25 ++++++------------- src/renderer/views/Watch/Watch.vue | 2 +- 9 files changed, 27 insertions(+), 45 deletions(-) diff --git a/src/renderer/components/ft-list-channel/ft-list-channel.js b/src/renderer/components/ft-list-channel/ft-list-channel.js index bd5409241cc47..d93f42ee58bf0 100644 --- a/src/renderer/components/ft-list-channel/ft-list-channel.js +++ b/src/renderer/components/ft-list-channel/ft-list-channel.js @@ -53,11 +53,8 @@ export default defineComponent({ this.channelName = this.data.name this.id = this.data.id - if (this.hideChannelSubscriptions || this.data.subscribers == null) { - this.subscriberCount = null - } else { - this.subscriberCount = this.data.subscribers.replace(/ subscriber(s)?/, '') - } + this.subscriberCount = this.data.subscribers !== null ? this.data.subscribers.replace(/ subscriber(s)?/, '') : '' + if (this.data.videos === null) { this.videoCount = 0 } else { @@ -79,11 +76,7 @@ export default defineComponent({ this.channelName = this.data.author this.id = this.data.authorId - if (this.hideChannelSubscriptions) { - this.subscriberCount = null - } else { - this.subscriberCount = formatNumber(this.data.subCount) - } + this.subscriberCount = formatNumber(this.data.subCount) this.videoCount = formatNumber(this.data.videoCount) this.description = this.data.description } diff --git a/src/renderer/components/ft-list-channel/ft-list-channel.vue b/src/renderer/components/ft-list-channel/ft-list-channel.vue index 6ac9f8ed835dd..cfc85205005e1 100644 --- a/src/renderer/components/ft-list-channel/ft-list-channel.vue +++ b/src/renderer/components/ft-list-channel/ft-list-channel.vue @@ -26,7 +26,7 @@
{{ subscriberCount }} subscribers - diff --git a/src/renderer/components/ft-subscribe-button/ft-subscribe-button.js b/src/renderer/components/ft-subscribe-button/ft-subscribe-button.js index 15a6147c94087..270715369b708 100644 --- a/src/renderer/components/ft-subscribe-button/ft-subscribe-button.js +++ b/src/renderer/components/ft-subscribe-button/ft-subscribe-button.js @@ -50,9 +50,13 @@ export default defineComponent({ return this.subscriptionInfo !== null }, + hideChannelSubscriptions: function () { + return this.$store.getters.getHideChannelSubscriptions + }, + subscribedText: function () { let subscribedValue = (this.isSubscribed ? this.$t('Channel.Unsubscribe') : this.$t('Channel.Subscribe')).toUpperCase() - if (this.subscriptionCountText !== '') { + if (this.subscriptionCountText !== '' && !this.hideChannelSubscriptions) { subscribedValue += ' ' + this.subscriptionCountText } return subscribedValue diff --git a/src/renderer/components/watch-video-info/watch-video-info.js b/src/renderer/components/watch-video-info/watch-video-info.js index 58118ec47f77c..7db1725b2e05d 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.js +++ b/src/renderer/components/watch-video-info/watch-video-info.js @@ -35,6 +35,10 @@ export default defineComponent({ type: String, required: true }, + channelSubCountText: { + type: String, + required: true + }, published: { type: Number, required: true @@ -43,10 +47,6 @@ export default defineComponent({ type: Number, required: true }, - subscriptionCountText: { - type: String, - required: true - }, likeCount: { type: Number, default: 0 @@ -105,11 +105,11 @@ export default defineComponent({ } }, computed: { - hideSharingActions: function() { + hideSharingActions: function () { return this.$store.getters.getHideSharingActions }, - hideUnsubscribeButton: function() { + hideUnsubscribeButton: function () { return this.$store.getters.getHideUnsubscribeButton }, diff --git a/src/renderer/components/watch-video-info/watch-video-info.vue b/src/renderer/components/watch-video-info/watch-video-info.vue index c28b1811299aa..900622ad4652c 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.vue +++ b/src/renderer/components/watch-video-info/watch-video-info.vue @@ -35,7 +35,7 @@ :channel-id="channelId" :channel-name="channelName" :channel-thumbnail="channelThumbnail" - :subscription-count-text="subscriptionCountText" + :subscription-count-text="channelSubCountText" />
diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index 27e2d97200880..1f7462f8812bd 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -559,7 +559,7 @@ export default defineComponent({ document.title = `${channelName} - ${packageDetails.productName}` - if (!this.hideChannelSubscriptions && subscriberText) { + if (subscriberText) { const subCount = parseLocalSubscriberCount(subscriberText) if (isNaN(subCount)) { @@ -864,11 +864,7 @@ export default defineComponent({ document.title = `${this.channelName} - ${packageDetails.productName}` this.id = channelId this.isFamilyFriendly = response.isFamilyFriendly - if (this.hideChannelSubscriptions) { - this.subCount = null - } else { - this.subCount = response.subCount - } + this.subCount = response.subCount const thumbnail = response.authorThumbnails[3].url this.thumbnailUrl = youtubeImageUrlToInvidious(thumbnail, this.currentInvidiousInstance) this.updateSubscriptionDetails({ channelThumbnailUrl: thumbnail, channelName: channelName, channelId: channelId }) diff --git a/src/renderer/views/Channel/Channel.vue b/src/renderer/views/Channel/Channel.vue index 23b8b3a81d8f8..395dbba1c4550 100644 --- a/src/renderer/views/Channel/Channel.vue +++ b/src/renderer/views/Channel/Channel.vue @@ -49,7 +49,7 @@

{{ formattedSubCount }} diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 70481b1054855..99e080cd73469 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -97,7 +97,7 @@ export default defineComponent({ channelName: '', channelThumbnail: '', channelId: '', - channelSubscriptionCountText: '', + channelSubCountText: '', videoPublished: 0, videoStoryboardSrc: '', dashSrc: [], @@ -357,20 +357,12 @@ export default defineComponent({ this.isUpcoming = !!result.basic_info.is_upcoming this.isLiveContent = !!result.basic_info.is_live_content - if (!this.hideChannelSubscriptions) { - const subCount = parseLocalSubscriberCount(result.secondary_info.owner.subscriber_count.text) + const subCount = parseLocalSubscriberCount(result.secondary_info.owner.subscriber_count.text) - if (!isNaN(subCount)) { - if (subCount >= 10000) { - this.channelSubscriptionCountText = formatNumber(subCount, { notation: 'compact' }) - } else { - this.channelSubscriptionCountText = formatNumber(subCount) - } - } else { - this.channelSubscriptionCountText = '' - } + if (!isNaN(subCount)) { + this.channelSubCountText = formatNumber(subCount, subCount >= 10000 ? { notation: 'compact' } : undefined) } else { - this.channelSubscriptionCountText = '' + this.channelSubCountText = '' } let chapters = [] @@ -720,6 +712,7 @@ export default defineComponent({ this.videoTitle = result.title this.videoViewCount = result.viewCount + this.channelSubCountText = result.subCountText || 'FT-0' if (this.hideVideoLikesAndDislikes) { this.videoLikeCount = null this.videoDislikeCount = null @@ -727,11 +720,7 @@ export default defineComponent({ this.videoLikeCount = result.likeCount this.videoDislikeCount = result.dislikeCount } - if (this.hideChannelSubscriptions) { - this.channelSubscriptionCountText = '' - } else { - this.channelSubscriptionCountText = result.subCountText || 'FT-0' - } + this.channelId = result.authorId this.channelName = result.author const channelThumb = result.authorThumbnails[1] diff --git a/src/renderer/views/Watch/Watch.vue b/src/renderer/views/Watch/Watch.vue index be7af4f1dcea4..ce443be05cb79 100644 --- a/src/renderer/views/Watch/Watch.vue +++ b/src/renderer/views/Watch/Watch.vue @@ -98,8 +98,8 @@ :channel-id="channelId" :channel-name="channelName" :channel-thumbnail="channelThumbnail" + :channel-sub-count-text="channelSubCountText" :published="videoPublished" - :subscription-count-text="channelSubscriptionCountText" :like-count="videoLikeCount" :dislike-count="videoDislikeCount" :view-count="videoViewCount" From 3ae3b670e57fcc9a5f94dd172be18555c67cafd0 Mon Sep 17 00:00:00 2001 From: RikThePixel Date: Thu, 22 Jun 2023 20:19:56 +0200 Subject: [PATCH 2/4] Revert naming change subscriptionCountText to channelSubCountText --- .../components/watch-video-info/watch-video-info.js | 12 ++++++------ .../components/watch-video-info/watch-video-info.vue | 2 +- src/renderer/views/Watch/Watch.js | 8 ++++---- src/renderer/views/Watch/Watch.vue | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/renderer/components/watch-video-info/watch-video-info.js b/src/renderer/components/watch-video-info/watch-video-info.js index 7db1725b2e05d..58118ec47f77c 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.js +++ b/src/renderer/components/watch-video-info/watch-video-info.js @@ -35,10 +35,6 @@ export default defineComponent({ type: String, required: true }, - channelSubCountText: { - type: String, - required: true - }, published: { type: Number, required: true @@ -47,6 +43,10 @@ export default defineComponent({ type: Number, required: true }, + subscriptionCountText: { + type: String, + required: true + }, likeCount: { type: Number, default: 0 @@ -105,11 +105,11 @@ export default defineComponent({ } }, computed: { - hideSharingActions: function () { + hideSharingActions: function() { return this.$store.getters.getHideSharingActions }, - hideUnsubscribeButton: function () { + hideUnsubscribeButton: function() { return this.$store.getters.getHideUnsubscribeButton }, diff --git a/src/renderer/components/watch-video-info/watch-video-info.vue b/src/renderer/components/watch-video-info/watch-video-info.vue index 900622ad4652c..c28b1811299aa 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.vue +++ b/src/renderer/components/watch-video-info/watch-video-info.vue @@ -35,7 +35,7 @@ :channel-id="channelId" :channel-name="channelName" :channel-thumbnail="channelThumbnail" - :subscription-count-text="channelSubCountText" + :subscription-count-text="subscriptionCountText" /> diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 99e080cd73469..3e79d34f865e7 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -97,7 +97,7 @@ export default defineComponent({ channelName: '', channelThumbnail: '', channelId: '', - channelSubCountText: '', + channelSubscriptionCountText: '', videoPublished: 0, videoStoryboardSrc: '', dashSrc: [], @@ -360,9 +360,9 @@ export default defineComponent({ const subCount = parseLocalSubscriberCount(result.secondary_info.owner.subscriber_count.text) if (!isNaN(subCount)) { - this.channelSubCountText = formatNumber(subCount, subCount >= 10000 ? { notation: 'compact' } : undefined) + this.channelSubscriptionCountText = formatNumber(subCount, subCount >= 10000 ? { notation: 'compact' } : undefined) } else { - this.channelSubCountText = '' + this.channelSubscriptionCountText = '' } let chapters = [] @@ -712,7 +712,7 @@ export default defineComponent({ this.videoTitle = result.title this.videoViewCount = result.viewCount - this.channelSubCountText = result.subCountText || 'FT-0' + this.channelSubscriptionCountText = result.subCountText || 'FT-0' if (this.hideVideoLikesAndDislikes) { this.videoLikeCount = null this.videoDislikeCount = null diff --git a/src/renderer/views/Watch/Watch.vue b/src/renderer/views/Watch/Watch.vue index ce443be05cb79..be7af4f1dcea4 100644 --- a/src/renderer/views/Watch/Watch.vue +++ b/src/renderer/views/Watch/Watch.vue @@ -98,8 +98,8 @@ :channel-id="channelId" :channel-name="channelName" :channel-thumbnail="channelThumbnail" - :channel-sub-count-text="channelSubCountText" :published="videoPublished" + :subscription-count-text="channelSubscriptionCountText" :like-count="videoLikeCount" :dislike-count="videoDislikeCount" :view-count="videoViewCount" From c43702381bb19ac12b6dce38cc2c943846c4413e Mon Sep 17 00:00:00 2001 From: RikThePixel Date: Thu, 22 Jun 2023 20:21:09 +0200 Subject: [PATCH 3/4] Use `!=` instead of `!==` for `subscriberCount` in ft-list-channel --- src/renderer/components/ft-list-channel/ft-list-channel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/ft-list-channel/ft-list-channel.js b/src/renderer/components/ft-list-channel/ft-list-channel.js index d93f42ee58bf0..c6bd7a14ba14a 100644 --- a/src/renderer/components/ft-list-channel/ft-list-channel.js +++ b/src/renderer/components/ft-list-channel/ft-list-channel.js @@ -53,7 +53,7 @@ export default defineComponent({ this.channelName = this.data.name this.id = this.data.id - this.subscriberCount = this.data.subscribers !== null ? this.data.subscribers.replace(/ subscriber(s)?/, '') : '' + this.subscriberCount = this.data.subscribers != null ? this.data.subscribers.replace(/ subscriber(s)?/, '') : '' if (this.data.videos === null) { this.videoCount = 0 From 989c73d23772afdb49776119b67206d18f4a768b Mon Sep 17 00:00:00 2001 From: RikThePixel <63408969+Rikthepixel@users.noreply.github.com> Date: Sun, 25 Jun 2023 13:07:30 +0200 Subject: [PATCH 4/4] Set subscriberCount to null if `data.subscribers` is null in ft-list-channel.js Co-authored-by: absidue <48293849+absidue@users.noreply.github.com> --- src/renderer/components/ft-list-channel/ft-list-channel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/ft-list-channel/ft-list-channel.js b/src/renderer/components/ft-list-channel/ft-list-channel.js index c6bd7a14ba14a..db21d867c1bd8 100644 --- a/src/renderer/components/ft-list-channel/ft-list-channel.js +++ b/src/renderer/components/ft-list-channel/ft-list-channel.js @@ -53,7 +53,7 @@ export default defineComponent({ this.channelName = this.data.name this.id = this.data.id - this.subscriberCount = this.data.subscribers != null ? this.data.subscribers.replace(/ subscriber(s)?/, '') : '' + this.subscriberCount = this.data.subscribers != null ? this.data.subscribers.replace(/ subscriber(s)?/, '') : null if (this.data.videos === null) { this.videoCount = 0