X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FConversation.php;h=6c5313fdc5a1115ef332a6c453783d8d3c0adae6;hb=088a3b6bc429973381e6eb2931c6eacd5b8c8927;hp=ec317824b67b72cad1780a6cf5e9c52286685c39;hpb=53f34548742d958924bbf9e5da4009434f3d34ba;p=friendica.git diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index ec317824b6..6c5313fdc5 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -234,32 +234,32 @@ class Conversation $likers .= ' ' . $this->l10n->t('and %d other people', $total - $this->config->get('system', 'max_likers')); } - $spanatts = "class=\"fakelink\" onclick=\"openClose('{$verb}list-$id');\""; + $spanatts = "class=\"btn btn-link fakelink\" onclick=\"openClose('{$verb}list-$id');\""; $explikers = ''; switch ($verb) { case 'like': - $phrase = $this->l10n->t('%2$d people like this', $spanatts, $total); + $phrase = $this->l10n->t(' like this', $spanatts, $total); $explikers = $this->l10n->t('%s like this.', $likers); break; case 'dislike': - $phrase = $this->l10n->t('%2$d people don\'t like this', $spanatts, $total); + $phrase = $this->l10n->t(' don\'t like this', $spanatts, $total); $explikers = $this->l10n->t('%s don\'t like this.', $likers); break; case 'attendyes': - $phrase = $this->l10n->t('%2$d people attend', $spanatts, $total); + $phrase = $this->l10n->t(' attend', $spanatts, $total); $explikers = $this->l10n->t('%s attend.', $likers); break; case 'attendno': - $phrase = $this->l10n->t('%2$d people don\'t attend', $spanatts, $total); + $phrase = $this->l10n->t(' don\'t attend', $spanatts, $total); $explikers = $this->l10n->t('%s don\'t attend.', $likers); break; case 'attendmaybe': - $phrase = $this->l10n->t('%2$d people attend maybe', $spanatts, $total); + $phrase = $this->l10n->t(' attend maybe', $spanatts, $total); $explikers = $this->l10n->t('%s attend maybe.', $likers); break; case 'announce': - $phrase = $this->l10n->t('%2$d people reshared this', $spanatts, $total); + $phrase = $this->l10n->t(' reshared this', $spanatts, $total); $explikers = $this->l10n->t('%s reshared this.', $likers); break; } @@ -526,7 +526,7 @@ class Conversation $live_update_div = '' . "\r\n"; } - $page_dropping = $this->session->getLocalUserId() && $this->session->getLocalUserId() == $uid; + $page_dropping = $this->session->getLocalUserId() && $this->session->getLocalUserId() == $uid && $mode != 'search'; if (!$update) { $_SESSION['return_path'] = $this->args->getQueryString(); @@ -794,7 +794,7 @@ class Conversation return []; } - $str_blocked = str_replace(["\n", "\r"], ",", $this->pConfig->get($this->session->getLocalUserId(), 'system', 'blocked')); + $str_blocked = str_replace(["\n", "\r"], ",", $this->pConfig->get($this->session->getLocalUserId(), 'system', 'blocked') ?? ''); if (empty($str_blocked)) { return []; } @@ -970,7 +970,7 @@ class Conversation } $condition = DBA::mergeConditions($condition, - ["`uid` IN (0, ?) AND (`vid` != ? OR `vid` IS NULL)", $uid, Verb::getID(Activity::FOLLOW)]); + ["`uid` IN (0, ?) AND (NOT `vid` IN (?, ?, ?) OR `vid` IS NULL)", $uid, Verb::getID(Activity::FOLLOW), Verb::getID(Activity::VIEW), Verb::getID(Activity::READ)]); $thread_parents = Post::select(['uri-id', 'causer-id'], $condition, ['order' => ['uri-id' => false, 'uid']]); @@ -985,7 +985,8 @@ class Conversation $thread_items = Post::selectForUser($uid, array_merge(ItemModel::DISPLAY_FIELDLIST, ['featured', 'contact-uid', 'gravity', 'post-type', 'post-reason']), $condition, $params); - $items = []; + $items = []; + $quote_uri_ids = []; while ($row = Post::fetch($thread_items)) { if (!empty($items[$row['uri-id']]) && ($row['uid'] == 0)) { @@ -1005,11 +1006,37 @@ class Conversation } } + if (in_array($row['gravity'], [ItemModel::GRAVITY_PARENT, ItemModel::GRAVITY_COMMENT])) { + $quote_uri_ids[$row['uri-id']] = [ + 'uri-id' => $row['uri-id'], + 'uri' => $row['uri'], + 'parent-uri-id' => $row['parent-uri-id'], + 'parent-uri' => $row['parent-uri'], + ]; + } + $items[$row['uri-id']] = $this->addRowInformation($row, $activities[$row['uri-id']] ?? [], $thr_parent[$row['thr-parent-id']] ?? []); } DBA::close($thread_items); + $quotes = Post::select(array_merge(ItemModel::DISPLAY_FIELDLIST, ['featured', 'contact-uid', 'gravity', 'post-type', 'post-reason']), ['quote-uri-id' => array_column($quote_uri_ids, 'uri-id'), 'body' => '', 'uid' => 0]); + while ($quote = Post::fetch($quotes)) { + $row = $quote; + + $row['uid'] = $uid; + $row['verb'] = $row['body'] = $row['raw-body'] = Activity::ANNOUNCE; + $row['gravity'] = ItemModel::GRAVITY_ACTIVITY; + $row['object-type'] = Activity\ObjectType::NOTE; + $row['parent-uri'] = $quote_uri_ids[$quote['quote-uri-id']]['parent-uri']; + $row['parent-uri-id'] = $quote_uri_ids[$quote['quote-uri-id']]['parent-uri-id']; + $row['thr-parent'] = $quote_uri_ids[$quote['quote-uri-id']]['uri']; + $row['thr-parent-id'] = $quote_uri_ids[$quote['quote-uri-id']]['uri-id']; + + $items[$row['uri-id']] = $this->addRowInformation($row, [], []); + } + DBA::close($quotes); + $items = $this->convSort($items, $order); $this->profiler->stopRecording();