mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@ -19,6 +19,10 @@ type privateManager interface {
|
||||
// method for the "ActivityStreamsAltitudeProperty" non-functional
|
||||
// property in the vocabulary "ActivityStreams"
|
||||
DeserializeAltitudePropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsAltitudeProperty, error)
|
||||
// DeserializeApprovedByPropertyGoToSocial returns the deserialization
|
||||
// method for the "GoToSocialApprovedByProperty" non-functional
|
||||
// property in the vocabulary "GoToSocial"
|
||||
DeserializeApprovedByPropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialApprovedByProperty, error)
|
||||
// DeserializeAttachmentPropertyActivityStreams returns the
|
||||
// deserialization method for the "ActivityStreamsAttachmentProperty"
|
||||
// non-functional property in the vocabulary "ActivityStreams"
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
type ActivityStreamsAnnounce struct {
|
||||
ActivityStreamsActor vocab.ActivityStreamsActorProperty
|
||||
ActivityStreamsAltitude vocab.ActivityStreamsAltitudeProperty
|
||||
GoToSocialApprovedBy vocab.GoToSocialApprovedByProperty
|
||||
ActivityStreamsAttachment vocab.ActivityStreamsAttachmentProperty
|
||||
ActivityStreamsAttributedTo vocab.ActivityStreamsAttributedToProperty
|
||||
ActivityStreamsAudience vocab.ActivityStreamsAudienceProperty
|
||||
@ -152,6 +153,11 @@ func DeserializeAnnounce(m map[string]interface{}, aliasMap map[string]string) (
|
||||
} else if p != nil {
|
||||
this.ActivityStreamsAltitude = p
|
||||
}
|
||||
if p, err := mgr.DeserializeApprovedByPropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialApprovedBy = p
|
||||
}
|
||||
if p, err := mgr.DeserializeAttachmentPropertyActivityStreams()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
@ -346,6 +352,8 @@ func DeserializeAnnounce(m map[string]interface{}, aliasMap map[string]string) (
|
||||
continue
|
||||
} else if k == "altitude" {
|
||||
continue
|
||||
} else if k == "approvedBy" {
|
||||
continue
|
||||
} else if k == "attachment" {
|
||||
continue
|
||||
} else if k == "attributedTo" {
|
||||
@ -675,6 +683,12 @@ func (this ActivityStreamsAnnounce) GetActivityStreamsUrl() vocab.ActivityStream
|
||||
return this.ActivityStreamsUrl
|
||||
}
|
||||
|
||||
// GetGoToSocialApprovedBy returns the "approvedBy" property if it exists, and nil
|
||||
// otherwise.
|
||||
func (this ActivityStreamsAnnounce) GetGoToSocialApprovedBy() vocab.GoToSocialApprovedByProperty {
|
||||
return this.GoToSocialApprovedBy
|
||||
}
|
||||
|
||||
// GetJSONLDId returns the "id" property if it exists, and nil otherwise.
|
||||
func (this ActivityStreamsAnnounce) GetJSONLDId() vocab.JSONLDIdProperty {
|
||||
return this.JSONLDId
|
||||
@ -712,6 +726,7 @@ func (this ActivityStreamsAnnounce) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://www.w3.org/ns/activitystreams": this.alias}
|
||||
m = this.helperJSONLDContext(this.ActivityStreamsActor, m)
|
||||
m = this.helperJSONLDContext(this.ActivityStreamsAltitude, m)
|
||||
m = this.helperJSONLDContext(this.GoToSocialApprovedBy, m)
|
||||
m = this.helperJSONLDContext(this.ActivityStreamsAttachment, m)
|
||||
m = this.helperJSONLDContext(this.ActivityStreamsAttributedTo, m)
|
||||
m = this.helperJSONLDContext(this.ActivityStreamsAudience, m)
|
||||
@ -785,6 +800,20 @@ func (this ActivityStreamsAnnounce) LessThan(o vocab.ActivityStreamsAnnounce) bo
|
||||
// Anything else is greater than nil
|
||||
return false
|
||||
} // Else: Both are nil
|
||||
// Compare property "approvedBy"
|
||||
if lhs, rhs := this.GoToSocialApprovedBy, o.GetGoToSocialApprovedBy(); lhs != nil && rhs != nil {
|
||||
if lhs.LessThan(rhs) {
|
||||
return true
|
||||
} else if rhs.LessThan(lhs) {
|
||||
return false
|
||||
}
|
||||
} else if lhs == nil && rhs != nil {
|
||||
// Nil is less than anything else
|
||||
return true
|
||||
} else if rhs != nil && rhs == nil {
|
||||
// Anything else is greater than nil
|
||||
return false
|
||||
} // Else: Both are nil
|
||||
// Compare property "attachment"
|
||||
if lhs, rhs := this.ActivityStreamsAttachment, o.GetActivityStreamsAttachment(); lhs != nil && rhs != nil {
|
||||
if lhs.LessThan(rhs) {
|
||||
@ -1342,6 +1371,14 @@ func (this ActivityStreamsAnnounce) Serialize() (map[string]interface{}, error)
|
||||
m[this.ActivityStreamsAltitude.Name()] = i
|
||||
}
|
||||
}
|
||||
// Maybe serialize property "approvedBy"
|
||||
if this.GoToSocialApprovedBy != nil {
|
||||
if i, err := this.GoToSocialApprovedBy.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialApprovedBy.Name()] = i
|
||||
}
|
||||
}
|
||||
// Maybe serialize property "attachment"
|
||||
if this.ActivityStreamsAttachment != nil {
|
||||
if i, err := this.ActivityStreamsAttachment.Serialize(); err != nil {
|
||||
@ -1837,6 +1874,11 @@ func (this *ActivityStreamsAnnounce) SetActivityStreamsUrl(i vocab.ActivityStrea
|
||||
this.ActivityStreamsUrl = i
|
||||
}
|
||||
|
||||
// SetGoToSocialApprovedBy sets the "approvedBy" property.
|
||||
func (this *ActivityStreamsAnnounce) SetGoToSocialApprovedBy(i vocab.GoToSocialApprovedByProperty) {
|
||||
this.GoToSocialApprovedBy = i
|
||||
}
|
||||
|
||||
// SetJSONLDId sets the "id" property.
|
||||
func (this *ActivityStreamsAnnounce) SetJSONLDId(i vocab.JSONLDIdProperty) {
|
||||
this.JSONLDId = i
|
||||
|
@ -135,6 +135,9 @@ type ActivityStreamsAnnounce interface {
|
||||
// GetActivityStreamsUrl returns the "url" property if it exists, and nil
|
||||
// otherwise.
|
||||
GetActivityStreamsUrl() ActivityStreamsUrlProperty
|
||||
// GetGoToSocialApprovedBy returns the "approvedBy" property if it exists,
|
||||
// and nil otherwise.
|
||||
GetGoToSocialApprovedBy() GoToSocialApprovedByProperty
|
||||
// GetJSONLDId returns the "id" property if it exists, and nil otherwise.
|
||||
GetJSONLDId() JSONLDIdProperty
|
||||
// GetJSONLDType returns the "type" property if it exists, and nil
|
||||
@ -237,6 +240,8 @@ type ActivityStreamsAnnounce interface {
|
||||
SetActivityStreamsUpdated(i ActivityStreamsUpdatedProperty)
|
||||
// SetActivityStreamsUrl sets the "url" property.
|
||||
SetActivityStreamsUrl(i ActivityStreamsUrlProperty)
|
||||
// SetGoToSocialApprovedBy sets the "approvedBy" property.
|
||||
SetGoToSocialApprovedBy(i GoToSocialApprovedByProperty)
|
||||
// SetJSONLDId sets the "id" property.
|
||||
SetJSONLDId(i JSONLDIdProperty)
|
||||
// SetJSONLDType sets the "type" property.
|
||||
|
Reference in New Issue
Block a user