X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FConversation.php;h=04cdab4785e50b0e5efefbdddb322fe8b015e963;hb=65b86fe0d556829c09e8c8f5c707b868ad37dfe1;hp=fd880a04520eac63f9ffc95a0399463fedba2446;hpb=d44641e58c0cfa96c9c7b093c45854da87015b63;p=friendica.git diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index fd880a0452..04cdab4785 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -37,6 +37,7 @@ use Friendica\Core\Theme; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Item as ItemModel; +use Friendica\Model\Photo; use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; @@ -659,16 +660,6 @@ class Conversation $pinned = ''; } - if (in_array($item['network'], [Protocol::FEED, Protocol::MAIL])) { - $owner_avatar = $author_avatar = $item['contact-id']; - $owner_updated = $author_updated = ''; - } else { - $owner_avatar = $item['owner-id']; - $owner_updated = $item['owner-updated']; - $author_avatar = $item['author-id']; - $author_updated = $item['author-updated']; - } - $tmp_item = [ 'template' => $tpl, 'id' => ($preview ? 'P0' : $item['id']), @@ -678,15 +669,15 @@ class Conversation 'created_date' => $item['created'], 'uriid' => $item['uri-id'], 'network' => $item['network'], - 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network']), - 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link']), + 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network'], $item['author-gsid']), + 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link'], $item['author-gsid']), 'linktitle' => $this->l10n->t('View %s\'s profile @ %s', $profile_name, $item['author-link']), 'profile_url' => $profile_link, 'item_photo_menu_html' => $this->item->photoMenu($item, $formSecurityToken), 'name' => $profile_name, 'sparkle' => $sparkle, 'lock' => false, - 'thumb' => $this->baseURL->remove(Contact::getAvatarUrlForId($author_avatar, Proxy::SIZE_THUMB, $author_updated)), + 'thumb' => $this->baseURL->remove($this->item->getAuthorAvatar($item)), 'title' => $title, 'body_html' => $body_html, 'tags' => $tags['tags'], @@ -707,7 +698,7 @@ class Conversation 'indent' => '', 'owner_name' => '', 'owner_url' => '', - 'owner_photo' => $this->baseURL->remove(Contact::getAvatarUrlForId($owner_avatar, Proxy::SIZE_THUMB, $owner_updated)), + 'owner_photo' => $this->baseURL->remove($this->item->getOwnerAvatar($item)), 'plink' => ItemModel::getPlink($item), 'edpost' => false, 'pinned' => $pinned, @@ -930,8 +921,6 @@ class Conversation $max_comments = $this->config->get('system', 'max_display_comments', 1000); } - $params = ['order' => ['uri-id' => true, 'uid' => true]]; - $activities = []; $uriids = []; $commentcounter = []; @@ -965,10 +954,20 @@ class Conversation $condition = DBA::mergeConditions($condition, ["`uid` IN (0, ?) AND (`vid` != ? OR `vid` IS NULL)", $uid, Verb::getID(Activity::FOLLOW)]); + $thread_parents = Post::select(['uri-id', 'causer-id'], $condition, ['order' => ['uri-id' => false, 'uid']]); + + $thr_parent = []; + + while ($row = Post::fetch($thread_parents)) { + $thr_parent[$row['uri-id']] = $row; + } + DBA::close($thread_parents); + + $params = ['order' => ['uri-id' => true, 'uid' => true]]; + $thread_items = Post::selectForUser($uid, array_merge(ItemModel::DISPLAY_FIELDLIST, ['featured', 'contact-uid', 'gravity', 'post-type', 'post-reason']), $condition, $params); $items = []; - $thr_parent = []; while ($row = Post::fetch($thread_items)) { if (!empty($items[$row['uri-id']]) && ($row['uid'] == 0)) { @@ -984,11 +983,7 @@ class Conversation } } - if (empty($thr_parent[$row['thr-parent-id']])) { - $thr_parent[$row['thr-parent-id']] = Post::selectFirst(['causer-id'], ['uri-id' => $row['thr-parent-id'], 'uid' => $row['uid']]); - } - - $items[$row['uri-id']] = $this->addRowInformation($row, $activities[$row['uri-id']] ?? [], $thr_parent[$row['thr-parent-id']]); + $items[$row['uri-id']] = $this->addRowInformation($row, $activities[$row['uri-id']] ?? [], $thr_parent[$row['thr-parent-id']] ?? []); } DBA::close($thread_items);