X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=0eb94181f019fa5ad5c69d313a9b57291ac0f1f8;hb=aadaf032ee0be5915714f6e3d23a06ceaa126da0;hp=5d08fd6928d00d534d9696be1a92af44a079b33f;hpb=5df5e9521b0db02fedb91bb336b790f28088f823;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index 5d08fd6928..0eb94181f0 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -376,17 +376,17 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o . "\r\n"; } @@ -526,7 +526,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o $profile_name = $item['author-link']; } - $tags = Tag::populateTagsFromItem($item); + $tags = Tag::populateFromItem($item); $author = ['uid' => 0, 'id' => $item['author-id'], 'network' => $item['author-network'], 'url' => $item['author-link']]; @@ -769,20 +769,12 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid) $items = []; - foreach ($parents AS $parent) { - $condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) ", - $parent['uri'], $uid]; - if ($block_authors) { - $condition[0] .= "AND NOT `author`.`hidden`"; - } - - $thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity']), $condition, $params); + $follow = Item::activityToIndex(Activity::FOLLOW); - $comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false); - - if (count($comments) != 0) { - $items = array_merge($items, $comments); - } + foreach ($parents AS $parent) { + $condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) AND (`activity` != ? OR `activity` IS NULL)", + $parent['uri'], $uid, $follow]; + $items = conversation_fetch_items($parent, $items, $condition, $block_authors, $params); } foreach ($items as $index => $item) { @@ -796,6 +788,31 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid) return $items; } +/** + * Fetch conversation items + * + * @param array $parent + * @param array $items + * @param array $condition + * @param boolean $block_authors + * @param array $params + * @return array + */ +function conversation_fetch_items(array $parent, array $items, array $condition, bool $block_authors, array $params) { + if ($block_authors) { + $condition[0] .= "AND NOT `author`.`hidden`"; + } + + $thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity']), $condition, $params); + + $comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false); + + if (count($comments) != 0) { + $items = array_merge($items, $comments); + } + return $items; +} + function item_photo_menu($item) { $sub_link = ''; $poke_link = '';