Posting Collection/OrderedCollection to an inbox

I’m not a Mastodon developer or a Ruby programmer, but it looks intentional to me. The AP inboxes controller passes the incoming request body to the ActivityPub::ProcessingWorker which passes it to the ActivityPub::ProcessCollectionService. In that service the message is handled with:

    case @json['type']
    when 'Collection', 'CollectionPage'
      process_items @json['items']
    when 'OrderedCollection', 'OrderedCollectionPage'
      process_items @json['orderedItems']
    else
      process_items [@json]
    end

It looks to me that a single item is actually normalized to a collection for further internal processing. The process_items method looks up a handler factory for each item (Create, Follow, etc.) and then dispatches the item to that handler.

Edit: The code snippet I quoted was committed prior to the AP specification being released (Aug 2017) so maybe it was based on some evolving understanding of AP at the time. ???

2 Likes