Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix comment sorting when sort by newest is the default #6702

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

absidue
Copy link
Member

@absidue absidue commented Jan 31, 2025

Fix comment sorting when sort by newest is the default

Pull Request Type

  • Bugfix

Related issue

Description

On some videos the default sorting value is Newest First, at the moment we are unable to switch back to Top Comments on those videos. This pull request fixes that by matching YouTube's default sorting for each video and then using their provided parameter values for the sorting changes.

Thanks to @LuanRT for suggesting this fix.

Technical details on the problem:

The internal value for sorting by top comments is 0, however due to the way that protobuf v3 works, when YouTube.js generates the protobuf with that value, the protobuf encoder drops the sorting field as 0 is considered the default value. This isn't a problem on videos where the default sorting is top comments because then we can do default (top comments) and newest first (explicitly requested with the value 1), but when the default is newest first, our choices are default (newest first) and newest first (explicitly requested with the value 1.

Testing

Video with sort by Top Comments as the default: https://youtu.be/jNQXAC9IVRw
Video with sort by Newest First as the default: https://youtu.be/fn3KWM1kuAw

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: bfa22f4

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) January 31, 2025 22:58
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jan 31, 2025
@FreeTubeBot FreeTubeBot merged commit be4a242 into FreeTubeApp:development Feb 1, 2025
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Feb 1, 2025
@absidue absidue deleted the comment-sorting branch February 1, 2025 08:23
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Feb 1, 2025
* development:
  Translated using Weblate (Indonesian)
  Bump version number to v0.23.1
  Translated using Weblate (Portuguese (Brazil))
  Fix comment sorting when sort by newest is the default (FreeTubeApp#6702)
  ! Fix license data reading code causing some videos cannot be played (FreeTubeApp#6682)
  Translated using Weblate (Spanish)
  Update release.yml
  Update release.yml
  Bump version number to v0.23.0
  Add Creative Commons License to Description of Videos (FreeTubeApp#6614)
  Only refresh current trending tab (FreeTubeApp#6667)
  Translated using Weblate (Icelandic)
  Translated using Weblate (Chinese (Traditional Han script))
  Translated using Weblate (Arabic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Comments "Sort by" option doesn't work on some videos
5 participants