]> git.mxchange.org Git - friendica.git/commitdiff
Fix errors from #14578
authorArt4 <art4@wlabs.de>
Mon, 9 Dec 2024 22:26:24 +0000 (22:26 +0000)
committerArt4 <art4@wlabs.de>
Mon, 9 Dec 2024 22:26:24 +0000 (22:26 +0000)
src/Protocol/ATProtocol/Actor.php
src/Protocol/ATProtocol/Processor.php

index e3fdd7e185d7404ea576e116ee38a7b2e416f3d2..18b5fc957d8abc137eb012ef1867559649fdac60 100755 (executable)
@@ -174,27 +174,24 @@ class Actor
                        return $contact;
                }
 
-               if (empty($contact)) {
-                       $fields = [
-                               'uid'      => $contact_uid,
-                               'network'  => Protocol::BLUESKY,
-                               'priority' => 1,
-                               'writable' => true,
-                               'blocked'  => false,
-                               'readonly' => false,
-                               'pending'  => false,
-                               'url'      => $did,
-                               'nurl'     => $did,
-                               'alias'    => ATProtocol::WEB . '/profile/' . $did,
-                               'name'     => $did,
-                               'nick'     => $did,
-                               'addr'     => $did,
-                               'rel'      => Contact::NOTHING,
-                       ];
-                       $cid = Contact::insert($fields);
-               } else {
-                       $cid = $contact['id'];
-               }
+               $fields = [
+                       'uid'      => $contact_uid,
+                       'network'  => Protocol::BLUESKY,
+                       'priority' => 1,
+                       'writable' => true,
+                       'blocked'  => false,
+                       'readonly' => false,
+                       'pending'  => false,
+                       'url'      => $did,
+                       'nurl'     => $did,
+                       'alias'    => ATProtocol::WEB . '/profile/' . $did,
+                       'name'     => $did,
+                       'nick'     => $did,
+                       'addr'     => $did,
+                       'rel'      => Contact::NOTHING,
+               ];
+
+               $cid = Contact::insert($fields);
 
                $this->updateContactByDID($did);
 
index 9416ef7a2f2e1213794e1b9a16c3705a72599928..a66c6a3e7b8caca808372ffaa2603021156165d5 100755 (executable)
@@ -125,6 +125,8 @@ class Processor
 
        public function createPost(stdClass $data, array $uids, bool $dont_fetch)
        {
+               $parent = '';
+
                if (!empty($data->commit->record->reply)) {
                        $root   = $this->getUri($data->commit->record->reply->root);
                        $parent = $this->getUri($data->commit->record->reply->parent);
@@ -166,7 +168,7 @@ class Processor
                                                return;
                                        }
                                }
-                               $item = $this->addMedia($post->thread->post->embed, $item, 0, 0, 0);
+                               $item = $this->addMedia($post->thread->post->embed, $item, 0);
                        }
 
                        $id = Item::insert($item);
@@ -295,7 +297,7 @@ class Processor
                }
 
                if (!empty($post->embed)) {
-                       $item = $this->addMedia($post->embed, $item, $uid, $level);
+                       $item = $this->addMedia($post->embed, $item, $level);
                }
 
                $item['restrictions'] = $this->getRestrictionsForUser($post, $item, $post_reason);
@@ -819,7 +821,7 @@ class Processor
                }
 
                $elements = explode(':', $uri);
-               if (empty($elements) || ($elements[0] != 'at')) {
+               if ($elements[0] !== 'at') {
                        $post = Post::selectFirstPost(['extid'], ['uri' => $uri]);
                        return $this->getUriClass($post['extid'] ?? '');
                }