Improved API datasets
authorMichael <heluecht@pirati.ca>
Sun, 17 Jan 2021 14:57:55 +0000 (14:57 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 17 Jan 2021 14:57:55 +0000 (14:57 +0000)
include/api.php
tests/datasets/api.fixture.php

index 63df897..ccb6f71 100644 (file)
@@ -1964,12 +1964,12 @@ function api_conversation_show($type)
        Logger::info(API_LOG_PREFIX . '{subaction}', ['module' => 'api', 'action' => 'conversation', 'subaction' => 'show', 'id' => $id]);
 
        // try to fetch the item for the local user - or the public item, if there is no local one
-       $item = Post::selectFirst(['parent-uri'], ['id' => $id]);
+       $item = Post::selectFirst(['parent-uri-id'], ['id' => $id]);
        if (!DBA::isResult($item)) {
                throw new BadRequestException("There is no status with this id.");
        }
 
-       $parent = Post::selectFirst(['id'], ['uri' => $item['parent-uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
+       $parent = Post::selectFirst(['id'], ['uri-id' => $item['parent-uri-id'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
        if (!DBA::isResult($parent)) {
                throw new BadRequestException("There is no status with this id.");
        }
index ca3fc3d..f8c696c 100644 (file)
@@ -194,6 +194,8 @@ return [
                        'body'        => 'Parent status',
                        'parent'      => 1,
                        'parent-uri-id' => 1,
+                       'thr-parent-id' => 1,
+                       'gravity'     => GRAVITY_PARENT,
                        'author-link' => 'http://localhost/profile/selfcontact',
                        'wall'        => 1,
                        'starred'     => 1,
@@ -219,6 +221,8 @@ return [
                        'body'        => 'Reply',
                        'parent'      => 1,
                        'parent-uri-id' => 1,
+                       'thr-parent-id' => 1,
+                       'gravity'     => GRAVITY_COMMENT,
                        'author-link' => 'http://localhost/profile/selfcontact',
                        'wall'        => 1,
                        'starred'     => 0,
@@ -241,6 +245,8 @@ return [
                        'body'        => 'Other user status',
                        'parent'      => 3,
                        'parent-uri-id' => 3,
+                       'thr-parent-id' => 3,
+                       'gravity'     => GRAVITY_PARENT,
                        'author-link' => 'http://localhost/profile/othercontact',
                        'wall'        => 1,
                        'starred'     => 0,
@@ -262,6 +268,8 @@ return [
                        'body'        => 'Friend user reply',
                        'parent'      => 1,
                        'parent-uri-id' => 1,
+                       'thr-parent-id' => 1,
+                       'gravity'     => GRAVITY_COMMENT,
                        'author-link' => 'http://localhost/profile/othercontact',
                        'wall'        => 1,
                        'starred'     => 0,
@@ -284,6 +292,8 @@ return [
                        'body'        => '[share]Shared status[/share]',
                        'parent'      => 1,
                        'parent-uri-id' => 1,
+                       'thr-parent-id' => 1,
+                       'gravity'     => GRAVITY_COMMENT,
                        'author-link' => 'http://localhost/profile/othercontact',
                        'wall'        => 1,
                        'starred'     => 0,
@@ -309,6 +319,8 @@ return [
                        'body'        => 'Friend user status',
                        'parent'      => 6,
                        'parent-uri-id' => 6,
+                       'thr-parent-id' => 6,
+                       'gravity'     => GRAVITY_PARENT,
                        'author-link' => 'http://localhost/profile/othercontact',
                        'wall'        => 1,
                        'starred'     => 0,