]> git.mxchange.org Git - friendica.git/commitdiff
Fix for receiving direct messages from Mastodon
authorMichael <heluecht@pirati.ca>
Sat, 18 May 2019 07:00:57 +0000 (07:00 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 18 May 2019 07:00:57 +0000 (07:00 +0000)
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Receiver.php

index 70728edc9ea9e35b54624f1515d07c58a4b3c23f..045c48a4c1ced304920444f465f559bd6973d65a 100644 (file)
@@ -173,7 +173,7 @@ class Processor
                        $item['object-type'] = ACTIVITY_OBJ_COMMENT;
                }
 
-               if (($activity['id'] != $activity['reply-to-id']) && !Item::exists(['uri' => $activity['reply-to-id']])) {
+               if (empty($activity['directmessage']) && ($activity['id'] != $activity['reply-to-id']) && !Item::exists(['uri' => $activity['reply-to-id']])) {
                        Logger::log('Parent ' . $activity['reply-to-id'] . ' not found. Try to refetch it.');
                        self::fetchMissingActivity($activity['reply-to-id'], $activity);
                }
index 7ae68cd4d1247238fc50a15ef6fa1030ff7d4463..74d939275225c186b2066a6e5ac8612f18efeae1 100644 (file)
@@ -207,7 +207,13 @@ class Receiver
                                return [];
                        }
                        $object_data['object_id'] = $object_id;
-                       $object_data['directmessage'] = JsonLD::fetchElement($activity, 'litepub:directMessage');
+
+                       // Test if it is an answer to a mail
+                       if (DBA::exists('mail', ['uri' => $object_data['reply-to-id']])) {
+                               $object_data['directmessage'] = true;
+                       } else {
+                               $object_data['directmessage'] = JsonLD::fetchElement($activity, 'litepub:directMessage');
+                       }
 
                        // We had been able to retrieve the object data - so we can trust the source
                        $trust_source = true;
@@ -936,11 +942,6 @@ class Receiver
 
                $object_data['receiver'] = self::getReceivers($object, $object_data['actor'], $object_data['tags']);
 
-               // Test if it is an answer to a mail
-               if (DBA::exists('mail', ['uri' => $object_data['reply-to-id']])) {
-                       $object_data['directmessage'] = true;
-               }
-
                // Common object data:
 
                // Unhandled