<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Worker;
-use Friendica\DI;
use Friendica\Database\DBA;
-use Friendica\Model\Notify\Type;
-use Friendica\Network\Probe;
+use Friendica\DI;
use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
use Friendica\Worker\Delivery;
// send notifications.
$notif_params = [
- 'type' => Type::MAIL,
- 'notify_flags' => $user['notify-flags'],
- 'language' => $user['language'],
- 'to_name' => $user['username'],
- 'to_email' => $user['email'],
- 'uid' => $user['uid'],
- 'item' => $msg,
- 'parent' => $msg['id'],
- 'source_name' => $msg['from-name'],
- 'source_link' => $msg['from-url'],
- 'source_photo' => $msg['from-photo'],
- 'verb' => Activity::POST,
- 'otype' => 'mail'
+ 'type' => Notification\Type::MAIL,
+ 'otype' => Notification\ObjectType::MAIL,
+ 'verb' => Activity::POST,
+ 'uid' => $user['uid'],
+ 'cid' => $msg['contact-id'],
+ 'link' => DI::baseUrl() . '/message/' . $msg['id'],
];
notification($notif_params);
}
$me = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
- $contact = DBA::selectFirst('contact', [], ['id' => $recipient, 'uid' => local_user()]);
+ if (!DBA::isResult($me)) {
+ return -2;
+ }
- if (!(count($me) && (count($contact)))) {
+ $contact = DBA::selectFirst('contact', [], ['id' => $recipient, 'uid' => local_user()]);
+ if (!DBA::isResult($contact)) {
return -2;
}
$guid = System::createUUID();
$uri = Item::newURI(local_user(), $guid);
- $me = Probe::uri($replyto);
+ $me = Contact::getByURL($replyto);
if (!$me['name']) {
return -2;
}