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

Add ability to see comment replies of community posts through invidious #5589

Conversation

ChunkyProgrammer
Copy link
Member

Add ability to see comment replies of community posts through invidious

Pull Request Type

  • Feature Implementation

Related issue

#3253 (invidious only)

Description

This PR will allow for viewing community posts and their comments through FreeTube when using the Invidious API

Screenshots

  • Community tab (notice that the icon for the comments is a different color now since it's a link)
    image

  • community post page
    image

  • community post page with comments
    image

Testing

Channel Page:

  • go to a channel (with invidious enabled/backend fallback)

  • click community tab

  • click "comments" icon

  • go to post page

  • go to a channel (with local api enabled + no backend fallback)

  • click community tab

  • comments icon not clickable

Direct link

Comments

  • view comments
  • load replies
  • load more replies
  • load more comments

Desktop

  • OS: Linux Mint
  • OS Version: 22 Cinnamon
  • FreeTube version: latest nightly

Additional context

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Aug 19, 2024
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) August 19, 2024 23:40
Copy link
Member

@absidue absidue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial code review with a few small comments.

src/renderer/views/Post/Post.vue Outdated Show resolved Hide resolved
@absidue
Copy link
Member

absidue commented Aug 28, 2024

Fetching comments seems to be broken when the preferred API backend is set to the local API and backend fallback is enabled:
no-comments-error

Switching the preferred backend to the Invidious API fetches the comments correctly.

@absidue
Copy link
Member

absidue commented Aug 28, 2024

If I take your example URL and replace the domain with www.youtube.com, I get redirected to here https://www.youtube.com/channel/UCRELfrtyz_teOEQXjF04BIA/community?lb=UgkxhcOTXqzOaLBHfCQ-_-6JxsdydwSeFTei. It would be great if this URL format were supported too, as all the information that is needed is already there (channel ID and post ID).

Can probably be handled by adding an if-else that checks for the lb query parameter inside the community case inside the existing channel URL parsing.

@absidue absidue added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Aug 28, 2024
@ChunkyProgrammer ChunkyProgrammer force-pushed the add-ability-to-see-community-post-replies branch from c5c86cb to 8597175 Compare August 29, 2024 02:11
@ChunkyProgrammer ChunkyProgrammer added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: changes requested labels Aug 29, 2024
@PikachuEXE
Copy link
Collaborator

Auto Load Next Page doesn't work on these?

@ChunkyProgrammer
Copy link
Member Author

Auto Load Next Page doesn't work on these?

Should work now

absidue
absidue previously approved these changes Aug 30, 2024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments is 0 when user is on the page of the post

VirtualBoxVM_RuRAnUS8Cn.mp4

Not sure if this is possible but maybe worth pointing out. On YT users can go to the post by clicking on the post image or clicking on the comments icon. Should we also implement clicking on the post to go to the post page?

firefox_pgPpCyUbsm.mp4

@ChunkyProgrammer
Copy link
Member Author

ChunkyProgrammer commented Sep 2, 2024

Comments is 0 when user is on the page of the post
VirtualBoxVM_RuRAnUS8Cn.mp4

Not sure if this is possible but maybe worth pointing out. On YT users can go to the post by clicking on the post image or clicking on the comments icon. Should we also implement clicking on the post to go to the post page?
firefox_pgPpCyUbsm.mp4

  • I've hidden the comment count on the post page (we can only get the comment count once comments are fetched)
  • I'm not sure about making it bring you to the post page when you click an image attachment since it's not consistent with other attachments (clicking a video brings you to the video, clicking a playlist brings you to a playlist, etc.)

@efb4f5ff-1298-471a-8973-3d47447115dc

I've hidden the comment count on the post page (we can only get the comment count once comments are fetched)

Could you elaborate some more on this? I dont understand why we need to hide it when the data was already provided before the user went into the post

@absidue
Copy link
Member

