$item['title'] = HTML::toBBCode($activity['name']);
$item['content-warning'] = HTML::toBBCode($activity['summary']);
$item['body'] = self::convertMentions(HTML::toBBCode($activity['content']));
+
+ if (($activity['object_type'] == 'as:Video') && !empty($activity['alternate-url'])) {
+ $item['body'] .= "\n[video]" . $activity['alternate-url'] . '[/video]';
+ }
+
$item['location'] = $activity['location'];
if (!empty($item['latitude']) && !empty($item['longitude'])) {
$item = ['author-id' => Contact::getIdForURL($activity['actor']),
'author-link' => $activity['actor']];
+ // Ensure that the contact has got the right network type
+ self::switchContact($item['author-id']);
+
Contact::addRelationship($owner, $contact, $item);
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
* @param integer $uid User ID
* @param string $url Profile URL
*/
- private static function switchContact($cid, $uid, $url)
+ public static function switchContact($cid, $uid, $url)
{
$profile = ActivityPub::probeProfile($url);
if (empty($profile)) {
// Special treatment for Hubzilla links
if (is_array($object_data['alternate-url'])) {
- if (!empty($object['as:url'])) {
+ $object_data['alternate-url'] = JsonLD::fetchElement($object_data['alternate-url'], 'as:href');
+
+ if (!is_string($object_data['alternate-url'])) {
$object_data['alternate-url'] = JsonLD::fetchElement($object['as:url'], 'as:href');
- } else {
- $object_data['alternate-url'] = null;
}
}