From 3f6fefaa9ac2dd5a48ab3c521f425c84c9d32273 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Tue, 13 Mar 2018 21:58:05 +0000
Subject: [PATCH] Pleroma with the Mastodon UI handles content warning
 different

---
 src/Protocol/OStatus.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php
index aad97c80ff..aa1079407a 100644
--- a/src/Protocol/OStatus.php
+++ b/src/Protocol/OStatus.php
@@ -660,8 +660,9 @@ class OStatus
 		// Mastodon Content Warning
 		if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
 			$clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
-
-			$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
+			if (!empty($clear_text)) {
+				$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
+			}
 		}
 
 		if (($self != '') && empty($item['protocol'])) {
-- 
2.39.5