From 88e80d50ad54082c1b4cb3d3f4e9fc54b4cc02f3 Mon Sep 17 00:00:00 2001 From: Samuel Casellas Date: Sat, 11 Jan 2025 13:16:26 -0500 Subject: [PATCH] Revert "Incorporate unused "unable to load comments" message": Split these changes to another PR This reverts commit 5451391502016654aa19bb3c2892e07298fe4f8f. --- assets/js/comments.js | 4 ++-- assets/js/community.js | 2 +- assets/js/watch.js | 8 +++++--- locales/en-US.json | 2 +- src/invidious/views/post.ecr | 3 --- src/invidious/views/watch.ecr | 3 --- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/assets/js/comments.js b/assets/js/comments.js index f948a3f8..6c0f7c1d 100644 --- a/assets/js/comments.js +++ b/assets/js/comments.js @@ -106,8 +106,8 @@ function get_youtube_comments() { } }, onNon200: video_data.params.comments[1] === 'youtube' - ? function (xhr) {} - : function (xhr) { comments.innerHTML = (xhr.response.error === 'Comments not found.' ? fallback.split('')[1] : fallback.split('

')[0]) }, + ? function (xhr) {} + : function (xhr) { comments.innerHTML = fallback; }, onError: function (xhr) { comments.innerHTML = spinnerHTML; }, diff --git a/assets/js/community.js b/assets/js/community.js index 9b29bbf2..32fe4ebc 100644 --- a/assets/js/community.js +++ b/assets/js/community.js @@ -72,7 +72,7 @@ function get_youtube_replies(target, load_more) { } }, onNon200: function (xhr) { - body.innerHTML = (xhr.response.error === 'Comments not found.' ? fallback.split('')[1] : fallback.split('

')[0]); + body.innerHTML = fallback; }, onTimeout: function (xhr) { console.warn('Pulling comments failed'); diff --git a/assets/js/watch.js b/assets/js/watch.js index 736cecb3..26ad138f 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -117,6 +117,10 @@ function get_reddit_comments() { '?source=reddit&format=html' + '&hl=' + video_data.preferences.locale; + var onNon200 = function (xhr) { comments.innerHTML = fallback; }; + if (video_data.params.comments[1] === 'youtube') + onNon200 = function (xhr) {}; + helpers.xhr('GET', url, {retries: 5, entity_name: ''}, { on200: function (response) { comments.innerHTML = ' \ @@ -148,9 +152,7 @@ function get_reddit_comments() { comments.children[0].children[0].children[0].onclick = toggle_comments; comments.children[0].children[1].children[0].onclick = swap_comments; }, - onNon200: video_data.params.comments[1] === 'youtube' - ? function (xhr) {} - : function (xhr) { comments.innerHTML = (xhr.response.error === 'Comments not found.' ? fallback.split('')[1] : fallback.split('

')[0]); } + onNon200: onNon200, // declared above }); } diff --git a/locales/en-US.json b/locales/en-US.json index b624ce86..c23f6bc3 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -234,7 +234,7 @@ "Deleted or invalid channel": "Deleted or invalid channel", "This channel does not exist.": "This channel does not exist.", "Could not get channel info.": "Could not get channel info.", - "Could not fetch comments": "Could not fetch comments (they may be turned off)", + "Could not fetch comments": "Could not fetch comments", "comments_view_x_replies": "View {{count}} reply", "comments_view_x_replies_plural": "View {{count}} replies", "`x` ago": "`x` ago", diff --git a/src/invidious/views/post.ecr b/src/invidious/views/post.ecr index f357999d..fb03a44c 100644 --- a/src/invidious/views/post.ecr +++ b/src/invidious/views/post.ecr @@ -21,9 +21,6 @@ <%= translate(locale, "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.") %> -

- <%= translate(locale, "Could not fetch comments") %> -

<% end %> diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 308d0021..45c58a16 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -297,9 +297,6 @@ we're going to need to do it here in order to allow for translations. <%= translate(locale, "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.") %> -

- <%= translate(locale, "Could not fetch comments") %> -

<% end %>