]> git.mxchange.org Git - friendica.git/commitdiff
Issue 13627: DMs now work bidirectional again
authorMichael <heluecht@pirati.ca>
Wed, 22 Nov 2023 11:07:18 +0000 (11:07 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 22 Nov 2023 11:07:18 +0000 (11:07 +0000)
src/Protocol/ActivityPub/Receiver.php
src/Protocol/ActivityPub/Transmitter.php

index cd48768cc71c58e5e920404a8f9d65a2ece742c3..f195c8b9e650fcf525eadfaa2bbc8793c984e5d0 100644 (file)
@@ -682,7 +682,7 @@ class Receiver
                        self::addArrivedId($object_data['object_id']);
                }
 
-               $decouple = DI::config()->get('system', 'decoupled_receiver') && !in_array($completion, [self::COMPLETION_MANUAL, self::COMPLETION_ANNOUNCE]);
+               $decouple = DI::config()->get('system', 'decoupled_receiver') && !in_array($completion, [self::COMPLETION_MANUAL, self::COMPLETION_ANNOUNCE]) && empty($object_data['directmessage']);
 
                if ($decouple && ($trust_source || DI::config()->get('debug', 'ap_inbox_store_untrusted'))) {
                        $object_data = Queue::add($object_data, $type, $uid, $http_signer, $push, $trust_source);
index 83155bf4f103abdd0aaff33e8c9c7adfe86bfa7c..0a36f0c5bd3bc053b996898c65f4deffa7267d21 100644 (file)
@@ -1121,19 +1121,17 @@ class Transmitter
         */
        public static function fetchTargetInboxesFromMail(int $mail_id): array
        {
-               $mail = DBA::selectFirst('mail', ['uid', 'parent-uri', 'from-url'], ['id' => $mail_id]);
+               $mail = DBA::selectFirst('mail', ['contact-id'], ['id' => $mail_id]);
                if (!DBA::isResult($mail)) {
                        return [];
                }
 
-               $reply = DBA::selectFirst('mail', ['from-url'], ['parent-uri' => $mail['parent-uri'], 'reply' => false]);
-               if (!DBA::isResult($reply)) {
-                       $reply = $mail;
+               $account = DBA::selectFirst('account-user-view', ['ap-inbox'], ['id' => $mail['contact-id']]);
+               if (empty($account['ap-inbox'])) {
+                       return [];
                }
 
-               $apcontact = APContact::getByURL($reply['from-url'], false);
-
-               return [$apcontact['inbox'] => [Contact::getIdForURL($reply['from-url'])]];
+               return [$account['ap-inbox'] => [$mail['contact-id']]];
        }
 
        /**