]> git.mxchange.org Git - friendica.git/commitdiff
Use user contact
authorMichael <heluecht@pirati.ca>
Sun, 21 Nov 2021 05:40:48 +0000 (05:40 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 21 Nov 2021 05:40:48 +0000 (05:40 +0000)
include/api.php
tests/legacy/ApiTest.php

index ef0e0bfbd0b2093116bafe7c7232a3afaf8312b9..5d6fb2add03420551baa2645f16edd76a46e8054 100644 (file)
@@ -2633,7 +2633,7 @@ function api_direct_messages_new($type)
 
        $replyto = '';
        if (!empty($_REQUEST['replyto'])) {
-               $mail = DBA::selectFirst('mail', ['parent-uri', 'title'], ['uid' => $uid, 'id' => $_REQUEST['replyto']]);
+               $mail    = DBA::selectFirst('mail', ['parent-uri', 'title'], ['uid' => $uid, 'id' => $_REQUEST['replyto']]);
                $replyto = $mail['parent-uri'];
                $sub     = $mail['title'];
        } else {
@@ -2644,7 +2644,9 @@ function api_direct_messages_new($type)
                }
        }
 
-       $id = Mail::send($cid, $_POST['text'], $sub, $replyto);
+       $cdata = Contact::getPublicAndUserContactID($cid, $uid);
+
+       $id = Mail::send($cdata['user'], $_POST['text'], $sub, $replyto);
 
        if ($id > -1) {
                $mail = DBA::selectFirst('mail', [], ['id' => $id]);
index 593d48975b4911c2fc869c456b770ed6ce489c91..cfe748977afe96ef2b878df46e92280ca39464f9 100644 (file)
@@ -2236,6 +2236,7 @@ class ApiTest extends FixtureTest
                                'owner-id'       => 43,
                                'plink'          => '',
                                'uid'            => $this->selfUser['id'],
+                               'uri-id'         => 1,
                        ]
                ];
                foreach ($items as $item) {
@@ -2261,6 +2262,7 @@ class ApiTest extends FixtureTest
                                'owner-id'       => 43,
                                'plink'          => '',
                                'uid'            => $this->selfUser['id'],
+                               'uri-id'         => 1,
                        ]
                ];