superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.85k stars 336 forks source link

[feature] Identifying reply control activities #3460

Open silverpill opened 1 month ago

silverpill commented 1 month ago

Is your feature request related to a problem ?

GoToSocial sends Accept (or Reject) activity when it processes a reply, but these activities look very similar to Accept(Follow) activities. Example:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "actor": "https://gts.superseriousbusiness.org/users/gotosocial",
  "cc": [
    "https://www.w3.org/ns/activitystreams#Public",
    "https://gts.superseriousbusiness.org/users/gotosocial/followers"
  ],
  "id": "https://gts.superseriousbusiness.org/users/gotosocial/accepts/123",
  "object": "https://social.example/statuses/123",
  "to": "https://social.example/users/321",
  "type": "Accept"
}

What is the recommended approach to determining the type of object of this activity?

Describe the solution you'd like.

It would be nice to have some indicator.

Option 1. Object ID can be replaced with a partial representation:

{
  "type": "Accept",
  "object": {
    "type": "Note",
    "id": "https://social.example/statuses/123"
  }
}

Then:

If Accept.object.type == Note:
  goto AcceptReply
else:
  goto AcceptFollow

Option 2. Accept activity can have a target property:

{
  "type": "Accept",
  "object": "https://social.example/statuses/123",
  "target": {
    "type": "Replies",
    "id": "https://gts.superseriousbusiness.org/statuses/123/replies",
  }
}

Describe alternatives you've considered.

Activity sub-type can be determined by object ID alone, but that requires URL path parsing or additional database queries.

Additional context.

No response

tsmethurst commented 1 month ago

Mm, we could probably do the target option (so, option 2) without causing too many difficulties, that one makes the most sense to me. That said, is "Replies" actually a type? I can't seem to find it in the specs.

silverpill commented 4 weeks ago

No, there is no such type yet. But I could formally propose it through the FEP process.

Overall, do you think this kind of type hinting with partial embeddings could be beneficial to GoToSocial? There are other cases where it can be used: Undo (are we undoing Follow or Accept?) and Add (to what collection we are adding object?).