X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=6adc00d0c40d795dad1e2fcfb7d03542dc36b2c2;hb=e076998ffe7ed9e29c01463c10a0b36a49659e9d;hp=b25fae4f71683b47317bba6bde90583a5124c613;hpb=9c7a4ae2bdc174c8224be87dc9af1324652970bc;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index b25fae4f71..6adc00d0c4 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -443,15 +443,17 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o if (!$update) { $live_update_div = '
' . "\r\n" . "\r\n"; + . '?f=' + . (!empty($_GET['no_sharer']) ? '&no_sharer=' . rawurlencode($_GET['no_sharer']) : '') + . "'; \r\n"; } } elseif ($mode === 'contacts') { $items = conversation_add_children($items, false, $order, $uid); $profile_owner = 0; if (!$update) { - $live_update_div = '
' . "\r\n" - . "\r\n"; } } elseif ($mode === 'search') { @@ -499,7 +501,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o $writable = false; } - if (in_array($mode, ['network-new', 'search', 'contact-posts'])) { + if (in_array($mode, ['filed', 'search', 'contact-posts'])) { /* * "New Item View" on network page or search page results @@ -546,7 +548,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o $location_html = $locate['html'] ?: Strings::escapeHtml($locate['location'] ?: $locate['coord'] ?: ''); localize_item($item); - if ($mode === 'network-new') { + if ($mode === 'filed') { $dropping = true; } else { $dropping = false; @@ -560,9 +562,10 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o ]; $likebuttons = [ - 'like' => null, - 'dislike' => null, - 'share' => null, + 'like' => null, + 'dislike' => null, + 'share' => null, + 'announce' => null, ]; if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { @@ -583,6 +586,10 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o 'template' => $tpl, 'id' => ($preview ? 'P0' : $item['id']), 'guid' => ($preview ? 'Q0' : $item['guid']), + 'commented' => $item['commented'], + 'received' => $item['received'], + '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']), @@ -690,6 +697,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o '$live_update' => $live_update_div, '$remove' => DI::l10n()->t('remove'), '$mode' => $mode, + '$update' => $update, '$user' => $a->user, '$threads' => $threads, '$dropping' => ($page_dropping ? DI::l10n()->t('Delete Selected Items') : False), @@ -708,30 +716,9 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o */ function conversation_fetch_comments($thread_items, $pinned) { $comments = []; - $parentlines = []; - $lineno = 0; - $direction = []; - $actor = []; - $received = ''; while ($row = Item::fetch($thread_items)) { - 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'])]; - - $author = ['uid' => 0, 'id' => $row['author-id'], - 'network' => $row['author-network'], 'url' => $row['author-link']]; - $url = '' . htmlentities($row['author-name']) . ''; - - $actor = ['url' => $url, 'link' => $row['author-link'], 'avatar' => $row['author-avatar'], 'name' => $row['author-name']]; - $received = $row['received']; - } - - if (!empty($parentlines) && empty($direction) && ($row['gravity'] == GRAVITY_COMMENT) - && Contact::isSharing($row['author-id'], $row['uid'])) { - $direction = ['direction' => 5, 'title' => DI::l10n()->t('%s commented on this.', $row['author-name'])]; - } + $name = $row['causer-contact-type'] == Contact::TYPE_RELAY ? $row['causer-link'] : $row['causer-name']; switch ($row['post-type']) { case Item::PT_TO: @@ -753,7 +740,16 @@ function conversation_fetch_comments($thread_items, $pinned) { $row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')]; break; case Item::PT_ANNOUNCEMENT: - $row['direction'] = ['direction' => 3, 'title' => DI::l10n()->t('Reshared')]; + if (!empty($row['causer-id']) && DI::pConfig()->get(local_user(), 'system', 'display_resharer')) { + $row['owner-link'] = $row['causer-link']; + $row['owner-avatar'] = $row['causer-avatar']; + $row['owner-name'] = $row['causer-name']; + } + + if (($row['gravity'] == GRAVITY_PARENT) && !empty($row['causer-id'])) { + $row['reshared'] = DI::l10n()->t('%s reshared this.', '' . htmlentities($name) . ''); + } + $row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s', $name))]; break; case Item::PT_COMMENT: $row['direction'] = ['direction' => 5, 'title' => DI::l10n()->t('%s is participating in this thread.', $row['author-name'])]; @@ -765,41 +761,22 @@ function conversation_fetch_comments($thread_items, $pinned) { $row['direction'] = ['direction' => 9, 'title' => DI::l10n()->t('Global')]; break; case Item::PT_RELAY: - $row['direction'] = ['direction' => 10, 'title' => DI::l10n()->t('Relay')]; + $row['direction'] = ['direction' => 10, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Relayed') : DI::l10n()->t('Relayed by %s.', $name))]; break; case Item::PT_FETCHED: - $row['direction'] = ['direction' => 2, 'title' => DI::l10n()->t('Fetched')]; + $row['direction'] = ['direction' => 2, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Fetched') : DI::l10n()->t('Fetched because of %s', $name))]; break; } - if (($row['gravity'] == GRAVITY_PARENT) && !$row['origin'] && ($row['author-id'] == $row['owner-id']) && - !Contact::isSharing($row['author-id'], $row['uid'])) { - $parentlines[] = $lineno; - } - if ($row['gravity'] == GRAVITY_PARENT) { $row['pinned'] = $pinned; } $comments[] = $row; - $lineno++; } DBA::close($thread_items); - if (!empty($direction)) { - foreach ($parentlines as $line) { - $comments[$line]['direction'] = $direction; - if (!empty($actor)) { - $comments[$line]['reshared'] = DI::l10n()->t('%s reshared this.', $actor['url']); - if (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; } @@ -942,13 +919,17 @@ function item_photo_menu($item) { DI::l10n()->t('Ignore') => $ignore_link ]; + if (!empty($item['language'])) { + $menu[DI::l10n()->t('Languages')] = 'javascript:alert(\'' . Item::getLanguageMessage($item) . '\');'; + } + if ($network == Protocol::DFRN) { $menu[DI::l10n()->t("Poke")] = $poke_link; } if ((($cid == 0) || ($rel == Contact::FOLLOWER)) && in_array($item['network'], Protocol::FEDERATED)) { - $menu[DI::l10n()->t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']); + $menu[DI::l10n()->t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']) . '&auto=1'; } } else { $menu = [DI::l10n()->t('View Profile') => $item['author-link']]; @@ -1034,6 +1015,12 @@ function builtin_activity_puller($item, &$conv_responses) { continue; } + // Skip when the causer of the parent is the same than the author of the announce + if (($verb == Activity::ANNOUNCE) && Item::exists(['uri' => $item['thr-parent'], + 'uid' => $item['uid'], 'causer-id' => $item['author-id'], 'gravity' => GRAVITY_PARENT])) { + continue; + } + if (!isset($conv_responses[$mode][$item['thr-parent']])) { $conv_responses[$mode][$item['thr-parent']] = 1; } else {