Don't display Diaspora reshares

This commit is contained in:
Michael 2022-12-20 19:25:57 +00:00
parent a0faca9eaf
commit de1c0f4c13
4 changed files with 16 additions and 15 deletions

View file

@ -985,8 +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 = [];
$quoteuriids = [];
$items = [];
$quote_uri_ids = [];
while ($row = Post::fetch($thread_items)) {
if (!empty($items[$row['uri-id']]) && ($row['uid'] == 0)) {
@ -1007,7 +1007,7 @@ class Conversation
}
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'],
@ -1020,7 +1020,7 @@ class Conversation
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;
@ -1028,10 +1028,10 @@ class Conversation
$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, [], []);
}

View file

@ -1544,8 +1544,8 @@ class Contact
$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()];

View file

@ -26,6 +26,7 @@ use Friendica\Core\Protocol;
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;
@ -81,11 +82,11 @@ class Statuses extends BaseApi
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]);

View file

@ -315,7 +315,7 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow
case Post\UserNotification::TYPE_QUOTED:
$msg = $l10n->t('%1$s shared your post %2$s');
break;
}
}
break;
}
}