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

Dereference remote replies #132

Merged
merged 14 commits into from
Aug 10, 2021
Merged

Dereference remote replies #132

merged 14 commits into from
Aug 10, 2021

Conversation

tsmethurst
Copy link
Contributor

@tsmethurst tsmethurst commented Aug 10, 2021

This PR adds two things:

  1. Allow GoToSocial to dereference remote threads by searching up and down ancestors and descendants. This is performed when a new announce comes in, for instance.
  2. Allow other servers to do the same for GoToSocial, by exposing a 'replies' collection on statuses.

This PR also generally cleans up some of the federating functionality, and eliminates some code repetition where it was becoming unwieldy/silly.

A replies entry on a status now looks like this:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "first": {
    "id": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?page=true",
    "next": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?only_other_accounts=false&page=true",
    "partOf": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies",
    "type": "CollectionPage"
  },
  "id": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies",
  "type": "Collection"
}

Dereferenced, the `next` entry looks like this:

```json
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "id": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?page=true&only_other_accounts=false",
  "items": "http://localhost:8080/users/1happyturtle/statuses/01FCQSQ667XHJ9AV9T27SJJSX5",
  "next": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?only_other_accounts=false&page=true&min_id=01FCQSQ667XHJ9AV9T27SJJSX5",
  "partOf": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies",
  "type": "CollectionPage"
}

Note that items here is a string; when multiple items are added, it becomes an array. See go-fed/activity#139

@tsmethurst tsmethurst merged commit 0f2de63 into main Aug 10, 2021
@tsmethurst tsmethurst deleted the dereference_remote_replies branch August 10, 2021 11:32
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.

1 participant