X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=c668e53d9da656d3549c6328d54f7c86f6d0510f;hb=4841ac7dc57830f1d50e29f371afdd8f6af449a4;hp=8050296a564a652fc82176c0748841e9c35b27c8;hpb=d6a35c699558d8a592a23c2ba33bf48e5cad808e;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index 8050296a56..c668e53d9d 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -40,7 +40,6 @@ use Friendica\Object\Thread; use Friendica\Protocol\Activity; use Friendica\Util\Crypto; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Strings; use Friendica\Util\Temporal; use Friendica\Util\XML; @@ -593,7 +592,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'name' => $profile_name, 'sparkle' => $sparkle, 'lock' => $lock, - 'thumb' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)), + 'thumb' => DI::baseUrl()->remove($item['author-avatar']), 'title' => $title, 'body' => $body, 'tags' => $tags['tags'], @@ -613,7 +612,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'indent' => '', 'owner_name' => $owner_name, 'owner_url' => $owner_url, - 'owner_photo' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)), + 'owner_photo' => DI::baseUrl()->remove($item['owner-avatar']), 'plink' => Item::getPlink($item), 'edpost' => false, 'isstarred' => $isstarred, @@ -711,17 +710,30 @@ function conversation_fetch_comments($thread_items, $pinned) { $comments = []; $parentlines = []; $lineno = 0; + $direction = []; $actor = []; $received = ''; while ($row = Item::fetch($thread_items)) { - if (($row['verb'] == Activity::ANNOUNCE) && !empty($row['contact-uid']) && ($row['received'] > $received) && ($row['thr-parent'] == $row['parent-uri'])) { + if (!empty($parentlines) && ($row['verb'] == Activity::ANNOUNCE) + && ($row['thr-parent'] == $row['parent-uri']) && ($row['received'] > $received) + && Contact::isSharing($row['author-id'], $row['uid'])) { + $direction = ['direction' => 3, 'title' => DI::l10n()->t('%s reshared this.', $row['author-name'])]; $actor = ['link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']]; $received = $row['received']; } - if ((($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && !in_array($row['network'], [Protocol::DIASPORA])) && - (empty($row['contact-uid']) || !in_array($row['network'], Protocol::NATIVE_SUPPORT))) { + if (!empty($parentlines) && empty($direction) && ($row['gravity'] == GRAVITY_COMMENT) + && Contact::isSharing($row['author-id'], $row['uid'])) { + $direction = ['direction' => 2, 'title' => DI::l10n()->t('%s commented this.', $row['author-name'])]; + } + + if (($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && ($row['author-id'] == $row['owner-id']) + && !Contact::isSharing($row['author-id'], $row['uid'])) { + if ($row['post-type'] == Item::PT_TAG) { + $row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')]; + } + $parentlines[] = $lineno; } @@ -735,11 +747,14 @@ function conversation_fetch_comments($thread_items, $pinned) { DBA::close($thread_items); - if (!empty($actor)) { + if (!empty($direction)) { foreach ($parentlines as $line) { - $comments[$line]['owner-link'] = $actor['link']; - $comments[$line]['owner-avatar'] = $actor['avatar']; - $comments[$line]['owner-name'] = $actor['name']; + $comments[$line]['direction'] = $direction; + if (!empty($actor) && DI::pConfig()->get(local_user(), 'system', 'display_resharer') ) { + $comments[$line]['owner-link'] = $actor['link']; + $comments[$line]['owner-avatar'] = $actor['avatar']; + $comments[$line]['owner-name'] = $actor['name']; + } } } return $comments; @@ -766,7 +781,7 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid) $max_comments = DI::config()->get('system', 'max_display_comments', 1000); } - $params = ['order' => ['uid', 'commented' => true]]; + $params = ['order' => ['gravity', 'uid', 'commented' => true]]; if ($max_comments > 0) { $params['limit'] = $max_comments; @@ -806,7 +821,7 @@ function conversation_fetch_items(array $parent, array $items, array $condition, $condition[0] .= " AND NOT `author`.`hidden`"; } - $thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity']), $condition, $params); + $thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity', 'post-type']), $condition, $params); $comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false);