Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
34 changes: 23 additions & 11 deletions src/renderer/components/CommentSection/CommentSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@
v-else-if="showComments && !isLoading"
>
<h3
v-if="isPostComments"
v-if="areCommentsDisabled"
class="noCommentMsg"
>
{{ $t("Comments.Comments are turned off") }}
</h3>
<h3
v-else-if="isPostComments"
class="noCommentMsg"
>
{{ $t("Comments.There are no comments available for this post") }}
Expand Down Expand Up @@ -166,6 +172,7 @@ function onTimestamp(timestamp) {
const isLoading = ref(false)
const isMoreCommentsLoading = ref(false)
const showComments = ref(false)
const areCommentsDisabled = ref(false)
const nextPageToken = shallowRef(null)

/** @type {import('vue').ShallowRef<import('../FtComment/FtComment.vue').Comment[]>} */
Expand Down Expand Up @@ -250,11 +257,13 @@ function handleSortChange() {
sortNewest.value = !sortNewest.value
commentData.value = []
nextPageToken.value = null
areCommentsDisabled.value = false
getCommentData()
Comment thread
caetano-dev marked this conversation as resolved.
}

function getCommentData() {
isLoading.value = true
areCommentsDisabled.value = false

if (!process.env.SUPPORTS_LOCAL_API || backendPreference.value === 'invidious') {
if (!props.isPostComments) {
Expand Down Expand Up @@ -326,19 +335,16 @@ async function getCommentDataLocal(more = false) {
isLoading.value = false
showComments.value = true
} catch (err) {
// region No comment detection
// No comment related info when video info requested earlier in parent component
if (err.message.includes('The comments page did not have any content')) {
// For videos without any comment (comment disabled?)
// e.g. https://youtu.be/8NBSwDEf8a8
if (err?.message?.includes('The comments page did not have any content')) {
Comment thread
caetano-dev marked this conversation as resolved.
Outdated
commentData.value = []
nextPageToken.value = null
isLoading.value = false
showComments.value = true
areCommentsDisabled.value = true
localCommentsInstance = undefined
return
}
// endregion No comment detection

console.error(err)
const errorMessage = t('Local API Error (Click to copy)')
Expand Down Expand Up @@ -372,18 +378,15 @@ async function getCommentDataInvidious() {
isLoading.value = false
showComments.value = true
} catch (err) {
// region No comment detection
// No comment related info when video info requested earlier in parent component
if (err.message.includes('Comments not found')) {
// For videos without any comment (comment disabled?)
// e.g. https://youtu.be/8NBSwDEf8a8
if (err?.message?.includes('Comments not found')) {
commentData.value = []
nextPageToken.value = null
isLoading.value = false
showComments.value = true
areCommentsDisabled.value = true
return
}
// endregion No comment detection

console.error(err)
const errorMessage = t('Invidious API Error (Click to copy)')
Expand Down Expand Up @@ -413,6 +416,15 @@ async function getPostCommentsInvidious() {
isLoading.value = false
showComments.value = true
} catch (err) {
if (err?.message?.includes('Comments not found')) {
commentData.value = []
nextPageToken.value = null
isLoading.value = false
showComments.value = true
areCommentsDisabled.value = true
return
}

console.error(err)
const errorMessage = t('Invidious API Error (Click to copy)')
showToast(`${errorMessage}: ${err}`, 10000, () => {
Expand Down
1 change: 1 addition & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,7 @@ Comments:
There are no comments available for this video: There are no comments available
for this video
There are no comments available for this post: There are no comments available for this post
Comments are turned off: Comments are turned off
Load More Comments: Load More Comments
Pinned by: Pinned by
Member: Member
Expand Down