]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Mastodon/Lists/Accounts.php
Merge pull request #10251 from nupplaphil/feat/drone_phptest
[friendica.git] / src / Module / Api / Mastodon / Lists / Accounts.php
index 0b817cfc82abb8481e934ae2f778f645066bed4a..1ca2c8359d3990fefabc5cc3f4d1a22d825d070e 100644 (file)
@@ -49,11 +49,11 @@ class Accounts extends BaseApi
         */
        public static function rawContent(array $parameters = [])
        {
-               self::login();
+               self::login(self::SCOPE_READ);
                $uid = self::getCurrentUserID();
 
                if (empty($parameters['id'])) {
-                       DI::mstdnError()->RecordNotFound();
+                       DI::mstdnError()->UnprocessableEntity();
                }
 
                $id = $parameters['id'];
@@ -65,12 +65,18 @@ class Accounts extends BaseApi
                $max_id = (int)!isset($_REQUEST['max_id']) ? 0 : $_REQUEST['max_id'];
                // Return results newer than this id
                $since_id = (int)!isset($_REQUEST['since_id']) ? 0 : $_REQUEST['since_id'];
-               // Maximum number of results to return. Defaults to 20.
+               // Maximum number of results. Defaults to 40. Max 40.
+               // Set to 0 in order to get all accounts without pagination.
                $limit = (int)!isset($_REQUEST['limit']) ? 40 : $_REQUEST['limit'];
 
 
-               $params = ['order' => ['contact-id' => true], 'limit' => $limit];
+               $params = ['order' => ['contact-id' => true]];
+
+               if ($limit != 0) {
+                       $params['limit'] = $limit;
 
+               }
+       
                $condition = ['gid' => $id];
 
                if (!empty($max_id)) {
@@ -87,6 +93,8 @@ class Accounts extends BaseApi
                        $params['order'] = ['contact-id'];
                }
 
+               $accounts = [];
+
                $members = DBA::select('group_member', ['contact-id'], $condition, $params);
                while ($member = DBA::fetch($members)) {
                        $accounts[] = DI::mstdnAccount()->createFromContactId($member['contact-id'], $uid);