]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Processor.php
Merge pull request #9194 from annando/additional-directions
[friendica.git] / src / Protocol / ActivityPub / Processor.php
index b4dba53ccc6eaf655c6557ffe0da398e29ad7d0d..24ac133358ac539c4874f7c35834087c963d5a6e 100644 (file)
@@ -26,6 +26,7 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
+use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\APContact;
@@ -353,7 +354,7 @@ class Processor
                DBA::close($items);
 
                if (count($original) != count($receivers)) {
-                       Logger::info('Improved data', ['id' => $activity['id'], 'object' => $activity['object_id'], 'original' => $original, 'improved' => $receivers]);
+                       Logger::info('Improved data', ['id' => $activity['id'], 'object' => $activity['object_id'], 'original' => $original, 'improved' => $receivers, 'callstack' => System::callstack()]);
                }
 
                return $receivers;
@@ -527,6 +528,30 @@ class Processor
 
                        $item['uid'] = $receiver;
 
+                       $type = $activity['reception_type'][$receiver] ?? Receiver::TARGET_UNKNOWN;
+                       switch($type) {
+                               case Receiver::TARGET_TO:
+                                       $item['post-type'] = Item::PT_TO;
+                                       break;
+                               case Receiver::TARGET_CC:
+                                       $item['post-type'] = Item::PT_CC;
+                                       break;
+                               case Receiver::TARGET_BTO:
+                                       $item['post-type'] = Item::PT_BTO;
+                                       break;
+                               case Receiver::TARGET_BCC:
+                                       $item['post-type'] = Item::PT_BCC;
+                                       break;
+                               case Receiver::TARGET_FOLLOWER:
+                                       $item['post-type'] = Item::PT_FOLLOWER;
+                                       break;
+                               case Receiver::TARGET_ANSWER:
+                                       $item['post-type'] = Item::PT_COMMENT;
+                                       break;
+                               default:
+                                       $item['post-type'] = Item::PT_ARTICLE;
+                       }
+
                        if ($item['isForum'] ?? false) {
                                $item['contact-id'] = Contact::getIdForURL($activity['actor'], $receiver);
                        } else {
@@ -774,6 +799,9 @@ class Processor
                }
 
                $owner = User::getOwnerDataById($uid);
+               if (empty($owner)) {
+                       return;
+               }
 
                $cid = Contact::getIdForURL($activity['actor'], $uid);
                if (!empty($cid)) {
@@ -956,6 +984,9 @@ class Processor
                }
 
                $owner = User::getOwnerDataById($uid);
+               if (empty($owner)) {
+                       return;
+               }
 
                $cid = Contact::getIdForURL($activity['actor'], $uid);
                if (empty($cid)) {