]> git.mxchange.org Git - friendica.git/commitdiff
Don't display Diaspora reshares
authorMichael <heluecht@pirati.ca>
Tue, 20 Dec 2022 19:25:57 +0000 (19:25 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 20 Dec 2022 19:25:57 +0000 (19:25 +0000)
src/Content/Conversation.php
src/Model/Contact.php
src/Module/Api/Mastodon/Accounts/Statuses.php
src/Navigation/Notifications/Factory/Notification.php

index aa7c016180493f5e77d78a147aa18452893fde72..d9036c78399c99be8fdd77a94a2fd4ee4f4c4c70 100644 (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, [], []);
                }
index 392f7776154b863f1f1bfe54998907450fd40526..2003b4608e84c88eddf36f489a8fda826a74a1c7 100644 (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()];
index b9bb63ae78bc0e487134dd667ef0390669a3cd24..36f730404a8cfa033ca7801f41f1b0ba6a7a585b 100644 (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]);
index 86d462e0b260a99a3b4dc6bc5c1f30a4927e39aa..6368820f6aff104bd1bd37b251c1320d9c51ee36 100644 (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;
                        }
                }