Merge pull request #8704 from annando/parent-2
"parent = id" is replaced with gravity check
This commit is contained in:
commit
43eb7480b5
6 changed files with 12 additions and 9 deletions
|
@ -1647,7 +1647,8 @@ function api_statuses_home_timeline($type)
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
}
|
}
|
||||||
if ($exclude_replies) {
|
if ($exclude_replies) {
|
||||||
$condition[0] .= ' AND `item`.`parent` = `item`.`id`';
|
$condition[0] .= ' AND `item`.`gravity` = ?';
|
||||||
|
$condition[] = GRAVITY_PARENT;
|
||||||
}
|
}
|
||||||
if ($conversation_id > 0) {
|
if ($conversation_id > 0) {
|
||||||
$condition[0] .= " AND `item`.`parent` = ?";
|
$condition[0] .= " AND `item`.`parent` = ?";
|
||||||
|
@ -2255,7 +2256,8 @@ function api_statuses_user_timeline($type)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exclude_replies) {
|
if ($exclude_replies) {
|
||||||
$condition[0] .= ' AND `item`.`parent` = `item`.`id`';
|
$condition[0] .= ' AND `item`.`gravity` = ?';
|
||||||
|
$condition[] = GRAVITY_PARENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conversation_id > 0) {
|
if ($conversation_id > 0) {
|
||||||
|
@ -3305,7 +3307,8 @@ function api_lists_statuses($type)
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
}
|
}
|
||||||
if ($exclude_replies > 0) {
|
if ($exclude_replies > 0) {
|
||||||
$condition[0] .= ' AND `item`.`parent` = `item`.`id`';
|
$condition[0] .= ' AND `item`.`gravity` = ?';
|
||||||
|
$condition[] = GRAVITY_PARENT;
|
||||||
}
|
}
|
||||||
if ($conversation_id > 0) {
|
if ($conversation_id > 0) {
|
||||||
$condition[0] .= " AND `item`.`parent` = ?";
|
$condition[0] .= " AND `item`.`parent` = ?";
|
||||||
|
@ -5199,7 +5202,7 @@ function api_in_reply_to($item)
|
||||||
$in_reply_to['user_id_str'] = null;
|
$in_reply_to['user_id_str'] = null;
|
||||||
$in_reply_to['screen_name'] = null;
|
$in_reply_to['screen_name'] = null;
|
||||||
|
|
||||||
if (($item['thr-parent'] != $item['uri']) && (intval($item['parent']) != intval($item['id']))) {
|
if (($item['thr-parent'] != $item['uri']) && ($item['gravity'] != GRAVITY_PARENT)) {
|
||||||
$parent = Item::selectFirst(['id'], ['uid' => $item['uid'], 'uri' => $item['thr-parent']]);
|
$parent = Item::selectFirst(['id'], ['uid' => $item['uid'], 'uri' => $item['thr-parent']]);
|
||||||
if (DBA::isResult($parent)) {
|
if (DBA::isResult($parent)) {
|
||||||
$in_reply_to['status_id'] = intval($parent['id']);
|
$in_reply_to['status_id'] = intval($parent['id']);
|
||||||
|
|
|
@ -823,7 +823,7 @@ function item_photo_menu($item) {
|
||||||
$block_link = '';
|
$block_link = '';
|
||||||
$ignore_link = '';
|
$ignore_link = '';
|
||||||
|
|
||||||
if (local_user() && local_user() == $item['uid'] && $item['parent'] == $item['id'] && !$item['self']) {
|
if (local_user() && local_user() == $item['uid'] && $item['gravity'] == GRAVITY_PARENT && !$item['self']) {
|
||||||
$sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
|
$sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1287,7 +1287,7 @@ function photos_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
|
if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
|
||||||
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
|
$condition = ["`parent` = ? AND `gravity` != ?", $link_item['parent'], GRAVITY_PARENT];
|
||||||
$total = DBA::count('item', $condition);
|
$total = DBA::count('item', $condition);
|
||||||
|
|
||||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||||
|
|
|
@ -960,7 +960,7 @@ class DFRN
|
||||||
$dfrnowner = self::addEntryAuthor($doc, "dfrn:owner", $item["owner-link"], $item);
|
$dfrnowner = self::addEntryAuthor($doc, "dfrn:owner", $item["owner-link"], $item);
|
||||||
$entry->appendChild($dfrnowner);
|
$entry->appendChild($dfrnowner);
|
||||||
|
|
||||||
if (($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
|
if ($item['gravity'] != GRAVITY_PARENT) {
|
||||||
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
|
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
|
||||||
$parent = Item::selectFirst(['guid', 'plink'], ['uri' => $parent_item, 'uid' => $item['uid']]);
|
$parent = Item::selectFirst(['guid', 'plink'], ['uri' => $parent_item, 'uid' => $item['uid']]);
|
||||||
$attributes = ["ref" => $parent_item, "type" => "text/html",
|
$attributes = ["ref" => $parent_item, "type" => "text/html",
|
||||||
|
|
|
@ -2020,7 +2020,7 @@ class OStatus
|
||||||
{
|
{
|
||||||
$mentioned = [];
|
$mentioned = [];
|
||||||
|
|
||||||
if (($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
|
if ($item['gravity'] != GRAVITY_PARENT) {
|
||||||
$parent = Item::selectFirst(['guid', 'author-link', 'owner-link'], ['id' => $item['parent']]);
|
$parent = Item::selectFirst(['guid', 'author-link', 'owner-link'], ['id' => $item['parent']]);
|
||||||
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
|
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ function frio_display_item(App $a, &$arr)
|
||||||
if (
|
if (
|
||||||
local_user()
|
local_user()
|
||||||
&& local_user() == $arr['item']['uid']
|
&& local_user() == $arr['item']['uid']
|
||||||
&& $arr['item']['parent'] == $arr['item']['id']
|
&& $arr['item']['gravity'] == GRAVITY_PARENT
|
||||||
&& !$arr['item']['self'])
|
&& !$arr['item']['self'])
|
||||||
{
|
{
|
||||||
$subthread = [
|
$subthread = [
|
||||||
|
|
Loading…
Reference in a new issue