Some more feed simplification

This commit is contained in:
Michael 2018-11-15 16:21:37 +00:00
parent 5f258dac22
commit c3b6727fad

View file

@ -1874,7 +1874,7 @@ class OStatus
self::entryContent($doc, $entry, $item, $owner, $title, '', true, $feed_mode); self::entryContent($doc, $entry, $item, $owner, $title, '', true, $feed_mode);
self::entryFooter($doc, $entry, $item, $owner); self::entryFooter($doc, $entry, $item, $owner, !$feed_mode, $feed_mode);
return $entry; return $entry;
} }
@ -1961,11 +1961,13 @@ class OStatus
"href" => System::baseUrl()."/display/".$item["guid"]] "href" => System::baseUrl()."/display/".$item["guid"]]
); );
if ($complete && ($item["id"] > 0)) { if (!$feed_mode && $complete && ($item["id"] > 0)) {
XML::addElement($doc, $entry, "status_net", "", ["notice_id" => $item["id"]]); XML::addElement($doc, $entry, "status_net", "", ["notice_id" => $item["id"]]);
} }
XML::addElement($doc, $entry, "activity:verb", $verb); if (!$feed_mode) {
XML::addElement($doc, $entry, "activity:verb", $verb);
}
XML::addElement($doc, $entry, "published", DateTimeFormat::utc($item["created"]."+00:00", DateTimeFormat::ATOM)); XML::addElement($doc, $entry, "published", DateTimeFormat::utc($item["created"]."+00:00", DateTimeFormat::ATOM));
XML::addElement($doc, $entry, "updated", DateTimeFormat::utc($item["edited"]."+00:00", DateTimeFormat::ATOM)); XML::addElement($doc, $entry, "updated", DateTimeFormat::utc($item["edited"]."+00:00", DateTimeFormat::ATOM));
@ -1974,14 +1976,15 @@ class OStatus
/** /**
* @brief Adds the elements at the foot of an entry to the XML document * @brief Adds the elements at the foot of an entry to the XML document
* *
* @param object $doc XML document * @param object $doc XML document
* @param object $entry The entry element where the elements are added * @param object $entry The entry element where the elements are added
* @param array $item Data of the item that is to be posted * @param array $item Data of the item that is to be posted
* @param array $owner Contact data of the poster * @param array $owner Contact data of the poster
* @param bool $complete default true * @param bool $complete default true
* @param bool $feed_mode Behave like a regular feed for users if true
* @return void * @return void
*/ */
private static function entryFooter(DOMDocument $doc, $entry, array $item, array $owner, $complete = true) private static function entryFooter(DOMDocument $doc, $entry, array $item, array $owner, $complete = true, $feed_mode = false)
{ {
$mentioned = []; $mentioned = [];
@ -2012,7 +2015,7 @@ class OStatus
XML::addElement($doc, $entry, "link", "", $attributes); XML::addElement($doc, $entry, "link", "", $attributes);
} }
if (intval($item["parent"]) > 0) { if (!$feed_mode && (intval($item["parent"]) > 0)) {
$conversation_href = $conversation_uri = str_replace('/objects/', '/context/', $item['parent-uri']); $conversation_href = $conversation_uri = str_replace('/objects/', '/context/', $item['parent-uri']);
if (isset($parent_item)) { if (isset($parent_item)) {
@ -2084,7 +2087,7 @@ class OStatus
]); ]);
} }
if (!$item["private"]) { if (!$item["private"] && !$feed_mode) {
XML::addElement($doc, $entry, "link", "", ["rel" => "ostatus:attention", XML::addElement($doc, $entry, "link", "", ["rel" => "ostatus:attention",
"href" => "http://activityschema.org/collection/public"]); "href" => "http://activityschema.org/collection/public"]);
XML::addElement($doc, $entry, "link", "", ["rel" => "mentioned", XML::addElement($doc, $entry, "link", "", ["rel" => "mentioned",