From 8ab2b19a946251f258446d22f420d401f61d22f6 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:04:28 +0200 Subject: [feature] Federate interaction policies + Accepts; enforce policies (#3138) * [feature] Federate interaction policies + Accepts; enforce policies * use Acceptable type * fix index * remove appendIRIStrs * add GetAccept federatingdb function * lock on object IRI --- internal/typeutils/astointernal.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'internal/typeutils/astointernal.go') diff --git a/internal/typeutils/astointernal.go b/internal/typeutils/astointernal.go index cb3e320d9..2946c8d09 100644 --- a/internal/typeutils/astointernal.go +++ b/internal/typeutils/astointernal.go @@ -393,13 +393,23 @@ func (c *Converter) ASStatusToStatus(ctx context.Context, statusable ap.Statusab return nil, gtserror.SetMalformed(err) } - // Advanced visibility toggles for this status. - // - // TODO: a lot of work to be done here -- a new type - // needs to be created for this in go-fed/activity. - // Until this is implemented, assume all true. + // Status was sent to us or dereffed + // by us so it must be federated. status.Federated = util.Ptr(true) + // Derive interaction policy for this status. + status.InteractionPolicy = ap.ExtractInteractionPolicy( + statusable, + status.Account, + ) + + // Set approvedByURI if present, + // for later dereferencing. + approvedByURI := ap.GetApprovedBy(statusable) + if approvedByURI != nil { + status.ApprovedByURI = approvedByURI.String() + } + // status.Sensitive sensitive := ap.ExtractSensitive(statusable) status.Sensitive = &sensitive -- cgit v1.2.3