]> git.mxchange.org Git - friendica.git/commitdiff
Fix some warnings
authorMichael <heluecht@pirati.ca>
Fri, 31 Mar 2023 18:01:10 +0000 (18:01 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 31 Mar 2023 18:01:10 +0000 (18:01 +0000)
src/Module/Api/Mastodon/Statuses.php
src/Protocol/ActivityPub/ClientToServer.php

index f8f46a8956a90c9b0d3c8ad06089603a021d2378..a232112de8bfa45e538172197182bd9876680268 100644 (file)
@@ -71,7 +71,7 @@ class Statuses extends BaseApi
                        'origin'     => true,
                ];
 
-               $post = Post::selectFirst(['uri-id', 'id', 'gravity', 'uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'network'], $condition);
+               $post = Post::selectFirst(['uri-id', 'id', 'gravity', 'verb', 'uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'network'], $condition);
                if (empty($post['id'])) {
                        throw new HTTPException\NotFoundException('Item with URI ID ' . $this->parameters['id'] . ' not found for user ' . $uid . '.');
                }
@@ -87,6 +87,8 @@ class Statuses extends BaseApi
                $item['uid']        = $post['uid'];
                $item['body']       = $body;
                $item['network']    = $post['network'];
+               $item['gravity']    = $post['gravity'];
+               $item['verb']       = $post['verb'];
                $item['app']        = $this->getApp();
 
                if (!empty($request['language'])) {
@@ -108,7 +110,7 @@ class Statuses extends BaseApi
                        }
                }
 
-               $item = DI::contentItem()->expandTags($item, $request['visibility'] == 'direct');
+               $item = DI::contentItem()->expandTags($item);
 
                /*
                The provided ids in the request value consists of these two sources:
index 7c0919f636911342ed0e86765fc165de7fd1c6e6..48a5cfdec5aed3f5ccc23dcbf91769d216723357 100644 (file)
@@ -264,7 +264,7 @@ class ClientToServer
                $item['contact-id'] = $owner['id'];
                $item['author-id']  = $item['owner-id']  = Contact::getPublicIdByUserId($uid);
                $item['title']      = $object_data['name'];
-               $item['body']       = Markdown::toBBCode($object_data['content']);
+               $item['body']       = Markdown::toBBCode($object_data['content'] ?? '');
                $item['app']        = $application['name'] ?? 'API';
 
                if (!empty($object_data['target'][Receiver::TARGET_GLOBAL])) {
@@ -354,6 +354,10 @@ class ClientToServer
 
                $apcontact = APContact::getByURL($owner['url']);
 
+               if (empty($apcontact)) {
+                       throw new \Friendica\Network\HTTPException\NotFoundException();
+               }
+
                return self::getCollection($condition, DI::baseUrl() . '/outbox/' . $owner['nickname'], $page, $max_id, $uid, $apcontact['statuses_count']);
        }