]> git.mxchange.org Git - friendica.git/commitdiff
Stop appending entry when parent is missing in OStatus
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 24 Feb 2019 18:36:37 +0000 (13:36 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 24 Feb 2019 18:36:37 +0000 (13:36 -0500)
- Addresses https://github.com/friendica/friendica/issues/6338#issuecomment-455785854

src/Protocol/OStatus.php

index 38105e452a929dbdf589675964837c4b7e4c39cb..dec5c4c80b021a572da0d951304a7234dcbab6bc 100644 (file)
@@ -1763,19 +1763,16 @@ class OStatus
                $verb = NAMESPACE_ACTIVITY_SCHEMA."favorite";
                self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false);
 
-               $as_object = $doc->createElement("activity:object");
-
                $parent = Item::selectFirst([], ['uri' => $item["thr-parent"], 'uid' => $item["uid"]]);
+               if (DBA::isResult($parent)) {
+                       $as_object = $doc->createElement("activity:object");
 
-               if (!$parent) {
-                       $parent = [];
-               }
-
-               XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent));
+                       XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent));
 
-               self::entryContent($doc, $as_object, $parent, $owner, "New entry");
+                       self::entryContent($doc, $as_object, $parent, $owner, "New entry");
 
-               $entry->appendChild($as_object);
+                       $entry->appendChild($as_object);
+               }
 
                self::entryFooter($doc, $entry, $item, $owner);