From 42c06506ce213745e0bf5699b7e22976e20efc37 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 24 Feb 2019 13:36:37 -0500 Subject: [PATCH] Stop appending entry when parent is missing in OStatus - Addresses https://github.com/friendica/friendica/issues/6338#issuecomment-455785854 --- src/Protocol/OStatus.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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); -- 2.39.5