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

Request to get list of replies to a post returns error #98

Open
patrickmcurry opened this issue Jan 8, 2023 · 8 comments
Open

Request to get list of replies to a post returns error #98

patrickmcurry opened this issue Jan 8, 2023 · 8 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@patrickmcurry
Copy link
Contributor

It looks like the ability to get a JSON list of all replies to a post isn't working. I ran into this error trying to make my Mastodon embed tools support Shuttlecraft.

Example of the site talking to a Shuttlecraft instance:
https://patrickcurry.com/socials/mastodon/comments/#url=https://social.benbrown.com/notes/eaba2b08d487db8930f56458c5f3638f

And an example of the site talking to my Glitch Shuttlecraft instance:
https://patrickcurry.com/socials/mastodon/comments/#url=https://silky-grape-sociology.glitch.me/notes/81ce6027b1e69f81bb21332b8266c64a

Original post JSON view:
https://silky-grape-sociology.glitch.me/m/81ce6027b1e69f81bb21332b8266c64a

That JSON lists this URL to get replies:
https://silky-grape-sociology.glitch.me/m/81ce6027b1e69f81bb21332b8266c64a/replies

Requesting that URL, even with the MIME type in the request headers, results in:
Cannot GET /m/81ce6027b1e69f81bb21332b8266c64a/replies

@benbrown
Copy link
Owner

benbrown commented Jan 8, 2023

yup this is true.

@benbrown benbrown added bug Something isn't working enhancement New feature or request labels Jan 8, 2023
@patrickmcurry
Copy link
Contributor Author

I'm down to try adding this feature, if ya like @benbrown ?

@benbrown
Copy link
Owner

benbrown commented Jan 8, 2023

@patrickmcurry ok! I think you only want direct replies? Not sure what the spec says. You would do this by groveling over the index of posts which includes the inreplyto field. There is an example of this in action on the public post page.

@patrickmcurry
Copy link
Contributor Author

Code isn't pretty yet, but I made /notes/:guid/replies return JSON like so:
https://silky-grape-sociology.glitch.me/m/81ce6027b1e69f81bb21332b8266c64a/replies

And I edited my rendering code to be able to read and display it like so:
https://patrickcurry.com/socials/mastodon/comments/#url=https://silky-grape-sociology.glitch.me/notes/81ce6027b1e69f81bb21332b8266c64a

I didn't put any work into the naming or layout of the return data in JSON. Is there an ActivityPub spec for this type of "list of replies to a post"? Or should we try to mirror the Mastodon API for this (which might be good for eventual Mastodon mobile client support)?

@benbrown
Copy link
Owner

benbrown commented Jan 9, 2023

Yes, there is a prescribed format for this called "Collections" that can optionally include pagination. Take a look here:

https://github.com/benbrown/shuttlecraft/blob/main/routes/outbox.js#L15

@benbrown
Copy link
Owner

benbrown commented Jan 9, 2023

@patrickmcurry
Copy link
Contributor Author

Sounds good. Looks straightforward.

@benbrown
Copy link
Owner

@patrickmcurry how goes on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants