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 | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 38105e452..dec5c4c80 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1763,20 +1763,17 @@ 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)); + + self::entryContent($doc, $as_object, $parent, $owner, "New entry"); + + $entry->appendChild($as_object); } - XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent)); - - self::entryContent($doc, $as_object, $parent, $owner, "New entry"); - - $entry->appendChild($as_object); - self::entryFooter($doc, $entry, $item, $owner); return $entry;