]> git.mxchange.org Git - friendica.git/commitdiff
Making Friendica compatible to Nextcloud Social
authorMichael <heluecht@pirati.ca>
Sun, 13 Jan 2019 09:38:01 +0000 (09:38 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 13 Jan 2019 09:38:01 +0000 (09:38 +0000)
src/Model/APContact.php
src/Protocol/ActivityPub/Receiver.php
src/Util/JsonLD.php

index 2b5a5c4e7b15015636170933b764d82e31071b75..3a9f42fdd791cef939faef865bb82ef3aa7a3b42 100644 (file)
@@ -137,7 +137,7 @@ class APContact extends BaseObject
                $apcontact['about'] = HTML::toBBCode(JsonLD::fetchElement($compacted, 'as:summary'));
 
                $apcontact['photo'] = JsonLD::fetchElement($compacted, 'as:icon', '@id');
-               if (is_array($apcontact['photo'])) {
+               if (is_array($apcontact['photo']) || !empty($compacted['as:icon']['as:url']['@id'])) {
                        $apcontact['photo'] = JsonLD::fetchElement($compacted['as:icon'], 'as:url', '@id');
                }
 
index 5459bca346b8ded56f753c1454fcd7c11512d55e..ac75155b20c6bccee5659eb6f1751e61e029231f 100644 (file)
@@ -826,10 +826,10 @@ class Receiver
                $object_data = [];
                $object_data['object_type'] = JsonLD::fetchElement($object, '@type');
                $object_data['id'] = JsonLD::fetchElement($object, '@id');
-
                $object_data['reply-to-id'] = JsonLD::fetchElement($object, 'as:inReplyTo');
 
-               if (empty($object_data['reply-to-id'])) {
+               // An empty "id" field is translated to "./" by the compactor, so we have to check for this content
+               if (empty($object_data['reply-to-id']) || ($object_data['reply-to-id'] == './')) {
                        $object_data['reply-to-id'] = $object_data['id'];
                }
 
index cd3a6ec2708899d49483a7bfb3c73a92c7d762cf..e2c2dddc1b957eb1b3d6096d5e26cc34b904b567 100644 (file)
@@ -93,6 +93,10 @@ class JsonLD
                        'dc' => (object)['@id' => 'http://purl.org/dc/terms/', '@type' => '@id'],
                        'toot' => (object)['@id' => 'http://joinmastodon.org/ns#', '@type' => '@id']];
 
+               // Workaround for Nextcloud Social
+               // See issue https://github.com/nextcloud/social/issues/330
+               $json['@context'][] = 'https://w3id.org/security/v1';
+
                // Trying to avoid memory problems with large content fields
                if (!empty($json['object']['source']['content'])) {
                        $content = $json['object']['source']['content'];