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

Fix Hide Channel Subscribers setting still displaying subscribers if changed from a secondary window (#3504) #3692

Merged
merged 4 commits into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 3 additions & 10 deletions src/renderer/components/ft-list-channel/ft-list-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)?/, '') : ''
Rikthepixel marked this conversation as resolved.
Show resolved Hide resolved

if (this.data.videos === null) {
this.videoCount = 0
} else {
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</router-link>
<div class="infoLine">
<span
v-if="subscriberCount !== null"
v-if="subscriberCount !== null && !hideChannelSubscriptions"
class="subscriberCount"
>
{{ subscriberCount }} subscribers -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions src/renderer/views/Channel/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 })
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Channel/Channel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</h1>

<p
v-if="subCount !== null"
v-if="subCount !== null && !hideChannelSubscriptions"
class="channelSubCount"
>
{{ formattedSubCount }}
Expand Down
21 changes: 5 additions & 16 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,10 @@ 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.channelSubscriptionCountText = formatNumber(subCount, subCount >= 10000 ? { notation: 'compact' } : undefined)
} else {
this.channelSubscriptionCountText = ''
}
Expand Down Expand Up @@ -720,18 +712,15 @@ export default defineComponent({

this.videoTitle = result.title
this.videoViewCount = result.viewCount
this.channelSubscriptionCountText = result.subCountText || 'FT-0'
if (this.hideVideoLikesAndDislikes) {
this.videoLikeCount = null
this.videoDislikeCount = null
} else {
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]
Expand Down