From f11c2ad8f96aa23aaa6fad190e06ab4b28e92a8d Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Wed, 16 Oct 2024 20:56:29 +0800 Subject: [PATCH] ! Fix no comment detection --- .../watch-video-comments.js | 31 ++++++++----------- src/renderer/views/Watch/Watch.js | 12 ------- src/renderer/views/Watch/Watch.vue | 1 - 3 files changed, 13 insertions(+), 31 deletions(-) diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.js b/src/renderer/components/watch-video-comments/watch-video-comments.js index c7d5a8f6639cf..63a1d45b692a5 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -32,10 +32,6 @@ export default defineComponent({ type: Boolean, required: true }, - forceState: { - type: String, - default: null, - }, isPostComments: { type: Boolean, default: false, @@ -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) @@ -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, () => { diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 71f0c454c2ca2..c3d1389fb86fc 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -116,7 +116,6 @@ export default defineComponent({ playNextTimeout: null, playNextCountDownIntervalId: null, infoAreaSticky: true, - commentsEnabled: true, onMountedRun: false, @@ -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 diff --git a/src/renderer/views/Watch/Watch.vue b/src/renderer/views/Watch/Watch.vue index e9c60192c8322..51cbac6dd67a0 100644 --- a/src/renderer/views/Watch/Watch.vue +++ b/src/renderer/views/Watch/Watch.vue @@ -170,7 +170,6 @@ :channel-thumbnail="channelThumbnail" :channel-name="channelName" :video-player-ready="videoPlayerLoaded" - :force-state="commentsEnabled ? null : 'noComment'" @timestamp-event="changeTimestamp" />