mastodon / mastodon

Your self-hosted, globally interconnected microblogging community
https://joinmastodon.org
GNU Affero General Public License v3.0
46.72k stars 6.89k forks source link

ActivityPub Create activity with multiple objects #19111

Open bmottershead opened 2 years ago

bmottershead commented 2 years ago

Steps to reproduce the problem

Multiple objects (that is, an array of objects) in a Create activity is valid under the W3C Activity Vocabulary recommendation.

{
"@context":"https://www.w3.org/ns/activitystreams",
"id":"https://example.org/activities/1",
"type":"Create",
"actor":"https://example.org/actors/someone",
"to":"https://mastodon.social/users/someone-else",
"object": [
 {
  "@context":"https://www.w3.org/ns/activitystreams",
  "id":"https://example.org/objects/notes/1",
  "type":"Note",
  "attributedTo":"https://example.org/actors/someone",
  "content":"<p>1/2 Hello</p>",
  "audience":"https://www.w3.org/ns/activitystreams#Public"
 },
 {
  "@context":"https://www.w3.org/ns/activitystreams",
  "id":"https://example.org/objects/notes/2",
  "type":"Note",
  "attributedTo":"https://example.org/actors/someone",
  "content":"<p>2/2 world</p>",
  "audience":"https://www.w3.org/ns/activitystreams#Public"
 }
]
}

It was suggested in discussion of another issue that such a construct might be used to implement a feature analogous to a "twitter storm".

Expected behaviour

Minimally, as a result of such a Create arriving in a Mastodon inbox, the multiple notes should be ingested as if the single Create activity were split into separate activities, each with a single Note object. Extra credit points if the Mastodon UI indicates that the two notes were in sequence, perhaps obviating the 1/2 and 2/2 in the text of the notes in the example.

Actual behaviour

Though Mastodon accepted the construct with a 202, neither Note appeared in the timeline.

Specifications

Version of Mastodon deployed on mastodon.social, Sep 3.

gabek commented 1 year ago

Another potential use case here is an external platform sending along multiple objects knowing that not all of them will be useful or handled by all recipients. For example I could send an Event object and a fallback Note object knowing that Mastodon will throw away the Event, but will be able to successfully render the simpler Note.