activitypub icon indicating copy to clipboard operation
activitypub copied to clipboard

Plan: Map ActivityPub object types to Drupal

Open nedjo opened this issue 6 years ago • 2 comments

A place to jot notes towards outlining an ActivityPub implementation.

Format:

  • ActivityPub and models (first-level bullets)
    • potential Drupal 8+ equivalents (second-level bullets)
      • examples and comments (third-level bullets)

References:

Sample ActivityPub implementations:

  • Mastodon, microblogging, "Social networking, back in your hands"
  • PeerTube, video hosting, "A free software to take back control of your videos"
  • WordPress running the IdentityPub plugin, blogging, "Your readers will be able to follow your blogposts on Mastodon and other federated platforms that support ActivityPub."
  • Write.as/WriteFreely, blogging, "WriteFreely is free and open source software for starting a minimalist, federated blog — or an entire community."

Tutorials, API documentation for specific ActivityPub implementations

The idea in this analysis is to focus mainly on Drupal core but also note some relevant Drupal 8 contributed projects.

It's not expected that any given implementation support all or even most of the extended object types below, as is made explicit in the Activity Vocabulary section on extended types:

Support for specific extended vocabulary types is expected to vary, with implementations only selecting the extended types and properties that make sense within the specific context and requirements of those applications.

What Drupal should support is not a totally simply question. The ways ActivityPub could be supported within Drupal could be viewed on a spectrum. On the one end, we have what Drupal core provides on a typical site: users posting content. On the other end would be highly specialized Drupal-based social networking platforms.

Objects that seem like good candidates for early implementation are in bold.

Activity

Activity types

Compared to Actor and Object, below, the extended types for Activity are probably the least relevant to a Drupal implementation.

Drupal storage and handling of activities is complicated by the need to support remote as well as local objects. For example, a user of a Drupal site might follow another user on the same site or an actor on a remote ActivityPub instance.

Rather than a piecemeal assortment of different Drupal modules for each type of action, it would likely be best to standardize on one or a small set with broad applicability. For example, specialized Flag types might be applied to various activity types.

  • Accept, "Indicates that the actor accepts the object."
    • A user accepts an invite per Invite
  • Add, "Indicates that the actor has added the object to the target."
  • Announce, "Indicates that the actor is calling the target's attention the object."
  • Arrive, "An IntransitiveActivity that indicates that the actor has arrived at the location."
  • Block, "Indicates that the actor is blocking the object."
  • Create, "Indicates that the actor has created the object."
    • Entity create
  • Delete, "Indicates that the actor has deleted the object."
    • Entity delete
  • Dislike, "Indicates that the actor dislikes the object."
    • See Like, below.
  • Flag, "Indicates that the actor is "flagging" the object. Flagging is defined in the sense common to many social platforms as reporting content as being inappropriate for any number of reasons."
    • Flag with the Flag module
  • Follow, "Indicates that the actor is "following" the object."
  • Ignore, "Indicates that the actor is ignoring the object."
  • Invite, "A specialization of Offer in which the actor is extending an invitation for the object to the target. "
  • Join, "Indicates that the actor has joined the object."
    • A user joins a group (Group or Organic Groups).
  • Leave, "Indicates that the actor has left the object."
    • A user joins a group (Group or Organic Groups).
  • Like, "Indicates that the actor likes, recommends or endorses the object."
  • Listen, "Indicates that the actor has listened to the object."
  • Move, "Indicates that the actor has moved object from origin to target."
  • Offer, "Indicates that the actor is offering the object."
  • Question, "Represents a question being asked."
  • Reject, "Indicates that the actor is rejecting the object."
    • See Accept, above.
  • Read, "Indicates that the actor has read the object."
  • Remove, "Indicates that the actor is removing the object."
  • TentativeReject, " A specialization of Reject in which the rejection is considered tentative. "
  • TentativeAccept, " A specialization of Accept indicating that the acceptance is tentative. "
  • Travel, "Indicates that the actor is traveling to target from origin."
  • Undo, "Indicates that the actor is undoing the object."
  • Update, "Indicates that the actor has updated the object"
    • Entity update
  • View, "Indicates that the actor has viewed the object. "

