mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-14 19:43:02 -06:00
[feature] Accept incoming federated Flag activity (#1382)
* start working on handling incoming Flag activity * interim commit * federate Flag in successfully
This commit is contained in:
parent
faeb7ded3b
commit
993aae5e48
11 changed files with 560 additions and 50 deletions
|
|
@ -635,6 +635,23 @@ func ExtractObject(i WithObject) (*url.URL, error) {
|
|||
return nil, errors.New("no iri found for object prop")
|
||||
}
|
||||
|
||||
// ExtractObjects extracts a slice of URL objects from a WithObject interface.
|
||||
func ExtractObjects(i WithObject) ([]*url.URL, error) {
|
||||
objectProp := i.GetActivityStreamsObject()
|
||||
if objectProp == nil {
|
||||
return nil, errors.New("object property was nil")
|
||||
}
|
||||
|
||||
urls := make([]*url.URL, 0, objectProp.Len())
|
||||
for iter := objectProp.Begin(); iter != objectProp.End(); iter = iter.Next() {
|
||||
if iter.IsIRI() && iter.GetIRI() != nil {
|
||||
urls = append(urls, iter.GetIRI())
|
||||
}
|
||||
}
|
||||
|
||||
return urls, nil
|
||||
}
|
||||
|
||||
// ExtractVisibility extracts the gtsmodel.Visibility of a given addressable with a To and CC property.
|
||||
//
|
||||
// ActorFollowersURI is needed to check whether the visibility is FollowersOnly or not. The passed-in value
|
||||
|
|
|
|||
|
|
@ -157,6 +157,16 @@ type CollectionPageable interface {
|
|||
WithItems
|
||||
}
|
||||
|
||||
// Flaggable represents the minimum interface for an activitystreams 'Flag' activity.
|
||||
type Flaggable interface {
|
||||
WithJSONLDId
|
||||
WithTypeName
|
||||
|
||||
WithActor
|
||||
WithContent
|
||||
WithObject
|
||||
}
|
||||
|
||||
// WithJSONLDId represents an activity with JSONLDIdProperty
|
||||
type WithJSONLDId interface {
|
||||
GetJSONLDId() vocab.JSONLDIdProperty
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue