]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Mastodon/Statuses/Context.php
Merge pull request #13110 from anubis2814/develop
[friendica.git] / src / Module / Api / Mastodon / Statuses / Context.php
index f15f71744cfa3880d27828911857845739bbfc9b..0b2e7bda6d6b3c1c2b3e9e0c3545e71ab7b2421f 100644 (file)
@@ -45,10 +45,11 @@ class Context extends BaseApi
                }
 
                $request = $this->getRequest([
-                       'max_id'   => 0,  // Return results older than this id
-                       'since_id' => 0,  // Return results newer than this id
-                       'min_id'   => 0,  // Return results immediately newer than this id
-                       'limit'    => 40, // Maximum number of results to return. Defaults to 40.
+                       'max_id'   => 0,     // Return results older than this id
+                       'since_id' => 0,     // Return results newer than this id
+                       'min_id'   => 0,     // Return results immediately newer than this id
+                       'limit'    => 40,    // Maximum number of results to return. Defaults to 40.
+                       'show_all' => false, // shows posts for all users including blocked and ignored users
                ], $request);
 
                $id = $this->parameters['id'];
@@ -56,8 +57,9 @@ class Context extends BaseApi
                $parents  = [];
                $children = [];
 
-               $parent = Post::selectFirst(['parent-uri-id'], ['uri-id' => $id]);
+               $parent = Post::selectOriginal(['uri-id', 'parent-uri-id'], ['uri-id' => $id]);
                if (DBA::isResult($parent)) {
+                       $id = $parent['uri-id'];
                        $params    = ['order' => ['uri-id' => true]];
                        $condition = ['parent-uri-id' => $parent['parent-uri-id'], 'gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT]];
 
@@ -74,7 +76,7 @@ class Context extends BaseApi
                                $params['order'] = ['uri-id'];
                        }
 
-                       if (!empty($uid)) {
+                       if (!empty($uid) && !$request['show_all']) {
                                $condition = DBA::mergeConditions(
                                        $condition,
                                        ["NOT `author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`))", $uid]