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 support for community post page/comments #4010

Merged

Conversation

ChunkyProgrammer
Copy link
Contributor

@ChunkyProgrammer ChunkyProgrammer commented Jul 26, 2023

Related issues:
#3635 (comment)
FreeTubeApp/FreeTube#3253

Example endpoints:
/post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56

/post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56?ucid=UCX6OQ3DkcsbYNE6H8uQQuVA
image

API Endpoints:
/api/v1/post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56?ucid=UCX6OQ3DkcsbYN

/api/v1/post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56/comments?ucid=UCX6OQ3DkcsbYNE6H8uQQuVA

Closes #1614

@ChunkyProgrammer ChunkyProgrammer requested a review from a team as a code owner July 26, 2023 17:52
@ChunkyProgrammer ChunkyProgrammer requested review from syeopite and removed request for a team July 26, 2023 17:52
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/views/post.ecr Show resolved Hide resolved
src/invidious/comments/youtube.cr Outdated Show resolved Hide resolved
@syeopite
Copy link
Member

The example you gave, /post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56?ucid=UCX6OQ3DkcsbYN, errors on request.

Title: Index out of bounds (IndexError)
Date: 2023-07-26T20:04:59Z
Route: /post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56?ucid=UCX6OQ3DkcsbYN
Version: 2023.07.26-81cbc298 @ community

Backtrace

Index out of bounds (IndexError)
  from /usr/lib/crystal/indexable.cr:89:20 in '[]'
  from src/invidious/channels/community.cr:56:16 in 'extract_channel_community:ucid:locale:format:thin_mode:hide_continuation'
  from src/invidious/channels/community.cr:52:10 in 'fetch_channel_community_post'
  from src/invidious/routes/channels.cr:207:7 in 'post'
  from src/invidious/routing.cr:130:22 in '->'
  from lib/kemal/src/kemal/route.cr:12:26 in '->'
  from src/invidious/helpers/handlers.cr:30:37 in 'process_request'
  from lib/kemal/src/kemal/route_handler.cr:17:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/websocket_handler.cr:13:14 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:212:5 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:94:12 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:145:12 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:70:5 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/ext/kemal_static_file_handler.cr:162:16 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/exception_handler.cr:8:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/logger.cr:17:35 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/init_handler.cr:12:7 in 'call'
  from /usr/lib/crystal/http/server/request_processor.cr:51:11 in 'process'
  from /usr/lib/crystal/http/server.cr:521:5 in 'handle_client'
  from /usr/lib/crystal/http/server.cr:451:5 in '->'
  from /usr/lib/crystal/fiber.cr:146:11 in 'run'
  from /usr/lib/crystal/fiber.cr:98:34 in '->'
  from ???

Copy link
Member

@SamantazFox SamantazFox left a comment

Choose a reason for hiding this comment

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

One thing I'm wondering: do a post below a video and one on the channel 's community page have the same structure?

If that's the case, then you'd could tackle #409 too!

src/invidious/channels/community.cr Show resolved Hide resolved
src/invidious/channels/community.cr Outdated Show resolved Hide resolved
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/misc.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/misc.cr Outdated Show resolved Hide resolved
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
@ChunkyProgrammer
Copy link
Contributor Author

One thing I'm wondering: do a post below a video and one on the channel 's community page have the same structure?

If that's the case, then you'd could tackle #409 too!

I think tackling 409 in this PR might overcomplicate this PR but I can look into it after this PR is merged

src/invidious/comments/youtube.cr Outdated Show resolved Hide resolved
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/misc.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/channels.cr Outdated Show resolved Hide resolved
src/invidious/views/post.ecr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/channels.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/misc.cr Outdated Show resolved Hide resolved
assets/js/comments.js Show resolved Hide resolved
simplify resolve url

remove trailing spaces

Co-Authored-By: Samantaz Fox <[email protected]>
Copy link
Member

@SamantazFox SamantazFox 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 working great! The layout is a bit weird when replies are folded and the main message might benefit from a slightly different style, but that's minor and can definitely be addressed later ^^

image

src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/views/post.ecr Outdated Show resolved Hide resolved
@ChunkyProgrammer
Copy link
Contributor Author

Did some style improvements + added the ability to view community post comments without javascript 😄

@SamantazFox SamantazFox added in-testing This feature has been deployed and is being tested ready and removed in-testing This feature has been deployed and is being tested labels Oct 1, 2023
@SamantazFox SamantazFox merged commit 60fae01 into iv-org:master Oct 7, 2023
7 checks passed
@SamantazFox
Copy link
Member

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Community - display post comments
3 participants