mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 14:12:24 -05:00
[chore/bugfix] Refactor ap/extract.go functions, return URIs more reliably (#1897)
This commit is contained in:
parent
0fa06c0cde
commit
d8e16a226a
9 changed files with 613 additions and 428 deletions
|
|
@ -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)...)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue