Use user contact

This commit is contained in:
Michael 2021-11-21 05:40:48 +00:00
parent ff9786f3c3
commit 1acaa61446
2 changed files with 6 additions and 2 deletions

View File

@ -2633,7 +2633,7 @@ function api_direct_messages_new($type)
$replyto = ''; $replyto = '';
if (!empty($_REQUEST['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']; $replyto = $mail['parent-uri'];
$sub = $mail['title']; $sub = $mail['title'];
} else { } 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) { if ($id > -1) {
$mail = DBA::selectFirst('mail', [], ['id' => $id]); $mail = DBA::selectFirst('mail', [], ['id' => $id]);

View File

@ -2236,6 +2236,7 @@ class ApiTest extends FixtureTest
'owner-id' => 43, 'owner-id' => 43,
'plink' => '', 'plink' => '',
'uid' => $this->selfUser['id'], 'uid' => $this->selfUser['id'],
'uri-id' => 1,
] ]
]; ];
foreach ($items as $item) { foreach ($items as $item) {
@ -2261,6 +2262,7 @@ class ApiTest extends FixtureTest
'owner-id' => 43, 'owner-id' => 43,
'plink' => '', 'plink' => '',
'uid' => $this->selfUser['id'], 'uid' => $this->selfUser['id'],
'uri-id' => 1,
] ]
]; ];