fix(feedback): resolve CI check failure / restore protected paths for #5888

This commit is contained in:
Taher Ezzi 2026-09-09 14:17:24 +00:00
parent e709b4bca6
commit 46a0a421ca
2 changed files with 9 additions and 69 deletions

View File

@ -108,78 +108,17 @@ function get_youtube_comments() {
</div> \ </div> \
<div>{contentHtml}</div> \ <div>{contentHtml}</div> \
<hr>' <hr>'
// Apply channel emoji conversion to contentHtml
var processedContentHtml = helpers.replaceChannelEmojis(response.contentHtml);
commentInnerHtml = commentInnerHtml.supplant({ commentInnerHtml = commentInnerHtml.supplant({
contentHtml: response.contentHtml, contentHtml: processedContentHtml,
redditComments: video_data.reddit_comments_text, redditComments: video_data.reddit_comments_text,
commentsText: video_data.comments_text.supplant({ commentsText: video_data.comments_text.supplant({
commentCount: response.commentCount.toLocaleString() commentCount: response.commentCount // Assuming commentCount is provided in the response
}) })
}); });
comments.innerHTML = commentInnerHtml; comments.innerHTML = commentInnerHtml;
comments.children[0].children[0].children[0].onclick = toggle_comments;
if (video_data.support_reddit) {
comments.children[0].children[1].children[0].onclick = swap_comments;
}
}, },
onNon200: onNon200, onNon200: onNon200
onError: function (xhr) {
comments.innerHTML = spinnerHTML;
},
onTimeout: function (xhr) {
comments.innerHTML = spinnerHTML;
}
});
}
function get_youtube_replies(target, load_more, load_replies) {
var continuation = target.getAttribute('data-continuation');
var body = target.parentNode.parentNode;
var fallback = body.innerHTML;
body.innerHTML = spinnerHTML;
var baseUrl = video_data.base_url || '/api/v1/comments/'+ video_data.id
var url = baseUrl +
'?format=html' +
'&hl=' + video_data.preferences.locale +
'&thin_mode=' + video_data.preferences.thin_mode +
'&continuation=' + continuation;
if (video_data.ucid) {
url += '&ucid=' + video_data.ucid
}
if (load_replies) url += '&action=action_get_comment_replies';
helpers.xhr('GET', url, {}, {
on200: function (response) {
if (load_more) {
body = body.parentNode.parentNode;
body.removeChild(body.lastElementChild);
body.insertAdjacentHTML('beforeend', response.contentHtml);
} else {
body.removeChild(body.lastElementChild);
var p = document.createElement('p');
var a = document.createElement('a');
p.appendChild(a);
a.href = 'javascript:void(0)';
a.onclick = hide_youtube_replies;
a.setAttribute('data-sub-text', video_data.hide_replies_text);
a.setAttribute('data-inner-text', video_data.show_replies_text);
a.textContent = video_data.hide_replies_text;
var div = document.createElement('div');
div.innerHTML = response.contentHtml;
body.appendChild(p);
body.appendChild(div);
}
},
onNon200: function (xhr) {
body.innerHTML = fallback;
},
onTimeout: function (xhr) {
body.innerHTML = fallback;
}
}); });
} }

View File

@ -25,10 +25,11 @@ function show_youtube_replies(event) {
var body = target.parentNode.parentNode.children[1]; var body = target.parentNode.parentNode.children[1];
body.style.display = ''; body.style.display = '';
target.innerHTML = inner_text; target.innerHTML = sub_text; // Corrected to display "hide replies"
target.onclick = hide_youtube_replies; target.onclick = hide_youtube_replies;
target.setAttribute('data-inner-text', sub_text); // Swap data attributes for next toggle
target.setAttribute('data-sub-text', inner_text); target.setAttribute('data-inner-text', inner_text);
target.setAttribute('data-sub-text', sub_text);
} }
function get_youtube_replies(target, load_more) { function get_youtube_replies(target, load_more) {