From 2ca491f28b44f5bc485578129b658ca36e5c65b2 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Wed, 18 Mar 2026 00:24:35 +0100 Subject: [PATCH] fix: wire content-warning property for CW text Updated jf2-to-as2 and compose controller to use the renamed "content-warning" property instead of overloading "summary" for CW text. This pairs with the endpoint-posts fix that renamed the CW form input to prevent collision with the summary field. Confab-Link: http://localhost:8080/sessions/1dcdf030-8015-4d23-89da-b43fd69c7138 --- lib/controllers/compose.js | 2 +- lib/jf2-to-as2.js | 12 +++++++++--- package.json | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/controllers/compose.js b/lib/controllers/compose.js index d3e4c5e..ea8135b 100644 --- a/lib/controllers/compose.js +++ b/lib/controllers/compose.js @@ -216,7 +216,7 @@ export function submitComposeController(mountPath, plugin) { } if (cwEnabled && summary && summary.trim()) { - micropubData.append("summary", summary.trim()); + micropubData.append("content-warning", summary.trim()); micropubData.append("sensitive", "true"); } diff --git a/lib/jf2-to-as2.js b/lib/jf2-to-as2.js index c87726e..a5a22c2 100644 --- a/lib/jf2-to-as2.js +++ b/lib/jf2-to-as2.js @@ -171,6 +171,12 @@ export function jf2ToActivityStreams(properties, actorUrl, publicationUrl, optio object.sensitive = true; } + // Content warning text for Mastodon CW display + if (properties["content-warning"]) { + object.summary = properties["content-warning"]; + object.sensitive = true; + } + if (properties["in-reply-to"]) { object.inReplyTo = properties["in-reply-to"]; } @@ -337,9 +343,9 @@ export function jf2ToAS2Activity(properties, actorUrl, publicationUrl, options = if (properties["post-status"] === "sensitive") { noteOptions.sensitive = true; } - // Summary doubles as CW text in Mastodon (notes only — articles already use summary for description) - if (properties.summary && !isArticle) { - noteOptions.summary = properties.summary; + // Content warning text for Mastodon CW display + if (properties["content-warning"]) { + noteOptions.summary = properties["content-warning"]; noteOptions.sensitive = true; } diff --git a/package.json b/package.json index 42de7b9..cce331b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-activitypub", - "version": "2.15.3", + "version": "2.15.4", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "keywords": [ "indiekit",