Adding federation support to Discourse

Thanks!

The best way to think about the implementation is that it can support FEP-1b12 (aka the Lemmy implementation). The first version aims at an integration with Mastodon, so it doesn’t look like FEP-1b12. But that will be quite doable in later versions.

To get a sense of what I mean by that here’s a simple data flow model for the plugin

The AP interface is an abstracted ruby interface for ActivityPub modelled on the AP spec itself and using AP terminology. It could be packaged as a gem at some point to make it easier to integrate AP into rack projects. The simplest way to think about the current implementation is in the capability definitions for the Actor models in the AP class, i.e.

Group

def can_belong_to
  %i(category)
end

def can_perform_activity
  {
    accept: [:follow],
    reject: [:follow],
    create: [:note],
    delete: [:note]
  }
end

Person

def can_belong_to
  %i(remote)
end

def can_perform_activity
{
   follow: [:group],
   undo: [:follow]
}
end

The AP class then interacts with an abstracted data model in the plugin, i.e. “DAP Models”. That data model essentially supports any type of relationship(s) between Actors, Objects and Activities. The DAP models are then integrated with the Discourse models.

I’m giving you some context here to demonstrate that while the simplest possible integration with Mastodon was the first goal, it was designed in such a way (i.e. with sufficient separation of concerns) to make it relatively straightforward to extend the implementation to support FEP-1b12 or other interpretations of the ActivityPub spec.

3 Likes