Merge pull request #4169 from annando/comment-dfrn

Precaution for incomplete threads
This commit is contained in:
Hypolite Petovan 2018-01-04 16:31:16 -05:00 committed by GitHub
commit 3b4f5f98f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -919,6 +919,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