Stop appending entry when parent is missing in OStatus

- Addresses https://github.com/friendica/friendica/issues/6338#issuecomment-455785854
This commit is contained in:
Hypolite Petovan 2019-02-24 13:36:37 -05:00
parent efe358c617
commit 42c06506ce

View File

@ -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;