Skip to content

Commit

Permalink
! Fix no comment detection
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Oct 16, 2024
1 parent 21e8351 commit d58978a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ export default defineComponent({
type: Boolean,
required: true
},
forceState: {
type: String,
default: null,
},
isPostComments: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -145,20 +141,6 @@ export default defineComponent({
return this.$store.getters.getActiveProfile.subscriptions
}
},
created: function () {
// region No comment detection
// For videos without any comment (comment disabled?)
// e.g. https://youtu.be/8NBSwDEf8a8
//
// `comments_entry_point_header` is null probably when comment disabled
if (this.forceState === 'noComment') {
this.commentData = []
this.nextPageToken = null
this.isLoading = false
this.showComments = true
}
// endregion No comment detection
},
methods: {
onTimestamp: function (timestamp) {
this.$emit('timestamp-event', timestamp)
Expand Down Expand Up @@ -255,6 +237,19 @@ export default defineComponent({
this.isLoading = false
this.showComments = true
} catch (err) {
// region No comment detection
// No comment related info when video info requested earlier in parent component
if (err.message.includes('Comments page did not have any content')) {
// For videos without any comment (comment disabled?)
// e.g. https://youtu.be/8NBSwDEf8a8
this.commentData = []
this.nextPageToken = null
this.isLoading = false
this.showComments = true
return
}
// endregion No comment detection

console.error(err)
const errorMessage = this.$t('Local API Error (Click to copy)')
showToast(`${errorMessage}: ${err}`, 10000, () => {
Expand Down
12 changes: 0 additions & 12 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export default defineComponent({
playNextTimeout: null,
playNextCountDownIntervalId: null,
infoAreaSticky: true,
commentsEnabled: true,

onMountedRun: false,

Expand Down Expand Up @@ -486,17 +485,6 @@ export default defineComponent({
this.liveChat = null
}

// region No comment detection
// For videos without any comment (comment disabled?)
// e.g. https://youtu.be/8NBSwDEf8a8
//
// `comments_entry_point_header` is null probably when comment disabled
// e.g. https://youtu.be/8NBSwDEf8a8
// However videos with comments enabled but have no comment
// are different (which is not detected here)
this.commentsEnabled = result.comments_entry_point_header != null
// endregion No comment detection

if ((this.isLive || this.isPostLiveDvr) && !this.isUpcoming) {
let useRemoteManifest = true

Expand Down
1 change: 0 additions & 1 deletion src/renderer/views/Watch/Watch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
:channel-thumbnail="channelThumbnail"
:channel-name="channelName"
:video-player-ready="videoPlayerLoaded"
:force-state="commentsEnabled ? null : 'noComment'"
@timestamp-event="changeTimestamp"
/>
</div>
Expand Down

0 comments on commit d58978a

Please sign in to comment.