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
This commit is contained in:
Ricardo
2026-03-18 00:24:35 +01:00
parent b4daa806bd
commit 2ca491f28b
3 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -216,7 +216,7 @@ export function submitComposeController(mountPath, plugin) {
} }
if (cwEnabled && summary && summary.trim()) { if (cwEnabled && summary && summary.trim()) {
micropubData.append("summary", summary.trim()); micropubData.append("content-warning", summary.trim());
micropubData.append("sensitive", "true"); micropubData.append("sensitive", "true");
} }
+9 -3
View File
@@ -171,6 +171,12 @@ export function jf2ToActivityStreams(properties, actorUrl, publicationUrl, optio
object.sensitive = true; 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"]) { if (properties["in-reply-to"]) {
object.inReplyTo = 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") { if (properties["post-status"] === "sensitive") {
noteOptions.sensitive = true; noteOptions.sensitive = true;
} }
// Summary doubles as CW text in Mastodon (notes only — articles already use summary for description) // Content warning text for Mastodon CW display
if (properties.summary && !isArticle) { if (properties["content-warning"]) {
noteOptions.summary = properties.summary; noteOptions.summary = properties["content-warning"];
noteOptions.sensitive = true; noteOptions.sensitive = true;
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@rmdes/indiekit-endpoint-activitypub", "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.", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
"keywords": [ "keywords": [
"indiekit", "indiekit",