From 2916f8b35a8f1f95461698bfc4e5d11c7099c993 Mon Sep 17 00:00:00 2001 From: Preston Date: Thu, 8 Oct 2020 10:06:06 -0400 Subject: [PATCH] Allow comment sorting with the Invidious API --- .../watch-video-comments.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 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 61890fd21..ea103a0cf 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -72,7 +72,16 @@ export default Vue.extend({ handleSortChange: function (sortType) { this.sortNewest = !this.sortNewest - this.getCommentData(true) + switch (this.backendPreference) { + case 'local': + this.getCommentDataLocal(true) + break + case 'invidious': + this.isLoading = true + this.commentData = [] + this.getCommentDataInvidious(null) + break + } }, getCommentData: function (sortChanged = false) { @@ -186,7 +195,8 @@ export default Vue.extend({ resource: 'comments', id: this.id, params: { - continuation: this.nextPageToken + continuation: this.nextPageToken, + sort_by: this.sortNewest ? 'new' : 'top' } } @@ -201,7 +211,7 @@ export default Vue.extend({ } else { comment.likes = comment.likeCount } - comment.text = comment.content + comment.text = autolinker.link(comment.content) comment.dataType = 'invidious' if (typeof (comment.replies) !== 'undefined' && typeof (comment.replies.replyCount) !== 'undefined') { @@ -269,7 +279,7 @@ export default Vue.extend({ } else { comment.likes = comment.likeCount } - comment.text = comment.content + comment.text = autolinker.link(comment.content) comment.time = comment.publishedText comment.dataType = 'invidious' comment.numReplies = 0