$thread_items = Post::selectForUser($uid, array_merge(ItemModel::DISPLAY_FIELDLIST, ['featured', 'contact-uid', 'gravity', 'post-type', 'post-reason']), $condition, $params);
- $items = [];
- $quoteuriids = [];
+ $items = [];
+ $quote_uri_ids = [];
while ($row = Post::fetch($thread_items)) {
if (!empty($items[$row['uri-id']]) && ($row['uid'] == 0)) {
}
if (in_array($row['gravity'], [ItemModel::GRAVITY_PARENT, ItemModel::GRAVITY_COMMENT])) {
- $quoteuriids[$row['uri-id']] = [
+ $quote_uri_ids[$row['uri-id']] = [
'uri-id' => $row['uri-id'],
'uri' => $row['uri'],
'parent-uri-id' => $row['parent-uri-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($quoteuriids, 'uri-id'), 'body' => '', 'uid' => 0]);
+ $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['verb'] = $row['body'] = $row['raw-body'] = Activity::ANNOUNCE;
$row['gravity'] = ItemModel::GRAVITY_ACTIVITY;
$row['object-type'] = Activity\ObjectType::NOTE;
- $row['parent-uri'] = $quoteuriids[$quote['quote-uri-id']]['parent-uri'];
- $row['parent-uri-id'] = $quoteuriids[$quote['quote-uri-id']]['parent-uri-id'];
- $row['thr-parent'] = $quoteuriids[$quote['quote-uri-id']]['uri'];
- $row['thr-parent-id'] = $quoteuriids[$quote['quote-uri-id']]['uri-id'];
+ $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, [], []);
}
$contact_field = ((($contact["contact-type"] == self::TYPE_COMMUNITY) || ($contact['network'] == Protocol::MAIL)) ? 'owner-id' : 'author-id');
if ($thread_mode) {
- $condition = ["((`$contact_field` = ? AND `gravity` = ?) OR (`author-id` = ? AND `gravity` = ? AND `vid` = ? AND `thr-parent-id` = `parent-uri-id`)) AND " . $sql,
- $cid, Item::GRAVITY_PARENT, $cid, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), DI::userSession()->getLocalUserId()];
+ $condition = ["((`$contact_field` = ? AND `gravity` = ?) OR (`author-id` = ? AND `gravity` = ? AND `vid` = ? AND `protocol` != ? AND `thr-parent-id` = `parent-uri-id`)) AND " . $sql,
+ $cid, Item::GRAVITY_PARENT, $cid, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Conversation::PARCEL_DIASPORA, DI::userSession()->getLocalUserId()];
} else {
$condition = ["`$contact_field` = ? AND `gravity` IN (?, ?) AND " . $sql,
$cid, Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, DI::userSession()->getLocalUserId()];
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
+use Friendica\Model\Conversation;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\Verb;
if (!$request['pinned'] && !$request['only_media']) {
if ($request['exclude_replies']) {
- $condition = DBA::mergeConditions($condition, ["(`gravity` = ? OR (`gravity` = ? AND `vid` = ?))",
- Item::GRAVITY_PARENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE)]);
+ $condition = DBA::mergeConditions($condition, ["(`gravity` = ? OR (`gravity` = ? AND `vid` = ? AND `protocol` != ?))",
+ Item::GRAVITY_PARENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Conversation::PARCEL_DIASPORA]);
} else {
- $condition = DBA::mergeConditions($condition, ["(`gravity` IN (?, ?) OR (`gravity` = ? AND `vid` = ?))",
- Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE)]);
+ $condition = DBA::mergeConditions($condition, ["(`gravity` IN (?, ?) OR (`gravity` = ? AND `vid` = ? AND `protocol` != ?))",
+ Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Conversation::PARCEL_DIASPORA]);
}
} elseif ($request['exclude_replies']) {
$condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]);
case Post\UserNotification::TYPE_QUOTED:
$msg = $l10n->t('%1$s shared your post %2$s');
break;
- }
+ }
break;
}
}