Precaution for incomplete threads
This commit is contained in:
parent
0c9a9b6f0c
commit
05c8cbc1e1
1 changed files with 14 additions and 0 deletions
|
@ -929,6 +929,20 @@ function community_add_items($parents) {
|
|||
);
|
||||
$comments = dba::inArray($thread_items);
|
||||
|
||||
// Check if the original item is in the result.
|
||||
// When commenting from the community page there can be incomplete threads
|
||||
if (count($comments) > 0) {
|
||||
$parent_found = false;
|
||||
foreach ($comments as $comment) {
|
||||
if ($comment['uri'] == $comment['parent-uri']) {
|
||||
$parent_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$parent_found) {
|
||||
$comments = array();
|
||||
}
|
||||
}
|
||||
|
||||
if (count($comments) == 0) {
|
||||
$thread_items = dba::p(item_query()." AND `item`.`uid` = 0
|
||||
|
|
Loading…
Reference in a new issue