absidue commented Sep 2, 2024

It currently makes another API request to fetch the post regardless of whether you clicked on an existing post or pasted in a link to a post, YouTube doesn't seem to have that information on the post page either (well it's in the comments section not the post body there), so maybe it's not in the API response for the post.

One potential workaround would be to implement something similar to what FreeTube currently does for playlists, where if you go from the playlist page to the watch page, it saves the playlist in the store and then retrieves it again on the watch page. That would avoid one API request and make it possible to show the comment count, of course only if the user got to the post from somewhere else in the app, if you paste in a link it would still have to make the API request and wouldn't have the comment count.

Copy link
Member

@absidue absidue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken another look at this and have two small code nits, as well as a suggestion to pass the channel ID along in the URL when the user clicks the comment icon, as that lets us avoid the API request to get the channel ID.

src/renderer/helpers/api/invidious.js Outdated Show resolved Hide resolved
src/renderer/helpers/api/invidious.js Outdated Show resolved Hide resolved
Copy link
Member

@absidue absidue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my last review comment, everything else looks great.

src/renderer/views/Post/Post.vue Outdated Show resolved Hide resolved
@ChunkyProgrammer ChunkyProgrammer force-pushed the add-ability-to-see-community-post-replies branch from 4eaf982 to 3f00a8b Compare September 9, 2024 16:56
Co-Authored-By: absidue <48293849+absidue@users.noreply.github.com>
absidue
absidue previously approved these changes Sep 9, 2024
@PikachuEXE
Copy link
Collaborator

Found a bug, if I am viewing comment for a post (IV API)
And I paste https://yt.artemislena.eu/post/UgkxhcOTXqzOaLBHfCQ-_-6JxsdydwSeFTei and hit enter the page won't change

@FreeTubeBot FreeTubeBot merged commit 21ff6fe into FreeTubeApp:development Sep 12, 2024
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 Sep 12, 2024
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Sep 12, 2024
* development: (24 commits)
  Add ability to see comment replies of community posts through invidious (FreeTubeApp#5589)
  Bump electron-builder from 24.13.3 to 25.0.5 (FreeTubeApp#5674)
  Change Sponsorblock Default Category Colors (FreeTubeApp#5686)
  Proxy live streams when "Proxy Videos Through Invidious" is enabled (FreeTubeApp#5649)
  Translated using Weblate (Belarusian)
  Translated using Weblate (Hebrew)
  Fix saving Invidious thumbnail URLs for subscriptions (FreeTubeApp#5662)
  Bump peter-evans/create-pull-request from 6 to 7 (FreeTubeApp#5676)
  Bump webpack-dev-server from 5.0.4 to 5.1.0 (FreeTubeApp#5672)
  Use auto-generated playlists for the videos tab on artist topic channels (FreeTubeApp#5661)
  Rewrite locale file updating to be more Vue 3 friendly (FreeTubeApp#5660)
  Bump sass from 1.77.8 to 1.78.0 (FreeTubeApp#5673)
  Bump electron from 32.0.1 to 32.0.2 (FreeTubeApp#5671)
  Bump marked from 14.1.0 to 14.1.2 (FreeTubeApp#5670)
  Bump postcss from 8.4.44 to 8.4.45 in the stylelint group (FreeTubeApp#5669)
  Bump the eslint group with 2 updates (FreeTubeApp#5668)
  Cleanup a few vue-i18n usages (FreeTubeApp#5663)
  Use nextTick instead of setTimeout to wait until Vue has rendered changes (FreeTubeApp#5664)
  Translated using Weblate (Estonian)
  Translated using Weblate (Belarusian)
  ...

# Conflicts:
#	src/renderer/components/ft-community-post/ft-community-post.js
#	src/renderer/helpers/api/local.js
@ChunkyProgrammer ChunkyProgrammer deleted the add-ability-to-see-community-post-replies branch October 8, 2024 02:51
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.

5 participants