Fix context order / notice fixed
This commit is contained in:
parent
97a6ea0e79
commit
8eacfbc570
3 changed files with 19 additions and 4 deletions
|
@ -40,6 +40,8 @@ class Card extends BaseFactory
|
|||
$item = Post::selectFirst(['nody'], ['uri-id' => $uriId]);
|
||||
if (!empty($item['body'])) {
|
||||
$data = BBCode::getAttachmentData($item['body']);
|
||||
} else {
|
||||
$data = [];
|
||||
}
|
||||
|
||||
foreach (Post\Media::getByURIId($uriId, [Post\Media::HTML]) as $attached) {
|
||||
|
|
|
@ -54,7 +54,8 @@ class Context extends BaseApi
|
|||
$parents = [];
|
||||
$children = [];
|
||||
|
||||
$posts = Post::select(['uri-id', 'thr-parent-id'], ['parent-uri-id' => $parent['parent-uri-id']], [], false);
|
||||
$posts = Post::select(['uri-id', 'thr-parent-id'],
|
||||
['parent-uri-id' => $parent['parent-uri-id'], 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]], [], false);
|
||||
while ($post = Post::fetch($posts)) {
|
||||
if ($post['uri-id'] == $post['thr-parent-id']) {
|
||||
continue;
|
||||
|
@ -67,12 +68,24 @@ class Context extends BaseApi
|
|||
|
||||
$statuses = ['ancestors' => [], 'descendants' => []];
|
||||
|
||||
$ancestors = [];
|
||||
foreach (self::getParents($id, $parents) as $ancestor) {
|
||||
$statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid);
|
||||
$ancestors[$ancestor] = DI::mstdnStatus()->createFromUriId($ancestor, $uid);
|
||||
}
|
||||
|
||||
ksort($ancestors);
|
||||
foreach ($ancestors as $ancestor) {
|
||||
$statuses['ancestors'][] = $ancestor;
|
||||
}
|
||||
|
||||
$descendants = [];
|
||||
foreach (self::getChildren($id, $children) as $descendant) {
|
||||
$statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid);
|
||||
$descendants[] = DI::mstdnStatus()->createFromUriId($descendant, $uid);
|
||||
}
|
||||
|
||||
ksort($descendants);
|
||||
foreach ($descendants as $descendant) {
|
||||
$statuses['descendants'][] = $descendant;
|
||||
}
|
||||
|
||||
System::jsonExit($statuses);
|
||||
|
|
|
@ -55,7 +55,7 @@ class Token extends BaseApi
|
|||
|
||||
$condition = ['application-id' => $application['id'], 'code' => $code];
|
||||
|
||||
$token = DBA::selectFirst('application-token', ['access_token'], $condition);
|
||||
$token = DBA::selectFirst('application-token', ['access_token', 'created_at'], $condition);
|
||||
if (!DBA::isResult($token)) {
|
||||
Logger::warning('Token not found', $condition);
|
||||
DI::mstdnError()->RecordNotFound();
|
||||
|
|
Loading…
Reference in a new issue