]> git.mxchange.org Git - friendica.git/commitdiff
Fix reply via API / fix missing variable
authorMichael <heluecht@pirati.ca>
Wed, 25 Jan 2023 10:16:24 +0000 (10:16 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 25 Jan 2023 10:16:24 +0000 (10:16 +0000)
src/Content/Item.php
src/Factory/Api/Mastodon/Status.php

index 87d719719bb6b7ae5576e495f4249e5f69dce99e..0d47cde92f2190ee121da30d1e3fec037fe70ea4 100644 (file)
@@ -950,18 +950,19 @@ class Item
 
        public function initializePost(array $post): array
        {
-               $post['network']   = Protocol::DFRN;
-               $post['protocol']  = Conversation::PARCEL_DIRECT;
-               $post['direction'] = Conversation::PUSH;
-               $post['received']  = DateTimeFormat::utcNow();
-               $post['origin']    = true;
-               $post['wall']      = $post['wall'] ?? true;
-               $post['guid']      = $post['guid'] ?? System::createUUID();
-               $post['verb']      = $post['verb'] ?? Activity::POST;
-
-               if (empty($post['uri'])) {
-                       $post['thr-parent'] = $post['uri'] = ItemModel::newURI($post['guid']);
-                       $post['gravity']    = ItemModel::GRAVITY_PARENT;
+               $post['network']    = Protocol::DFRN;
+               $post['protocol']   = Conversation::PARCEL_DIRECT;
+               $post['direction']  = Conversation::PUSH;
+               $post['received']   = DateTimeFormat::utcNow();
+               $post['origin']     = true;
+               $post['wall']       = $post['wall'] ?? true;
+               $post['guid']       = $post['guid'] ?? System::createUUID();
+               $post['verb']       = $post['verb'] ?? Activity::POST;
+               $post['uri']        = $post['uri'] ?? ItemModel::newURI($post['guid']);
+               $post['thr-parent'] = $post['thr-parent'] ?? $post['uri'];
+
+               if (empty($post['gravity'])) {
+                       $post['gravity'] = ($post['uri'] == $post['thr-parent']) ? ItemModel::GRAVITY_PARENT : ItemModel::GRAVITY_COMMENT;
                }
 
                $owner = User::getOwnerDataById($post['uid']);
index c120825fd13170a5081b59e80f92c9eadb904355..0b9c2c554a49068c47a5587c183ce3b54c38b17a 100644 (file)
@@ -210,6 +210,8 @@ class Status extends BaseFactory
                        // We can always safely add attached activities. Real quotes are added to the body via "addSharedPost".
                        if (empty($item['quote-uri-id'])) {
                                $quote = self::createQuote($item, $uid);
+                       } else {
+                               $quote = [];
                        }
 
                        $shared = $this->contentItem->getSharedPost($item, ['uri-id']);