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 no comment detection #5879

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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