fix leetle bug

This commit is contained in:
tobi 2025-02-19 17:30:36 +01:00
commit 215130d1f9
2 changed files with 12 additions and 6 deletions

View file

@ -401,11 +401,17 @@ func (f *federatingDB) acceptOtherIRI(
// TODO: do something with type hinting here. // TODO: do something with type hinting here.
apObjectType := ap.ObjectUnknown apObjectType := ap.ObjectUnknown
// Extract appropriate approvedByURI from the Accept.
approvedByURI, err := approvedByURI(acceptID, accept)
if err != nil {
return gtserror.NewErrorForbidden(err, err.Error())
}
// Pass to the processor and let them handle side effects. // Pass to the processor and let them handle side effects.
f.state.Workers.Federator.Queue.Push(&messages.FromFediAPI{ f.state.Workers.Federator.Queue.Push(&messages.FromFediAPI{
APObjectType: apObjectType, APObjectType: apObjectType,
APActivityType: ap.ActivityAccept, APActivityType: ap.ActivityAccept,
APIRI: acceptID, APIRI: approvedByURI,
APObject: objectIRI, APObject: objectIRI,
Receiving: receivingAcct, Receiving: receivingAcct,
Requesting: requestingAcct, Requesting: requestingAcct,

View file

@ -844,16 +844,16 @@ func (p *fediAPI) AcceptRemoteStatus(ctx context.Context, fMsg *messages.FromFed
return gtserror.Newf("%T not parseable as *url.URL", fMsg.APObject) return gtserror.Newf("%T not parseable as *url.URL", fMsg.APObject)
} }
acceptIRI := fMsg.APIRI approvedByURI := fMsg.APIRI
if acceptIRI == nil { if approvedByURI == nil {
return gtserror.New("acceptIRI was nil") return gtserror.New("approvedByURI was nil")
} }
// Assume we're accepting a status; create a // Assume we're accepting a status; create a
// barebones status for dereferencing purposes. // barebones status for dereferencing purposes.
bareStatus := &gtsmodel.Status{ bareStatus := &gtsmodel.Status{
URI: objectIRI.String(), URI: objectIRI.String(),
ApprovedByURI: acceptIRI.String(), ApprovedByURI: approvedByURI.String(),
} }
// Call RefreshStatus() to process the provided // Call RefreshStatus() to process the provided
@ -872,7 +872,7 @@ func (p *fediAPI) AcceptRemoteStatus(ctx context.Context, fMsg *messages.FromFed
} }
// No error means it was indeed a remote status, and the // No error means it was indeed a remote status, and the
// given acceptIRI permitted it. Timeline and notify it. // given approvedByURI permitted it. Timeline and notify it.
if err := p.surface.timelineAndNotifyStatus(ctx, status); err != nil { if err := p.surface.timelineAndNotifyStatus(ctx, status); err != nil {
log.Errorf(ctx, "error timelining and notifying status: %v", err) log.Errorf(ctx, "error timelining and notifying status: %v", err)
} }