X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FDiaspora.php;h=587b34c3fe3b4839927e52a536fb09042f39ef40;hb=c07cb2c8f31154cc424e99c95740d753501e09b7;hp=a0bb0d9fa3a7796a3efdac08067a66aa60b4509b;hpb=6af4c90dff789eab9da78ac47ed1d29e107abdaf;p=friendica.git diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index a0bb0d9fa3..587b34c3fe 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -55,14 +55,15 @@ class Diaspora * * @param array $contact of the relay contact */ - public static function markRelayForArchival($contact) + public static function markRelayForArchival(array $contact) { if (!empty($contact['contact-type']) && ($contact['contact-type'] == Contact::TYPE_RELAY)) { // This is already the relay contact, we don't need to fetch it $relay_contact = $contact; } elseif (empty($contact['baseurl'])) { if (!empty($contact['batch'])) { - $relay_contact = DBA::selectFirst('contact', [], ['batch' => $contact['batch'], 'contact-type' => Contact::TYPE_RELAY, 'uid' => 0]); + $condition = ['uid' => 0, 'network' => Protocol::FEDERATED, 'batch' => $contact['batch'], 'contact-type' => Contact::TYPE_RELAY]; + $relay_contact = DBA::selectFirst('contact', [], $condition); } else { return; } @@ -174,7 +175,7 @@ class Diaspora * @return array with the contact * @throws \Exception */ - private static function getRelayContact($server_url, $fields = ['batch', 'id', 'name', 'network', 'protocol', 'archive', 'blocked']) + private static function getRelayContact(string $server_url, array $fields = ['batch', 'id', 'name', 'network', 'protocol', 'archive', 'blocked']) { // Fetch the relay contact $condition = ['uid' => 0, 'nurl' => Strings::normaliseLink($server_url), @@ -1607,7 +1608,7 @@ class Diaspora } if (self::isRedmatrix($contact["url"])) { - return $contact["url"] . "/?f=&mid=" . $guid; + return $contact["url"] . "/?mid=" . $guid; } if ($parent_guid != '') { @@ -3849,7 +3850,7 @@ class Diaspora return $result; } - $toplevel_item = Item::selectFirst(['guid', 'author-link'], ['id' => $item["parent"], 'parent' => $item["parent"]]); + $toplevel_item = Item::selectFirst(['guid', 'author-id', 'author-link'], ['id' => $item["parent"], 'parent' => $item["parent"]]); if (!DBA::isResult($toplevel_item)) { Logger::error('Missing parent conversation item', ['parent' => $item["parent"]]); return false; @@ -3857,12 +3858,18 @@ class Diaspora $thread_parent_item = $toplevel_item; if ($item['thr-parent'] != $item['parent-uri']) { - $thread_parent_item = Item::selectFirst(['guid', 'author-link'], ['uri' => $item['thr-parent'], 'uid' => $item['uid']]); + $thread_parent_item = Item::selectFirst(['guid', 'author-id', 'author-link'], ['uri' => $item['thr-parent'], 'uid' => $item['uid']]); } $body = $item["body"]; - if ((empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions')) + // The replied to autor mention is prepended for clarity if: + // - Item replied isn't yours + // - Item is public or explicit mentions are disabled + // - Implicit mentions are enabled + if ( + $item['author-id'] != $thread_parent_item['author-id'] + && (empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions')) && !Config::get('system', 'disable_implicit_mentions') ) { $body = self::prependParentAuthorMention($body, $thread_parent_item['author-link']);