$parents = [];
$children = [];
+ $deleted = [];
$parent = Post::selectOriginal(['uri-id', 'parent-uri-id'], ['uri-id' => $id]);
if (DBA::isResult($parent)) {
if (!empty($request['max_id'])) {
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]);
}
-
+
if (!empty($request['since_id'])) {
$condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $request['since_id']]);
}
-
+
if (!empty($request['min_id'])) {
$condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $request['min_id']]);
$params['order'] = ['uri-id'];
["NOT `author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`))", $uid]
);
}
-
- $posts = Post::selectPosts(['uri-id', 'thr-parent-id'], $condition, $params);
+
+ $posts = Post::selectPosts(['uri-id', 'thr-parent-id', 'deleted'], $condition, $params);
while ($post = Post::fetch($posts)) {
if ($post['uri-id'] == $post['thr-parent-id']) {
continue;
$parents[$post['uri-id']] = $post['thr-parent-id'];
$children[$post['thr-parent-id']][] = $post['uri-id'];
+
+ if ($post['deleted']) {
+ $deleted[] = $post['uri-id'];
+ }
}
DBA::close($posts);
$statuses = ['ancestors' => [], 'descendants' => []];
- $ancestors = self::getParents($id, $parents);
+ $ancestors = array_diff(self::getParents($id, $parents), $deleted);
asort($ancestors);
$statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid, $display_quotes);
}
- $descendants = self::getChildren($id, $children);
+ $descendants = array_diff(self::getChildren($id, $children), $deleted);
asort($descendants);