Replace "id = parent" checks with "gravity" checks

This commit is contained in:
Michael 2020-05-27 12:19:06 +00:00
parent 133de9b524
commit 973abb6196
13 changed files with 56 additions and 56 deletions

View file

@ -1559,7 +1559,7 @@ function api_search($type)
$params['group_by'] = ['uri-id'];
} else {
$condition = ["`id` > ?
" . ($exclude_replies ? " AND `id` = `parent` " : ' ') . "
" . ($exclude_replies ? " AND `gravity` = " . GRAVITY_PARENT : ' ') . "
AND (`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `body` LIKE CONCAT('%',?,'%')",
$since_id, api_user(), $_REQUEST['q']];
@ -3028,7 +3028,7 @@ function api_format_item($item, $type = "json", $status_user = null, $author_use
$retweeted_item = [];
$quoted_item = [];
if ($item["id"] == $item["parent"]) {
if ($item['gravity'] == GRAVITY_PARENT) {
$body = $item['body'];
$retweeted_item = api_share_as_retweet($item);
if ($body != $item['body']) {

View file

@ -671,7 +671,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$item['pagedrop'] = $page_dropping;
if ($item['id'] == $item['parent']) {
if ($item['gravity'] == GRAVITY_PARENT) {
$item_object = new Post($item);
$conv->addParent($item_object);
}
@ -948,7 +948,7 @@ function builtin_activity_puller($item, &$conv_responses) {
return;
}
if (!empty($item['verb']) && DI::activity()->match($item['verb'], $verb) && ($item['id'] != $item['parent'])) {
if (!empty($item['verb']) && DI::activity()->match($item['verb'], $verb) && ($item['gravity'] != GRAVITY_PARENT)) {
$author = ['uid' => 0, 'id' => $item['author-id'],
'network' => $item['author-network'], 'url' => $item['author-link']];
$url = Contact::magicLinkByContact($author);
@ -1218,7 +1218,7 @@ function get_item_children(array &$item_list, array $parent, $recursive = true)
{
$children = [];
foreach ($item_list as $i => $item) {
if ($item['id'] != $item['parent']) {
if ($item['gravity'] != GRAVITY_PARENT) {
if ($recursive) {
// Fallback to parent-uri if thr-parent is not set
$thr_parent = $item['thr-parent'];
@ -1366,7 +1366,7 @@ function conv_sort(array $item_list, $order)
// Extract the top level items
foreach ($item_array as $item) {
if ($item['id'] == $item['parent']) {
if ($item['gravity'] == GRAVITY_PARENT) {
$parents[] = $item;
}
}