From c9b756674a08ad45e8494e2b2ae40622f215ad78 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 4 Aug 2018 21:40:45 +0200 Subject: [PATCH] Add CW support to shared posts in Protocol\OStatus --- src/Protocol/OStatus.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index bf1ff68a11..9b3af22904 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1042,6 +1042,14 @@ class OStatus $item["object-type"] = XML::getFirstNodeValue($xpath, 'activity:object-type/text()', $activityobject); + // Mastodon Content Warning + if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $activityobject)) { + $clear_text = XML::getFirstNodeValue($xpath, 'atom:summary/text()', $activityobject); + if (!empty($clear_text)) { + $item['content-warning'] = HTML::toBBCode($clear_text); + } + } + $inreplyto = $xpath->query('thr:in-reply-to', $activityobject); if (is_object($inreplyto->item(0))) { foreach ($inreplyto->item(0)->attributes as $attributes) { -- 2.39.5