]> git.mxchange.org Git - friendica.git/commitdiff
Add CW support to shared posts in Protocol\OStatus
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 4 Aug 2018 19:40:45 +0000 (21:40 +0200)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 4 Aug 2018 19:40:45 +0000 (21:40 +0200)
src/Protocol/OStatus.php

index bf1ff68a1151cc30ebac12f4617560ad87b7911a..9b3af22904faa81511fdf002df60e6d816816d0d 100644 (file)
@@ -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) {