Add Activity.Updated field

Per the Mastodon docs, we need to send an `updated` parameter for
`Update` activities to work correctly.
https://docs.joinmastodon.org/spec/activitypub/#supported-activities-for-statuses
This commit is contained in:
Matt Baer
2023-10-02 19:27:51 -04:00
parent e313cb0ecf
commit adbbafe3ee
+3
View File
@@ -19,6 +19,7 @@ type Activity struct {
BaseObject BaseObject
Actor string `json:"actor"` Actor string `json:"actor"`
Published time.Time `json:"published,omitempty"` Published time.Time `json:"published,omitempty"`
Updated time.Time `json:"updated,omitempty"`
To []string `json:"to,omitempty"` To []string `json:"to,omitempty"`
CC []string `json:"cc,omitempty"` CC []string `json:"cc,omitempty"`
Object *Object `json:"object"` Object *Object `json:"object"`
@@ -67,6 +68,7 @@ func NewUpdateActivity(o *Object) *Activity {
Actor: o.AttributedTo, Actor: o.AttributedTo,
Object: o, Object: o,
Published: o.Published, Published: o.Published,
Updated: o.Updated,
} }
return &a return &a
} }
@@ -107,6 +109,7 @@ func NewFollowActivity(actorIRI, followeeIRI string) *FollowActivity {
type Object struct { type Object struct {
BaseObject BaseObject
Published time.Time `json:"published,omitempty"` Published time.Time `json:"published,omitempty"`
Updated time.Time `json:"updated,omitempty"`
Summary *string `json:"summary,omitempty"` Summary *string `json:"summary,omitempty"`
InReplyTo *string `json:"inReplyTo,omitempty"` InReplyTo *string `json:"inReplyTo,omitempty"`
URL string `json:"url"` URL string `json:"url"`