From: Hypolite Petovan Date: Sun, 24 Feb 2019 18:36:37 +0000 (-0500) Subject: Stop appending entry when parent is missing in OStatus X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=42c06506ce213745e0bf5699b7e22976e20efc37;p=friendica.git Stop appending entry when parent is missing in OStatus - Addresses https://github.com/friendica/friendica/issues/6338#issuecomment-455785854 --- diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 38105e452a..dec5c4c80b 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -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);