From 754b7be9cfd3f50e6e219177cdd4c992a2d9c38f Mon Sep 17 00:00:00 2001 From: tobi Date: Sun, 14 Sep 2025 15:37:35 +0200 Subject: [feature] Support new model of interaction flow for forward compat with v0.21.0 (#4394) ~~Still WIP!~~ This PR allows v0.20.0 of GtS to be forward-compatible with the interaction request / authorization flow that will fully replace the current flow in v0.21.0. Basically, this means we need to recognize LikeRequest, ReplyRequest, and AnnounceRequest, and in response to those requests, deliver either a Reject or an Accept, with the latter pointing towards a LikeAuthorization, ReplyAuthorization, or AnnounceAuthorization, respectively. This can then be used by the remote instance to prove to third parties that the interaction has been accepted by the interactee. These Authorization types need to be dereferencable to third parties, so we need to serve them. As well as recognizing the above "polite" interaction request types, we also need to still serve appropriate responses to "impolite" interaction request types, where an instance that's unaware of interaction policies tries to interact with a post by sending a reply, like, or boost directly, without wrapping it in a WhateverRequest type. Doesn't fully close https://codeberg.org/superseriousbusiness/gotosocial/issues/4026 but gets damn near (just gotta update the federating with GtS documentation). Migrations tested on both Postgres and SQLite. Co-authored-by: kim Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4394 Co-authored-by: tobi Co-committed-by: tobi --- internal/db/interaction.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'internal/db/interaction.go') diff --git a/internal/db/interaction.go b/internal/db/interaction.go index 4a6ec7e2e..9b45a6ab4 100644 --- a/internal/db/interaction.go +++ b/internal/db/interaction.go @@ -28,12 +28,17 @@ type Interaction interface { // GetInteractionRequestByID gets one request with the given id. GetInteractionRequestByID(ctx context.Context, id string) (*gtsmodel.InteractionRequest, error) - // GetInteractionRequestByID gets one request with the given interaction uri. - GetInteractionRequestByInteractionURI(ctx context.Context, uri string) (*gtsmodel.InteractionRequest, error) + // GetInteractionRequestByID gets one request with the given interaction + // uri (ie., the URI of the requested like, reply, or announce). + GetInteractionRequestByInteractionURI(ctx context.Context, intURI string) (*gtsmodel.InteractionRequest, error) - // GetInteractionRequestByURI returns one accepted or rejected - // interaction request with the given URI, if it exists in the db. - GetInteractionRequestByURI(ctx context.Context, uri string) (*gtsmodel.InteractionRequest, error) + // GetInteractionRequestByResponseURI returns one accepted or rejected + // interaction request with the given Accept or Reject URI. + GetInteractionRequestByResponseURI(ctx context.Context, respURI string) (*gtsmodel.InteractionRequest, error) + + // GetInteractionRequestByAuthorizationURI returns one accepted + // interaction request with the given authorization URI. + GetInteractionRequestByAuthorizationURI(ctx context.Context, authURI string) (*gtsmodel.InteractionRequest, error) // PopulateInteractionRequest ensures that the request's struct fields are populated. PopulateInteractionRequest(ctx context.Context, request *gtsmodel.InteractionRequest) error -- cgit v1.2.3