diff options
Diffstat (limited to 'internal/federation')
| -rw-r--r-- | internal/federation/dereferencing/status.go | 4 | ||||
| -rw-r--r-- | internal/federation/federatingdb/announce.go | 9 | ||||
| -rw-r--r-- | internal/federation/federatingprotocol.go | 20 | 
3 files changed, 12 insertions, 21 deletions
| diff --git a/internal/federation/dereferencing/status.go b/internal/federation/dereferencing/status.go index e4ecee639..11d6d7147 100644 --- a/internal/federation/dereferencing/status.go +++ b/internal/federation/dereferencing/status.go @@ -239,8 +239,8 @@ func (d *deref) enrichStatus(ctx context.Context, requestUser string, uri *url.U  		derefd = true  	} -	// Get the attributed-to status in order to fetch profile. -	attributedTo, err := ap.ExtractAttributedTo(apubStatus) +	// Get the attributed-to account in order to fetch profile. +	attributedTo, err := ap.ExtractAttributedToURI(apubStatus)  	if err != nil {  		return nil, nil, gtserror.New("attributedTo was empty")  	} diff --git a/internal/federation/federatingdb/announce.go b/internal/federation/federatingdb/announce.go index ab230cdfb..0246cff7c 100644 --- a/internal/federation/federatingdb/announce.go +++ b/internal/federation/federatingdb/announce.go @@ -19,11 +19,11 @@ package federatingdb  import (  	"context" -	"fmt"  	"codeberg.org/gruf/go-logger/v2/level"  	"github.com/superseriousbusiness/activity/streams/vocab"  	"github.com/superseriousbusiness/gotosocial/internal/ap" +	"github.com/superseriousbusiness/gotosocial/internal/gtserror"  	"github.com/superseriousbusiness/gotosocial/internal/log"  	"github.com/superseriousbusiness/gotosocial/internal/messages"  ) @@ -46,15 +46,16 @@ func (f *federatingDB) Announce(ctx context.Context, announce vocab.ActivityStre  	boost, isNew, err := f.typeConverter.ASAnnounceToStatus(ctx, announce)  	if err != nil { -		return fmt.Errorf("Announce: error converting announce to boost: %s", err) +		return gtserror.Newf("error converting announce to boost: %w", err)  	}  	if !isNew { -		// nothing to do here if this isn't a new announce +		// We've already seen this boost; +		// nothing else to do here.  		return nil  	} -	// it's a new announce so pass it back to the processor async for dereferencing etc +	// This is a new boost. Process side effects asynchronously.  	f.state.Workers.EnqueueFederator(ctx, messages.FromFederator{  		APObjectType:     ap.ActivityAnnounce,  		APActivityType:   ap.ActivityCreate, diff --git a/internal/federation/federatingprotocol.go b/internal/federation/federatingprotocol.go index 18feb2429..ec74de097 100644 --- a/internal/federation/federatingprotocol.go +++ b/internal/federation/federatingprotocol.go @@ -110,15 +110,10 @@ func (f *federator) PostInboxRequestBodyHook(ctx context.Context, r *http.Reques  		}  	} -	// Check for TOs and CCs on the Activity. +	// Check for TO and CC URIs on the Activity.  	if addressable, ok := activity.(ap.Addressable); ok { -		if toURIs, err := ap.ExtractTos(addressable); err == nil { -			otherIRIs = append(otherIRIs, toURIs...) -		} - -		if ccURIs, err := ap.ExtractCCs(addressable); err == nil { -			otherIRIs = append(otherIRIs, ccURIs...) -		} +		otherIRIs = append(otherIRIs, ap.ExtractToURIs(addressable)...) +		otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...)  	}  	// Now perform the same checks, but for the Object(s) of the Activity. @@ -146,13 +141,8 @@ func (f *federator) PostInboxRequestBodyHook(ctx context.Context, r *http.Reques  		}  		if addressable, ok := t.(ap.Addressable); ok { -			if toURIs, err := ap.ExtractTos(addressable); err == nil { -				otherIRIs = append(otherIRIs, toURIs...) -			} - -			if ccURIs, err := ap.ExtractCCs(addressable); err == nil { -				otherIRIs = append(otherIRIs, ccURIs...) -			} +			otherIRIs = append(otherIRIs, ap.ExtractToURIs(addressable)...) +			otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...)  		}  	} | 