Actor

Actor types

  • Application, "Describes a software application."
    • Drupal core
    • A specific Drupal distribution that ships with ActivityPub integration, as captured in the distribution.name property of a profile's *.info.yml file.
  • Group, "Represents a formal or informal collective of Actors."
  • Organization, "Represents an organization."
    • The organization behind a site, possibly captured in the system.site configuration item's name property.
  • Person, "Represents an individual person."
    • A user entity.
    • A node entity of a type associated with people (example: a person content type).
    • A contact in a Drupal-linked CRM.
  • Service, "Represents a service of any kind."

Object

Object types

ActivityPub object types will generally map to Drupal content entity types.

  • Article, "Represents any kind of multi-paragraph written work."
    • Content type (node entity bundle) with (at least) a field of type text_long, text_with_summary, or string_long.
      • Example: article node type that ships with core's standard install profile.
      • Challenges include:
        • Required CSS/JS. Can be added via context per https://www.w3.org/TR/activitystreams-core/#h-example-3context but
        • The ActivityPub source property won't mix easily with the various filters typically in place in a Drupal text format. For example, even if a text filter is using Markdown via the contrib Markdown module, it's likely that other filters in place will be Drupal-specific, such as media embed filters.
        • While technically appropriate for long-form textual items, the Article type has limited support in some existing ActivityPub implementations. Reportedly, in Mastodon, while Note text is shown in full, Article text doesn't appear but only a link.
  • Audio, "Represents an audio document of any kind."
    • Media type (media entity bundle) using the AudioFile source plugin.
      • Example: audio media type that ships with core's standard install profile.
  • Document, "Represents a document of any kind. "
  • Event, "Represents any kind of event."
  • Image, "An image document of any kind."
  • Note, "Represents a short written work typically less than a single paragraph in length."
  • Page, "Represents a Web Page."
  • Place, "Represents a logical or physical location."
  • Profile, "A Profile is a content object that describes another Object, typically used to describe Actor Type objects."
    • A user entity with a field of type text_long or similar.
    • A Profile module record.
  • Relationship, "Describes a relationship between two individuals."
  • Tombstone
    • Would need something like Entity Delete Log, but no D8 version yet; see https://www.drupal.org/project/entity_delete_log/issues/2922764. Or would need to store deletions in our own entity type or similar.
  • Video

Links

Link types

  • Mention, "A specialized Link that represents an @mention."
    • A mention action as invoked by the Mentions module

nedjo avatar Dec 20 '19 20:12 nedjo

Join, "Indicates that the actor has joined the object." A user joins a group (Group or Organic Groups).

I'll already throw this one in here. One of the systems I'm looking to integrate with also implements join, but as I understand it to mean much the same as RSVP, you are joining an Event object. Which makes complete sense as both actor and target of the action are any Activity Vocabulary objects.

This is the fixture they're using for testing: https://framagit.org/framasoft/mobilizon/blob/master/test/fixtures/mobilizon-join-activity.json (the rest of the fixtures there are also helpful examples I've found).

ekes avatar Jan 11 '20 13:01 ekes

I'll already throw this one in here. One of the systems I'm looking to integrate with also implements join, but as I understand it to mean much the same as RSVP, you are joining an Event object. Which makes complete sense as both actor and target of the action are any Activity Vocabulary objects.

Ha! And there's an RSVP they could use in the spec I notice while writing all this up.

Incidentally more fixtures that are good to get an idea of what is out there:- https://framagit.org/framasoft/mobilizon/blob/master/test/fixtures https://git.pleroma.social/pleroma/pleroma/tree/develop/test/fixtures Sadly not found anything so handy for PeerTube, PixelFed, or Friendica.

ekes avatar Jan 11 '20 14:01 ekes