Do not add paragraph tags to the summary

Created on 21 March 2023, almost 2 years ago
Updated 22 March 2023, almost 2 years ago

Problem/Motivation

Mastodon prints html tags, or at the very least p tags. While it makes sense to use text formatters that include html in the content of a post, it might not make sense for the summary to share the same configuration. By default, the Activity Pub text format has enabled "Convert line breaks into HTML (i.e.
and

)", meaning that those p tags appear in the content of my posts despite not having been added to the field. Meanwhile, the content also gets these p tags, but Mastodon is expecting them and reads them properly.

Steps to reproduce

  • Configure the Note ActivityPub type with field mappings and a content type, and enable Activity Pub for your user
  • Follow the ActivityPub user you created on the Drupal site
  • Edit a content node and select Note in the create field under ActivityPub outbox (and save node to create a new activitypub)
  • Run cron to process the newly created activity
  • View this ActivityPub user's posts on Mastodon and see the p tags around the summary, but not the content
  • View this ActivityPub user's posts in the Drupal site's API and see the p tags around both content and summary (as expected). This can be found at /user/{uid}/activitypub/Portside/outbox?page=0 where uid is the id of the Drupal user associated with the activity pub actor

Proposed resolution

There are a few options:

  1. Allow fields to use their own text format by setting ActivityPub format to "none" or "use field's"
  2. Have independent text format configs for the summary and content fields, ideally working while including the above option "use field's"

Remaining tasks

User interface changes

A new option and an extra field:

The annotations above are just a quick sketch, and I do not mean to indicate that the fields should be inline.

If $this->configFactory->get('activitypub.settings')->get('filter_format') is set to "use field", then line 232 in src/Services/Type/TypePluginBase.php will use the format indicated on the field's own settings found in $value[0]["format"]. Of course content and summary might not share this same case anymore.

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States MegaKeegMan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024