Fix errors from #14578

This commit is contained in:
Art4 2024-12-09 22:26:24 +00:00
parent 97605498a6
commit 9867bdfcff
2 changed files with 23 additions and 24 deletions

View file

@ -174,7 +174,6 @@ class Actor
return $contact; return $contact;
} }
if (empty($contact)) {
$fields = [ $fields = [
'uid' => $contact_uid, 'uid' => $contact_uid,
'network' => Protocol::BLUESKY, 'network' => Protocol::BLUESKY,
@ -191,10 +190,8 @@ class Actor
'addr' => $did, 'addr' => $did,
'rel' => Contact::NOTHING, 'rel' => Contact::NOTHING,
]; ];
$cid = Contact::insert($fields); $cid = Contact::insert($fields);
} else {
$cid = $contact['id'];
}
$this->updateContactByDID($did); $this->updateContactByDID($did);

View file

@ -125,6 +125,8 @@ class Processor
public function createPost(stdClass $data, array $uids, bool $dont_fetch) public function createPost(stdClass $data, array $uids, bool $dont_fetch)
{ {
$parent = '';
if (!empty($data->commit->record->reply)) { if (!empty($data->commit->record->reply)) {
$root = $this->getUri($data->commit->record->reply->root); $root = $this->getUri($data->commit->record->reply->root);
$parent = $this->getUri($data->commit->record->reply->parent); $parent = $this->getUri($data->commit->record->reply->parent);
@ -166,7 +168,7 @@ class Processor
return; 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); $id = Item::insert($item);
@ -295,7 +297,7 @@ class Processor
} }
if (!empty($post->embed)) { 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); $item['restrictions'] = $this->getRestrictionsForUser($post, $item, $post_reason);
@ -819,7 +821,7 @@ class Processor
} }
$elements = explode(':', $uri); $elements = explode(':', $uri);
if (empty($elements) || ($elements[0] != 'at')) { if ($elements[0] !== 'at') {
$post = Post::selectFirstPost(['extid'], ['uri' => $uri]); $post = Post::selectFirstPost(['extid'], ['uri' => $uri]);
return $this->getUriClass($post['extid'] ?? ''); return $this->getUriClass($post['extid'] ?? '');
} }